Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Peter Ross <pross@xvid.org>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 1/4] avcodec/vp8: Fix wrong #endif comment
Date: Sun, 9 Mar 2025 07:19:55 +1100
Message-ID: <Z8yma5fkYi8b-sni@b23210acc22a312b5f9efa84d03776bb> (raw)
In-Reply-To: <AS8P250MB0744DFBD33ED996D42A020828FD42@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>


[-- Attachment #1.1: Type: text/plain, Size: 10232 bytes --]

On Sat, Mar 08, 2025 at 04:29:06AM +0100, Andreas Rheinhardt wrote:
> Patches attached
> 
> - Andreas

> From 54e27b588e18fdfe277a77b0f385cb02731022b9 Mon Sep 17 00:00:00 2001
> From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> Date: Thu, 6 Mar 2025 17:56:08 +0100
> Subject: [PATCH 1/4] avcodec/vp8: Fix wrong #endif comment
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/vp8.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
> index 3651688c10..6337fa173b 100644
> --- a/libavcodec/vp8.c
> +++ b/libavcodec/vp8.c
> @@ -2984,4 +2984,4 @@ const FFCodec ff_vp8_decoder = {
>                                 NULL
>                             },
>  };
> -#endif /* CONFIG_VP7_DECODER */
> +#endif /* CONFIG_VP8_DECODER */
> -- 
> 2.45.2
> 

