Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 1/3] avcodec/av1dec: Pass AVCodecContext* as logctx in get_sw_pixel_format()
Date: Wed, 13 Sep 2023 10:43:59 +0200
Message-ID: <AS8P250MB074491FB06BED4F774D05C628FF0A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <4d5533bd-7c7c-b867-8186-e857adc63422@gmail.com>

James Almer:
> On 9/12/2023 9:22 PM, Andreas Rheinhardt wrote:
>> Andreas Rheinhardt:
>>> It indicates to the reader that said function does not modify
>>> any state.
>>>
>>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
>>> ---
>>>   libavcodec/av1dec.c | 12 ++++++------
>>>   1 file changed, 6 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
>>> index 8f9c2dfefb..8f6c4f732e 100644
>>> --- a/libavcodec/av1dec.c
>>> +++ b/libavcodec/av1dec.c
>>> @@ -440,7 +440,7 @@ static int get_tiles_info(AVCodecContext *avctx,
>>> const AV1RawTileGroup *tile_gro
>>>     }
>>>   -static enum AVPixelFormat get_sw_pixel_format(AVCodecContext *avctx,
>>> +static enum AVPixelFormat get_sw_pixel_format(void *logctx,
>>>                                                 const
>>> AV1RawSequenceHeader *seq)
>>>   {
>>>       uint8_t bit_depth;
>>> @@ -451,7 +451,7 @@ static enum AVPixelFormat
>>> get_sw_pixel_format(AVCodecContext *avctx,
>>>       else if (seq->seq_profile <= 2)
>>>           bit_depth = seq->color_config.high_bitdepth ? 10 : 8;
>>>       else {
>>> -        av_log(avctx, AV_LOG_ERROR,
>>> +        av_log(logctx, AV_LOG_ERROR,
>>>                  "Unknown AV1 profile %d.\n", seq->seq_profile);
>>>           return -1;
>>>       }
>>> @@ -467,7 +467,7 @@ static enum AVPixelFormat
>>> get_sw_pixel_format(AVCodecContext *avctx,
>>>               else if (bit_depth == 12)
>>>                   pix_fmt = AV_PIX_FMT_YUV444P12;
>>>               else
>>> -                av_log(avctx, AV_LOG_WARNING, "Unknown AV1 pixel
>>> format.\n");
>>> +                av_log(logctx, AV_LOG_WARNING, "Unknown AV1 pixel
>>> format.\n");
>>>           } else if (seq->color_config.subsampling_x == 1 &&
>>>                      seq->color_config.subsampling_y == 0) {
>>>               if (bit_depth == 8)
>>> @@ -477,7 +477,7 @@ static enum AVPixelFormat
>>> get_sw_pixel_format(AVCodecContext *avctx,
>>>               else if (bit_depth == 12)
>>>                   pix_fmt = AV_PIX_FMT_YUV422P12;
>>>               else
>>> -                av_log(avctx, AV_LOG_WARNING, "Unknown AV1 pixel
>>> format.\n");
>>> +                av_log(logctx, AV_LOG_WARNING, "Unknown AV1 pixel
>>> format.\n");
>>>           } else if (seq->color_config.subsampling_x == 1 &&
>>>                      seq->color_config.subsampling_y == 1) {
>>>               if (bit_depth == 8)
>>> @@ -487,7 +487,7 @@ static enum AVPixelFormat
>>> get_sw_pixel_format(AVCodecContext *avctx,
>>>               else if (bit_depth == 12)
>>>                   pix_fmt = AV_PIX_FMT_YUV420P12;
>>>               else
>>> -                av_log(avctx, AV_LOG_WARNING, "Unknown AV1 pixel
>>> format.\n");
>>> +                av_log(logctx, AV_LOG_WARNING, "Unknown AV1 pixel
>>> format.\n");
>>>           }
>>>       } else {
>>>           if (bit_depth == 8)
>>> @@ -497,7 +497,7 @@ static enum AVPixelFormat
>>> get_sw_pixel_format(AVCodecContext *avctx,
>>>           else if (bit_depth == 12)
>>>               pix_fmt = AV_PIX_FMT_GRAY12;
>>>           else
>>> -            av_log(avctx, AV_LOG_WARNING, "Unknown AV1 pixel
>>> format.\n");
>>> +            av_log(logctx, AV_LOG_WARNING, "Unknown AV1 pixel
>>> format.\n");
>>>       }
>>>         return pix_fmt;
>>
>> Will apply this patchset tonight unless there are objections.
> 
> Not against it, but this reminds me I'd really like a way to pass a
> const pointer to av_log().

In this case you should take a look at bsf.c whose item_name callback
modifies the underlying AVClass-enabled context. (It also does not
bother with error checks.)

- Andreas

_______________________________________________
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-09-13  8:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-10 12:31 Andreas Rheinhardt
2023-09-10 12:53 ` [FFmpeg-devel] [PATCH 2/3] avcodec/av1dec: Don't rely on AV_PIX_FMT_NONE == -1 Andreas Rheinhardt
2023-09-10 12:53 ` [FFmpeg-devel] [PATCH 3/3] avcodec/thread: Remove ff_thread_get_format define Andreas Rheinhardt
2023-09-13  0:22 ` [FFmpeg-devel] [PATCH 1/3] avcodec/av1dec: Pass AVCodecContext* as logctx in get_sw_pixel_format() Andreas Rheinhardt
2023-09-13  0:36   ` James Almer
2023-09-13  8:43     ` Andreas Rheinhardt [this message]

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=AS8P250MB074491FB06BED4F774D05C628FF0A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.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