Also use loop-scope for variables where appropriate.
Unified · Split
| @@ -536,9 +536,6 @@ static const int packed_rgb_fmts[] = { · 535 unmodified lines | ||
| 536 | 536 | |
| 537 | 537 | static void check_yuv2packed1(void) |
| 538 | 538 | { |
| 539 | − SwsContext *sws; | |
| 540 | − SwsInternal *c; | |
| 541 | − | |
| 542 | 539 | static const int alpha_values[] = {0, 2048, 4096}; |
| 543 | 540 | |
| 544 | 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 | 580 | for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) { |
| 584 | 581 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]); |
| 585 | 582 | int line_size = INPUT_SIZE * desc->comp[0].step; |
| 583 | + SwsContext *sws; | |
| 584 | + SwsInternal *c; | |
| 585 | + | |
| 586 | 586 | if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM) |
| 587 | 587 | line_size = AV_CEIL_RSHIFT(line_size, 3); |
| 588 | 588 | |
| @@ -609,13 +609,13 @@ static void check_yuv2packed1(void) · 20 unmodified lines | ||
| 609 | 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 | |
| 615 | 617 | static void check_yuv2packed2(void) |
| 616 | 618 | { |
| 617 | − SwsContext *sws; | |
| 618 | − SwsInternal *c; | |
| 619 | 619 | static const int alpha_values[] = {0, 2048, 4096}; |
| 620 | 620 | |
| 621 | 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 | 660 | for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) { |
| 661 | 661 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]); |
| 662 | 662 | int line_size = INPUT_SIZE * desc->comp[0].step; |
| 663 | + SwsContext *sws; | |
| 664 | + SwsInternal *c; | |
| 665 | + | |
| 663 | 666 | if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM) |
| 664 | 667 | line_size = AV_CEIL_RSHIFT(line_size, 3); |
| 665 | 668 | |
| @@ -687,14 +690,13 @@ static void check_yuv2packed2(void) · 21 unmodified lines | ||
| 687 | 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 | |
| 693 | 698 | static void check_yuv2packedX(void) |
| 694 | 699 | { |
| 695 | − SwsContext *sws; | |
| 696 | − SwsInternal *c; | |
| 697 | − | |
| 698 | 700 | #define LARGEST_FILTER 16 |
| 699 | 701 | static const int filter_sizes[] = {2, 16}; |
| 700 | 702 | |
| @@ -745,6 +747,9 @@ static void check_yuv2packedX(void) · 44 unmodified lines | ||
| 745 | 747 | for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) { |
| 746 | 748 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]); |
| 747 | 749 | int line_size = INPUT_SIZE * desc->comp[0].step; |
| 750 | + SwsContext *sws; | |
| 751 | + SwsInternal *c; | |
| 752 | + | |
| 748 | 753 | if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM) |
| 749 | 754 | line_size = AV_CEIL_RSHIFT(line_size, 3); |
| 750 | 755 | |
| @@ -788,6 +793,8 @@ static void check_yuv2packedX(void) · 37 unmodified lines | ||
| 788 | 793 | alpha, dst1, INPUT_SIZE, 0); |
| 789 | 794 | } |
| 790 | 795 | } |
| 796 | + | |
| 797 | + sws_freeContext(sws); | |
| 791 | 798 | } |
| 792 | 799 | } |
| 793 | 800 | |