Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Stefano Sabatini <stefasab@gmail.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 2/7] avutil/tests/imgutils: add tests for av_image_fill_black()
Date: Mon, 4 Dec 2023 00:47:17 +0100
Message-ID: <ZW0ThXT+M6wLBBED@mariano> (raw)
In-Reply-To: <20231203002726.29683-2-cus@passwd.hu>

On date Sunday 2023-12-03 01:27:21 +0100, Marton Balint wrote:
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  libavutil/tests/imgutils.c |  60 ++++++++--
>  tests/ref/fate/imgutils    | 217 +++++++++++++++++++++++++++++++++++++
>  2 files changed, 268 insertions(+), 9 deletions(-)
> 
> diff --git a/libavutil/tests/imgutils.c b/libavutil/tests/imgutils.c
> index f3a433ac4a..500d24fdb8 100644
> --- a/libavutil/tests/imgutils.c
> +++ b/libavutil/tests/imgutils.c
> @@ -17,6 +17,7 @@
>   */
>  
>  #include "libavutil/imgutils.c"
> +#include "libavutil/crc.h"
>  
>  #undef printf
>  static int basic_tests(enum AVPixelFormat pix_fmt, int w, int h) {
> @@ -55,9 +56,43 @@ static int basic_tests(enum AVPixelFormat pix_fmt, int w, int h) {
>      return 0;
>  }
>  

> +static int black_tests(const AVPixFmtDescriptor *desc, enum AVPixelFormat pix_fmt, int w, int h)

nit: check_image_fill_black ?

> +{
> +    uint8_t *data[4];
> +    ptrdiff_t linesizes1[4];
> +    int ret, total_size, linesizes[4];
> +

> +    if (av_image_fill_linesizes(linesizes, pix_fmt, w) < 0)
> +        return -1;

nit: maybe we could store and return ret to give more information

> +    total_size = av_image_alloc(data, linesizes, w, h, pix_fmt, 4);
> +    if (total_size < 0) {
> +        printf("alloc failure");
> +        return -1;

ditto

> +    }
> +    printf("total_size: %6d", total_size);
> +    if (desc->flags & AV_PIX_FMT_FLAG_PAL)
> +        total_size -= 256 * 4;
> +    // Make it non-black by default...
> +    memset(data[0], 0xA3, total_size);
> +    for (int i = 0; i < 4; i++)
> +        linesizes1[i] = linesizes[i];
> +    for (enum AVColorRange range = 0; range < AVCOL_RANGE_NB; range++) {
> +        ret = av_image_fill_black(data, linesizes1, pix_fmt, range, w, h);
> +        printf(",  black_%s_crc: ", av_color_range_name(range));
> +        if (ret < 0) {
> +            printf("----------");

> +        } else {
> +            const AVCRC *ctx = av_crc_get_table(AV_CRC_32_IEEE_LE);

nit: crc?

> +            printf("0x%08"PRIx32, av_crc(ctx, 0, data[0], total_size));
> +        }
> +    }
> +    av_freep(&data[0]);
> +
> +    return 0;
> +}
> +
>  int main(void)
>  {
> -    const AVPixFmtDescriptor *desc = NULL;
>      int64_t x, y;
>  
>      for (y = -1; y<UINT_MAX; y+= y/2 + 1) {
> @@ -69,15 +104,22 @@ int main(void)
>      }
>      printf("\n");
>  
> -    while (desc = av_pix_fmt_desc_next(desc)) {
> -        int w = 64, h = 48;
> -        enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(desc);
> +    for (int i = 0; i < 2; i++) {
> +        printf(i ? "\nblack tests\n" : "basic tests\n");
> +        for (const AVPixFmtDescriptor *desc = NULL; desc = av_pix_fmt_desc_next(desc);) {
> +            int w = 64, h = 48;
> +            enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(desc);
>  
> -        if (desc->flags & AV_PIX_FMT_FLAG_HWACCEL)
> -            continue;
> -        printf("%-16s", desc->name);
> -        basic_tests(pix_fmt, w, h);
> -        printf("\n");
> +            if (desc->flags & AV_PIX_FMT_FLAG_HWACCEL)
> +                continue;
> +
> +            printf("%-16s", desc->name);
> +            if (i == 0)
> +                basic_tests(pix_fmt, w, h);
> +            else
> +                black_tests(desc, pix_fmt, w, h);
> +            printf("\n");
> +        }
>      }

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

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

  reply	other threads:[~2023-12-03 23:47 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-03  0:27 [FFmpeg-devel] [PATCH 1/7] avutil/tests/imgutils: factorize basic tests to new function Marton Balint
2023-12-03  0:27 ` [FFmpeg-devel] [PATCH 2/7] avutil/tests/imgutils: add tests for av_image_fill_black() Marton Balint
2023-12-03 23:47   ` Stefano Sabatini [this message]
2023-12-03  0:27 ` [FFmpeg-devel] [PATCH 3/7] avutil/imgutils: fix av_image_fill_black() for some pixel formats Marton Balint
2023-12-04  0:23   ` Stefano Sabatini
2023-12-03  0:27 ` [FFmpeg-devel] [PATCH 4/7] avutil/imgutils: add support for 32bit pixel format for av_image_fill_black() Marton Balint
2023-12-04  0:52   ` Stefano Sabatini
2023-12-03  0:27 ` [FFmpeg-devel] [PATCH 5/7] avutil/imgutils: factorize a fill color function Marton Balint
2023-12-04  1:04   ` Stefano Sabatini
2023-12-03  0:27 ` [FFmpeg-devel] [PATCH 6/7] avutil/imgutils: add new function av_image_fill_color() Marton Balint
2023-12-04  1:07   ` Stefano Sabatini
2023-12-03  0:27 ` [FFmpeg-devel] [PATCH 7/7] avcodec: add AV_CODEC_FLAG_CLEAR Marton Balint
2023-12-03 21:31 ` [FFmpeg-devel] [PATCH 1/7] avutil/tests/imgutils: factorize basic tests to new function Stefano Sabatini
2023-12-06  8:22   ` [FFmpeg-devel] [PATCH v2 " Marton Balint
2023-12-06  8:22     ` [FFmpeg-devel] [PATCH v2 2/7] avutil/tests/imgutils: add tests for av_image_fill_black() Marton Balint
2023-12-06 22:46       ` Stefano Sabatini
2023-12-06  8:22     ` [FFmpeg-devel] [PATCH v2 3/7] avutil/imgutils: fix av_image_fill_black() for some pixel formats Marton Balint
2023-12-06 22:47       ` Stefano Sabatini
2023-12-06  8:22     ` [FFmpeg-devel] [PATCH v2 4/7] avutil/imgutils: add support for 32bit pixel format for av_image_fill_black() Marton Balint
2023-12-06 22:48       ` Stefano Sabatini
2023-12-06  8:22     ` [FFmpeg-devel] [PATCH v2 5/7] avutil/imgutils: factorize a fill color function Marton Balint
2023-12-06 22:52       ` Stefano Sabatini
2023-12-06  8:22     ` [FFmpeg-devel] [PATCH v2 6/7] avutil/imgutils: add new function av_image_fill_color() Marton Balint
2023-12-06 22:53       ` Stefano Sabatini
2023-12-07 16:15       ` Anton Khirnov
2023-12-09 19:25         ` [FFmpeg-devel] [PATCH v3 " Marton Balint
2023-12-11 23:05           ` Stefano Sabatini
2023-12-12 18:45             ` Marton Balint
2023-12-06  8:22     ` [FFmpeg-devel] [PATCH v2 7/7] avcodec: add AV_CODEC_FLAG_CLEAR Marton Balint
2023-12-06 22:57       ` Stefano Sabatini
2023-12-07  1:44       ` Ronald S. Bultje
2023-12-07 16:19         ` Anton Khirnov
2023-12-07 22:47           ` Marton Balint
2023-12-08  5:12             ` Rémi Denis-Courmont
2023-12-07  2:37       ` Vittorio Giovara
2023-12-07 16:30       ` Anton Khirnov
2023-12-07 23:11         ` Marton Balint
2023-12-11 20:49           ` Mark Thompson
2023-12-12 11:23           ` Anton Khirnov
2023-12-12 18:37             ` Marton Balint
2023-12-13  8:59               ` Anton Khirnov
2023-12-13 17:09                 ` Marton Balint
2023-12-14  8:03                   ` Anton Khirnov
2023-12-12 22:18             ` Michael Niedermayer
2023-12-06 22:43     ` [FFmpeg-devel] [PATCH v2 1/7] avutil/tests/imgutils: factorize basic tests to new function Stefano Sabatini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZW0ThXT+M6wLBBED@mariano \
    --to=stefasab@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git