> From 2360e180fabb2dc8577018283c8b3f5f46425a51 Mon Sep 17 00:00:00 2001
> From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> Date: Thu, 6 Mar 2025 18:00:28 +0100
> Subject: [PATCH 2/4] avcodec/vp8: Move codec-specific init code out of common
>  init
> 
> While just at it, also move the init functions inside
> the #if CONFIG_VP?_DECODER (to avoid linking failures).
> While just at it, also declare these init functions
> as av_cold and uninline the remaining common init function.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/vp8.c | 48 ++++++++++++++++++++++++------------------------
>  1 file changed, 24 insertions(+), 24 deletions(-)
> 
> diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
> index 6337fa173b..be8dbde91e 100644
> --- a/libavcodec/vp8.c
> +++ b/libavcodec/vp8.c
> @@ -2858,8 +2858,7 @@ av_cold int ff_vp8_decode_free(AVCodecContext *avctx)
>      return 0;
>  }
>  
> -static av_always_inline
> -int vp78_decode_init(AVCodecContext *avctx, int is_vp7)
> +static av_cold void vp78_decode_init(AVCodecContext *avctx)
>  {
>      VP8Context *s = avctx->priv_data;
>  
> @@ -2870,37 +2869,25 @@ int vp78_decode_init(AVCodecContext *avctx, int is_vp7)
>      ff_videodsp_init(&s->vdsp, 8);
>  
>      ff_vp78dsp_init(&s->vp8dsp);
> -    if (CONFIG_VP7_DECODER && is_vp7) {
> -        ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP7, 8, 1);
> -        ff_vp7dsp_init(&s->vp8dsp);
> -        s->decode_mb_row_no_filter = vp7_decode_mb_row_no_filter;
> -        s->filter_mb_row           = vp7_filter_mb_row;
> -    } else if (CONFIG_VP8_DECODER && !is_vp7) {
> -        ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP8, 8, 1);
> -        ff_vp8dsp_init(&s->vp8dsp);
> -        s->decode_mb_row_no_filter = vp8_decode_mb_row_no_filter;
> -        s->filter_mb_row           = vp8_filter_mb_row;
> -    }
>  
>      /* does not change for VP8 */
>      memcpy(s->prob[0].scan, ff_zigzag_scan, sizeof(s->prob[0].scan));
> -
> -    return 0;
>  }
>  
> -#if CONFIG_VP7_DECODER
> -static int vp7_decode_init(AVCodecContext *avctx)
> -{
> -    return vp78_decode_init(avctx, IS_VP7);
> -}
> -#endif /* CONFIG_VP7_DECODER */
> -
> +#if CONFIG_VP8_DECODER
>  av_cold int ff_vp8_decode_init(AVCodecContext *avctx)
>  {
> -    return vp78_decode_init(avctx, IS_VP8);
> +    VP8Context *s = avctx->priv_data;
> +
> +    vp78_decode_init(avctx);
> +    ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP8, 8, 1);
> +    ff_vp8dsp_init(&s->vp8dsp);
> +    s->decode_mb_row_no_filter = vp8_decode_mb_row_no_filter;
> +    s->filter_mb_row           = vp8_filter_mb_row;
> +
> +    return 0;
>  }
>  
> -#if CONFIG_VP8_DECODER
>  #if HAVE_THREADS
>  static void vp8_replace_frame(VP8Frame *dst, const VP8Frame *src)
>  {
> @@ -2944,6 +2931,19 @@ static int vp8_decode_update_thread_context(AVCodecContext *dst,
>  #endif /* CONFIG_VP8_DECODER */
>  
>  #if CONFIG_VP7_DECODER
> +av_cold static int vp7_decode_init(AVCodecContext *avctx)
> +{
> +    VP8Context *s = avctx->priv_data;
> +
> +    vp78_decode_init(avctx);
> +    ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP7, 8, 1);
> +    ff_vp7dsp_init(&s->vp8dsp);
> +    s->decode_mb_row_no_filter = vp7_decode_mb_row_no_filter;
> +    s->filter_mb_row           = vp7_filter_mb_row;
> +
> +    return 0;
> +}
> +
>  const FFCodec ff_vp7_decoder = {
>      .p.name                = "vp7",
>      CODEC_LONG_NAME("On2 VP7"),
> -- 
> 2.45.2
> 

> From 538cb0a9226066d4fe13ef07aad70e6f14273939 Mon Sep 17 00:00:00 2001
> From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> Date: Thu, 6 Mar 2025 18:16:50 +0100
> Subject: [PATCH 3/4] avcodec/vp8: Move VPx specific functions inside #if
>  CONFIG_VPx block
> 
> where appropriate. Avoids including ff_vp8_decode_frame()
> when the VP8 decoder is disabled.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/vp8.c | 74 +++++++++++++++++++++++-------------------------
>  1 file changed, 36 insertions(+), 38 deletions(-)
> 
> diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
> index be8dbde91e..77f7b4d4df 100644
> --- a/libavcodec/vp8.c
> +++ b/libavcodec/vp8.c
> @@ -2512,18 +2512,6 @@ static av_always_inline int decode_mb_row_no_filter(AVCodecContext *avctx, void
>      return 0;
>  }
>  
> -static int vp7_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata,
> -                                        int jobnr, int threadnr)
> -{
> -    return decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr, 1);
> -}
> -
> -static int vp8_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata,
> -                                        int jobnr, int threadnr)
> -{
> -    return decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr, 0);
> -}
> -
>  static av_always_inline void filter_mb_row(AVCodecContext *avctx, void *tdata,
>                                int jobnr, int threadnr, int is_vp7)
>  {
> @@ -2583,18 +2571,6 @@ static av_always_inline void filter_mb_row(AVCodecContext *avctx, void *tdata,
>      }
>  }
>  
> -static void vp7_filter_mb_row(AVCodecContext *avctx, void *tdata,
> -                              int jobnr, int threadnr)
> -{
> -    filter_mb_row(avctx, tdata, jobnr, threadnr, 1);
> -}
> -
> -static void vp8_filter_mb_row(AVCodecContext *avctx, void *tdata,
> -                              int jobnr, int threadnr)
> -{
> -    filter_mb_row(avctx, tdata, jobnr, threadnr, 0);
> -}
> -
>  static av_always_inline
>  int vp78_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata, int jobnr,
>                                int threadnr, int is_vp7)
> @@ -2837,20 +2813,6 @@ err:
>      return ret;
>  }
>  
> -int ff_vp8_decode_frame(AVCodecContext *avctx, AVFrame *frame,
> -                        int *got_frame, AVPacket *avpkt)
> -{
> -    return vp78_decode_frame(avctx, frame, got_frame, avpkt, IS_VP8);
> -}
> -
> -#if CONFIG_VP7_DECODER
> -static int vp7_decode_frame(AVCodecContext *avctx, AVFrame *frame,
> -                            int *got_frame, AVPacket *avpkt)
> -{
> -    return vp78_decode_frame(avctx, frame, got_frame, avpkt, IS_VP7);
> -}
> -#endif /* CONFIG_VP7_DECODER */
> -
>  av_cold int ff_vp8_decode_free(AVCodecContext *avctx)
>  {
>      vp8_decode_flush_impl(avctx, 1);
> @@ -2875,6 +2837,24 @@ static av_cold void vp78_decode_init(AVCodecContext *avctx)
>  }
>  
>  #if CONFIG_VP8_DECODER
> +static int vp8_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata,
> +                                        int jobnr, int threadnr)
> +{
> +    return decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr, 0);
> +}
> +
> +static void vp8_filter_mb_row(AVCodecContext *avctx, void *tdata,
> +                              int jobnr, int threadnr)
> +{
> +    filter_mb_row(avctx, tdata, jobnr, threadnr, 0);
> +}
> +
> +int ff_vp8_decode_frame(AVCodecContext *avctx, AVFrame *frame,
> +                        int *got_frame, AVPacket *avpkt)
> +{
> +    return vp78_decode_frame(avctx, frame, got_frame, avpkt, IS_VP8);
> +}
> +
>  av_cold int ff_vp8_decode_init(AVCodecContext *avctx)
>  {
>      VP8Context *s = avctx->priv_data;
> @@ -2931,6 +2911,24 @@ static int vp8_decode_update_thread_context(AVCodecContext *dst,
>  #endif /* CONFIG_VP8_DECODER */
>  
>  #if CONFIG_VP7_DECODER
> +static int vp7_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata,
> +                                        int jobnr, int threadnr)
> +{
> +    return decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr, 1);
> +}
> +
> +static void vp7_filter_mb_row(AVCodecContext *avctx, void *tdata,
> +                              int jobnr, int threadnr)
> +{
> +    filter_mb_row(avctx, tdata, jobnr, threadnr, 1);
> +}
> +
> +static int vp7_decode_frame(AVCodecContext *avctx, AVFrame *frame,
> +                            int *got_frame, AVPacket *avpkt)
> +{
> +    return vp78_decode_frame(avctx, frame, got_frame, avpkt, IS_VP7);
> +}
> +
>  av_cold static int vp7_decode_init(AVCodecContext *avctx)
>  {
>      VP8Context *s = avctx->priv_data;
> -- 
> 2.45.2
> 

> From 105f5edaa24b5ad0b4b1431cb04f22f3f5a106a6 Mon Sep 17 00:00:00 2001
> From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> Date: Thu, 6 Mar 2025 18:20:32 +0100
> Subject: [PATCH 4/4] avcodec/vp8: Remove always-false hwaccel checks for VP7
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/vp8.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
> index 77f7b4d4df..348744efd6 100644
> --- a/libavcodec/vp8.c
> +++ b/libavcodec/vp8.c
> @@ -2727,7 +2727,7 @@ int vp78_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame,
>      if (!is_vp7 && !s->actually_webp)
>          ff_thread_finish_setup(avctx);
>  
> -    if (avctx->hwaccel) {
> +    if (!is_vp7 && avctx->hwaccel) {
>          const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel);
>          ret = hwaccel->start_frame(avctx, avpkt->data, avpkt->size);
>          if (ret < 0)
> -- 

no objections, lgtm

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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:[~2025-03-08 20:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-08  3:29 Andreas Rheinhardt
2025-03-08 20:19 ` Peter Ross [this message]
2025-03-09  3:21   ` Andreas Rheinhardt

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=Z8yma5fkYi8b-sni@b23210acc22a312b5f9efa84d03776bb \
    --to=pross@xvid.org \
    --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