History

tests/checkasm/sw_rgb: Fix leaks

Also use loop-scope for variables where appropriate.

Andreas Rheinhardt committed 1 year ago

Commit 5a722661 parent e5403811 file · +15 −8Browse files

Unified · Split

tests/checkasm/sw_rgb.c+15−8
@@ -536,9 +536,6 @@ static const int packed_rgb_fmts[] = { · 535 unmodified lines
536 536
537static void check_yuv2packed1(void)537static void check_yuv2packed1(void)
538{538{
539 SwsContext *sws;
540 SwsInternal *c;
541
542 static const int alpha_values[] = {0, 2048, 4096};539 static const int alpha_values[] = {0, 2048, 4096};
543 540
544 declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT,541 declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT,
@@ -583,6 +580,9 @@ static void check_yuv2packed1(void) · 38 unmodified lines
583 for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) {580 for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) {
584 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]);581 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]);
585 int line_size = INPUT_SIZE * desc->comp[0].step;582 int line_size = INPUT_SIZE * desc->comp[0].step;
583 SwsContext *sws;
584 SwsInternal *c;
585
586 if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)586 if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)
587 line_size = AV_CEIL_RSHIFT(line_size, 3);587 line_size = AV_CEIL_RSHIFT(line_size, 3);
588 588
@@ -609,13 +609,13 @@ static void check_yuv2packed1(void) · 20 unmodified lines
609 bench_new(c, luma, chru, chrv, alpha, dst1, INPUT_SIZE, chr_alpha, 0);609 bench_new(c, luma, chru, chrv, alpha, dst1, INPUT_SIZE, chr_alpha, 0);
610 }610 }
611 }611 }
612
613 sws_freeContext(sws);
612 }614 }
613}615}
614 616
615static void check_yuv2packed2(void)617static void check_yuv2packed2(void)
616{618{
617 SwsContext *sws;
618 SwsInternal *c;
619 static const int alpha_values[] = {0, 2048, 4096};619 static const int alpha_values[] = {0, 2048, 4096};
620 620
621 declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT,621 declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT,
@@ -660,6 +660,9 @@ static void check_yuv2packed2(void) · 38 unmodified lines
660 for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) {660 for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) {
661 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]);661 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]);
662 int line_size = INPUT_SIZE * desc->comp[0].step;662 int line_size = INPUT_SIZE * desc->comp[0].step;
663 SwsContext *sws;
664 SwsInternal *c;
665
663 if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)666 if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)
664 line_size = AV_CEIL_RSHIFT(line_size, 3);667 line_size = AV_CEIL_RSHIFT(line_size, 3);
665 668
@@ -687,14 +690,13 @@ static void check_yuv2packed2(void) · 21 unmodified lines
687 bench_new(c, luma, chru, chrv, alpha, dst1, INPUT_SIZE, lum_alpha, chr_alpha, 0);690 bench_new(c, luma, chru, chrv, alpha, dst1, INPUT_SIZE, lum_alpha, chr_alpha, 0);
688 }691 }
689 }692 }
693
694 sws_freeContext(sws);
690 }695 }
691}696}
692 697
693static void check_yuv2packedX(void)698static void check_yuv2packedX(void)
694{699{
695 SwsContext *sws;
696 SwsInternal *c;
697
698#define LARGEST_FILTER 16700#define LARGEST_FILTER 16
699 static const int filter_sizes[] = {2, 16};701 static const int filter_sizes[] = {2, 16};
700 702
@@ -745,6 +747,9 @@ static void check_yuv2packedX(void) · 44 unmodified lines
745 for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) {747 for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) {
746 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]);748 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]);
747 int line_size = INPUT_SIZE * desc->comp[0].step;749 int line_size = INPUT_SIZE * desc->comp[0].step;
750 SwsContext *sws;
751 SwsInternal *c;
752
748 if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)753 if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)
749 line_size = AV_CEIL_RSHIFT(line_size, 3);754 line_size = AV_CEIL_RSHIFT(line_size, 3);
750 755
@@ -788,6 +793,8 @@ static void check_yuv2packedX(void) · 37 unmodified lines
788 alpha, dst1, INPUT_SIZE, 0);793 alpha, dst1, INPUT_SIZE, 0);
789 }794 }
790 }795 }
796
797 sws_freeContext(sws);
791 }798 }
792}799}
793 800

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t