Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/3] avcodec/av1dec: Pass AVCodecContext* as logctx in get_sw_pixel_format()
@ 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
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2023-09-10 12:31 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: 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;
-- 
2.34.1

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [FFmpeg-devel] [PATCH 2/3] avcodec/av1dec: Don't rely on AV_PIX_FMT_NONE == -1
  2023-09-10 12:31 [FFmpeg-devel] [PATCH 1/3] avcodec/av1dec: Pass AVCodecContext* as logctx in get_sw_pixel_format() Andreas Rheinhardt
@ 2023-09-10 12:53 ` 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
  2 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2023-09-10 12:53 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Since fb548fba04193a418f118d21b261ba05db4f480b,
this return -1 is in a function returning enum AVPixelFormat
whose caller checks for AV_PIX_FMT_NONE for failure.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/av1dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index 8f6c4f732e..c523c457ec 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -453,7 +453,7 @@ static enum AVPixelFormat get_sw_pixel_format(void *logctx,
     else {
         av_log(logctx, AV_LOG_ERROR,
                "Unknown AV1 profile %d.\n", seq->seq_profile);
-        return -1;
+        return AV_PIX_FMT_NONE;
     }
 
     if (!seq->color_config.mono_chrome) {
-- 
2.34.1

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [FFmpeg-devel] [PATCH 3/3] avcodec/thread: Remove ff_thread_get_format define
  2023-09-10 12:31 [FFmpeg-devel] [PATCH 1/3] avcodec/av1dec: Pass AVCodecContext* as logctx in get_sw_pixel_format() 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 ` 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
  2 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2023-09-10 12:53 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Unnecessary since FF_API_THREAD_SAFE_CALLBACKS is no more.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/av1dec.c     | 2 +-
 libavcodec/h264_slice.c | 2 +-
 libavcodec/hevcdec.c    | 2 +-
 libavcodec/mpeg12dec.c  | 2 +-
 libavcodec/proresdec2.c | 2 +-
 libavcodec/thread.h     | 2 --
 libavcodec/vp9.c        | 2 +-
 7 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index c523c457ec..39ccad5bf6 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -613,7 +613,7 @@ static int get_pixel_format(AVCodecContext *avctx)
     *fmtp++ = pix_fmt;
     *fmtp = AV_PIX_FMT_NONE;
 
-    ret = ff_thread_get_format(avctx, pix_fmts);
+    ret = ff_get_format(avctx, pix_fmts);
 
     /**
      * check if the HW accel is inited correctly. If not, return un-implemented.
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 6cd7bb8fe7..f3af345c99 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -922,7 +922,7 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
     for (int i = 0; pix_fmts[i] != AV_PIX_FMT_NONE; i++)
         if (pix_fmts[i] == h->avctx->pix_fmt && !force_callback)
             return pix_fmts[i];
-    return ff_thread_get_format(h->avctx, pix_fmts);
+    return ff_get_format(h->avctx, pix_fmts);
 }
 
 /* export coded and cropped frame dimensions to AVCodecContext */
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index ad22d0a30c..81b9c5e089 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -521,7 +521,7 @@ static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps)
     *fmt++ = sps->pix_fmt;
     *fmt = AV_PIX_FMT_NONE;
 
-    return ff_thread_get_format(s->avctx, pix_fmts);
+    return ff_get_format(s->avctx, pix_fmts);
 }
 
 static int set_sps(HEVCContext *s, const HEVCSPS *sps,
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 1accd07e9e..677360f954 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1168,7 +1168,7 @@ static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx)
     else
         pix_fmts = mpeg12_pixfmt_list_444;
 
-    return ff_thread_get_format(avctx, pix_fmts);
+    return ff_get_format(avctx, pix_fmts);
 }
 
 /* Call this function when we know all parameters.
diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
index 9297860946..def58b2604 100644
--- a/libavcodec/proresdec2.c
+++ b/libavcodec/proresdec2.c
@@ -278,7 +278,7 @@ static int decode_frame_header(ProresContext *ctx, const uint8_t *buf,
         *fmtp++ = ctx->pix_fmt;
         *fmtp = AV_PIX_FMT_NONE;
 
-        if ((ret = ff_thread_get_format(avctx, pix_fmts)) < 0)
+        if ((ret = ff_get_format(avctx, pix_fmts)) < 0)
             return ret;
 
         avctx->pix_fmt = ret;
diff --git a/libavcodec/thread.h b/libavcodec/thread.h
index 88a14cfeb1..2c8c0cdb16 100644
--- a/libavcodec/thread.h
+++ b/libavcodec/thread.h
@@ -62,8 +62,6 @@ int ff_thread_decode_frame(AVCodecContext *avctx, AVFrame *picture,
  */
 void ff_thread_finish_setup(AVCodecContext *avctx);
 
-#define ff_thread_get_format ff_get_format
-
 /**
  * Wrapper around get_buffer() for frame-multithreaded codecs.
  * Call this function instead of ff_get_buffer(f).
diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 89f7549ef0..3cc27aa812 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -250,7 +250,7 @@ static int update_size(AVCodecContext *avctx, int w, int h)
         *fmtp++ = s->pix_fmt;
         *fmtp = AV_PIX_FMT_NONE;
 
-        ret = ff_thread_get_format(avctx, pix_fmts);
+        ret = ff_get_format(avctx, pix_fmts);
         if (ret < 0)
             return ret;
 
-- 
2.34.1

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/3] avcodec/av1dec: Pass AVCodecContext* as logctx in get_sw_pixel_format()
  2023-09-10 12:31 [FFmpeg-devel] [PATCH 1/3] avcodec/av1dec: Pass AVCodecContext* as logctx in get_sw_pixel_format() 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 ` Andreas Rheinhardt
  2023-09-13  0:36   ` James Almer
  2 siblings, 1 reply; 6+ messages in thread
From: Andreas Rheinhardt @ 2023-09-13  0:22 UTC (permalink / raw)
  To: ffmpeg-devel

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.

- 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".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/3] avcodec/av1dec: Pass AVCodecContext* as logctx in get_sw_pixel_format()
  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
  0 siblings, 1 reply; 6+ messages in thread
From: James Almer @ 2023-09-13  0:36 UTC (permalink / raw)
  To: ffmpeg-devel

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().
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/3] avcodec/av1dec: Pass AVCodecContext* as logctx in get_sw_pixel_format()
  2023-09-13  0:36   ` James Almer
@ 2023-09-13  8:43     ` Andreas Rheinhardt
  0 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2023-09-13  8:43 UTC (permalink / raw)
  To: ffmpeg-devel

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".

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-09-13  8:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-10 12:31 [FFmpeg-devel] [PATCH 1/3] avcodec/av1dec: Pass AVCodecContext* as logctx in get_sw_pixel_format() 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

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