On Mon, Dec 30, 2019 at 09:54:17PM +0800, quinkbl...@foxmail.com wrote:
> From: Zhao Zhili <zhiliz...@tencent.com>
> 
> ---
>  libswscale/tests/swscale.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/libswscale/tests/swscale.c b/libswscale/tests/swscale.c
> index 19878a7877..784195f468 100644
> --- a/libswscale/tests/swscale.c
> +++ b/libswscale/tests/swscale.c
> @@ -251,6 +251,18 @@ end:
>      return res;
>  }
>  
> +static int getMaxFmt()
> +{
> +    const AVPixFmtDescriptor *desc = NULL;
> +    int fmt_max = AV_PIX_FMT_NONE;
> +
> +    while ((desc = av_pix_fmt_desc_next(desc))) {
> +        int fmt = av_pix_fmt_desc_get_id(desc);
> +        fmt_max = FFMAX(fmt, fmt_max);
> +    }
> +    return fmt_max;
> +}
> +
>  static void selfTest(const uint8_t * const ref[4], int refStride[4],
>                       int w, int h,
>                       enum AVPixelFormat srcFormat_in,
> @@ -264,9 +276,10 @@ static void selfTest(const uint8_t * const ref[4], int 
> refStride[4],
>      const int dstH[] = { srcH - srcH / 3, srcH, srcH + srcH / 3, 0 };
>      enum AVPixelFormat srcFormat, dstFormat;
>      const AVPixFmtDescriptor *desc_src, *desc_dst;
> +    const int fmt_max = getMaxFmt();
>  
>      for (srcFormat = srcFormat_in != AV_PIX_FMT_NONE ? srcFormat_in : 0;
> -         srcFormat < AV_PIX_FMT_NB; srcFormat++) {
> +         srcFormat <= fmt_max; srcFormat++) {
>          if (!sws_isSupportedInput(srcFormat) ||
>              !sws_isSupportedOutput(srcFormat))
>              continue;
> @@ -274,7 +287,7 @@ static void selfTest(const uint8_t * const ref[4], int 
> refStride[4],
>          desc_src = av_pix_fmt_desc_get(srcFormat);
>  
>          for (dstFormat = dstFormat_in != AV_PIX_FMT_NONE ? dstFormat_in : 0;
> -             dstFormat < AV_PIX_FMT_NB; dstFormat++) {
> +             dstFormat <= fmt_max; dstFormat++) {
>              int i, j, k;
>              int res = 0;

Iam not sure this makes sense, formats added after build of the test
would only be rejected in sws_isSupported* in the next line


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you drop bombs on a foreign country and kill a hundred thousand
innocent people, expect your government to call the consequence
"unprovoked inhuman terrorist attacks" and use it to justify dropping
more bombs and killing more people. The technology changed, the idea is old.

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to