forked from FFmpeg/FFmpeg
tests/checkasm/sw_rgb: Fix leaks
Also use loop-scope for variables where appropriate. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
e540381f91
commit
5a72266d49
1 changed files with 15 additions and 8 deletions
|
@ -536,9 +536,6 @@ static const int packed_rgb_fmts[] = {
|
||||||
|
|
||||||
static void check_yuv2packed1(void)
|
static void check_yuv2packed1(void)
|
||||||
{
|
{
|
||||||
SwsContext *sws;
|
|
||||||
SwsInternal *c;
|
|
||||||
|
|
||||||
static const int alpha_values[] = {0, 2048, 4096};
|
static const int alpha_values[] = {0, 2048, 4096};
|
||||||
|
|
||||||
declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT,
|
declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT,
|
||||||
|
@ -583,6 +580,9 @@ static void check_yuv2packed1(void)
|
||||||
for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) {
|
for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) {
|
||||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]);
|
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]);
|
||||||
int line_size = INPUT_SIZE * desc->comp[0].step;
|
int line_size = INPUT_SIZE * desc->comp[0].step;
|
||||||
|
SwsContext *sws;
|
||||||
|
SwsInternal *c;
|
||||||
|
|
||||||
if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)
|
if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)
|
||||||
line_size = AV_CEIL_RSHIFT(line_size, 3);
|
line_size = AV_CEIL_RSHIFT(line_size, 3);
|
||||||
|
|
||||||
|
@ -609,13 +609,13 @@ static void check_yuv2packed1(void)
|
||||||
bench_new(c, luma, chru, chrv, alpha, dst1, INPUT_SIZE, chr_alpha, 0);
|
bench_new(c, luma, chru, chrv, alpha, dst1, INPUT_SIZE, chr_alpha, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sws_freeContext(sws);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_yuv2packed2(void)
|
static void check_yuv2packed2(void)
|
||||||
{
|
{
|
||||||
SwsContext *sws;
|
|
||||||
SwsInternal *c;
|
|
||||||
static const int alpha_values[] = {0, 2048, 4096};
|
static const int alpha_values[] = {0, 2048, 4096};
|
||||||
|
|
||||||
declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT,
|
declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT,
|
||||||
|
@ -660,6 +660,9 @@ static void check_yuv2packed2(void)
|
||||||
for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) {
|
for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) {
|
||||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]);
|
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]);
|
||||||
int line_size = INPUT_SIZE * desc->comp[0].step;
|
int line_size = INPUT_SIZE * desc->comp[0].step;
|
||||||
|
SwsContext *sws;
|
||||||
|
SwsInternal *c;
|
||||||
|
|
||||||
if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)
|
if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)
|
||||||
line_size = AV_CEIL_RSHIFT(line_size, 3);
|
line_size = AV_CEIL_RSHIFT(line_size, 3);
|
||||||
|
|
||||||
|
@ -687,14 +690,13 @@ static void check_yuv2packed2(void)
|
||||||
bench_new(c, luma, chru, chrv, alpha, dst1, INPUT_SIZE, lum_alpha, chr_alpha, 0);
|
bench_new(c, luma, chru, chrv, alpha, dst1, INPUT_SIZE, lum_alpha, chr_alpha, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sws_freeContext(sws);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_yuv2packedX(void)
|
static void check_yuv2packedX(void)
|
||||||
{
|
{
|
||||||
SwsContext *sws;
|
|
||||||
SwsInternal *c;
|
|
||||||
|
|
||||||
#define LARGEST_FILTER 16
|
#define LARGEST_FILTER 16
|
||||||
static const int filter_sizes[] = {2, 16};
|
static const int filter_sizes[] = {2, 16};
|
||||||
|
|
||||||
|
@ -745,6 +747,9 @@ static void check_yuv2packedX(void)
|
||||||
for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) {
|
for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) {
|
||||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]);
|
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]);
|
||||||
int line_size = INPUT_SIZE * desc->comp[0].step;
|
int line_size = INPUT_SIZE * desc->comp[0].step;
|
||||||
|
SwsContext *sws;
|
||||||
|
SwsInternal *c;
|
||||||
|
|
||||||
if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)
|
if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)
|
||||||
line_size = AV_CEIL_RSHIFT(line_size, 3);
|
line_size = AV_CEIL_RSHIFT(line_size, 3);
|
||||||
|
|
||||||
|
@ -788,6 +793,8 @@ static void check_yuv2packedX(void)
|
||||||
alpha, dst1, INPUT_SIZE, 0);
|
alpha, dst1, INPUT_SIZE, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sws_freeContext(sws);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue