diff mbox series

[FFmpeg-devel,06/18] lavc/dv: do not pass DVVideoContext to ff_dv_init_dynamic_tables()

Message ID 20220824084318.333-6-anton@khirnov.net
State Accepted
Commit 91c51dac6d00fec9dca0dc137230f1ab24ab7077
Headers show
Series [FFmpeg-devel,01/18] tests/fate/mov: add a test for dv audio demuxed through dv demuxer | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 fail Make fate failed
andriy/make_x86 success Make finished
andriy/make_fate_x86 fail Make fate failed

Commit Message

Anton Khirnov Aug. 24, 2022, 8:43 a.m. UTC
It only needs work_chunks from it, so pass that directly.

This is done in preparation to splitting DVVideoContext.
---
 libavcodec/dv.c    | 6 +++---
 libavcodec/dv.h    | 2 +-
 libavcodec/dvdec.c | 2 +-
 libavcodec/dvenc.c | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

Comments

Andreas Rheinhardt Aug. 24, 2022, 12:28 p.m. UTC | #1
Anton Khirnov:
> It only needs work_chunks from it, so pass that directly.
> 
> This is done in preparation to splitting DVVideoContext.
> ---
>  libavcodec/dv.c    | 6 +++---
>  libavcodec/dv.h    | 2 +-
>  libavcodec/dvdec.c | 2 +-
>  libavcodec/dvenc.c | 2 +-
>  4 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/libavcodec/dv.c b/libavcodec/dv.c
> index 9e05aa8927..b5e54de5dd 100644
> --- a/libavcodec/dv.c
> +++ b/libavcodec/dv.c
> @@ -162,7 +162,7 @@ static inline void dv_calc_mb_coordinates(const AVDVProfile *d, int chan,
>      }
>  }
>  
> -int ff_dv_init_dynamic_tables(DVVideoContext *ctx, const AVDVProfile *d)
> +int ff_dv_init_dynamic_tables(DVwork_chunk *work_chunks, const AVDVProfile *d)
>  {
>      int j, i, c, s, p;
>  
> @@ -174,8 +174,8 @@ int ff_dv_init_dynamic_tables(DVVideoContext *ctx, const AVDVProfile *d)
>                  p += !(j % 3);
>                  if (!(DV_PROFILE_IS_1080i50(d) && c != 0 && s == 11) &&
>                      !(DV_PROFILE_IS_720p50(d) && s > 9)) {
> -                    dv_calc_mb_coordinates(d, c, s, j, &ctx->work_chunks[i].mb_coordinates[0]);
> -                    ctx->work_chunks[i++].buf_offset = p;
> +                    dv_calc_mb_coordinates(d, c, s, j, &work_chunks[i].mb_coordinates[0]);
> +                    work_chunks[i++].buf_offset = p;
>                  }
>                  p += 5;
>              }
> diff --git a/libavcodec/dv.h b/libavcodec/dv.h
> index 2b082d0140..286b267de2 100644
> --- a/libavcodec/dv.h
> +++ b/libavcodec/dv.h
> @@ -95,7 +95,7 @@ enum dv_pack_type {
>   */
>  #define DV_MAX_BPM 8
>  
> -int ff_dv_init_dynamic_tables(DVVideoContext *s, const AVDVProfile *d);
> +int ff_dv_init_dynamic_tables(DVwork_chunk *work_chunks, const AVDVProfile *d);
>  
>  static inline int dv_work_pool_size(const AVDVProfile *d)
>  {
> diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
> index daee2347e6..1e2c097ed0 100644
> --- a/libavcodec/dvdec.c
> +++ b/libavcodec/dvdec.c
> @@ -626,7 +626,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, AVFrame *frame,
>      }
>  
>      if (sys != s->sys) {
> -        ret = ff_dv_init_dynamic_tables(s, sys);
> +        ret = ff_dv_init_dynamic_tables(s->work_chunks, sys);
>          if (ret < 0) {
>              av_log(avctx, AV_LOG_ERROR, "Error initializing the work tables.\n");
>              return ret;
> diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c
> index 8027feb9b3..712ca325de 100644
> --- a/libavcodec/dvenc.c
> +++ b/libavcodec/dvenc.c
> @@ -67,7 +67,7 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx)
>          return AVERROR(EINVAL);
>      }
>  
> -    ret = ff_dv_init_dynamic_tables(s, s->sys);
> +    ret = ff_dv_init_dynamic_tables(s->work_chunks, s->sys);
>      if (ret < 0) {
>          av_log(avctx, AV_LOG_ERROR, "Error initializing work tables.\n");
>          return ret;

LGTM.

- Andreas
diff mbox series

Patch

diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index 9e05aa8927..b5e54de5dd 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -162,7 +162,7 @@  static inline void dv_calc_mb_coordinates(const AVDVProfile *d, int chan,
     }
 }
 
-int ff_dv_init_dynamic_tables(DVVideoContext *ctx, const AVDVProfile *d)
+int ff_dv_init_dynamic_tables(DVwork_chunk *work_chunks, const AVDVProfile *d)
 {
     int j, i, c, s, p;
 
@@ -174,8 +174,8 @@  int ff_dv_init_dynamic_tables(DVVideoContext *ctx, const AVDVProfile *d)
                 p += !(j % 3);
                 if (!(DV_PROFILE_IS_1080i50(d) && c != 0 && s == 11) &&
                     !(DV_PROFILE_IS_720p50(d) && s > 9)) {
-                    dv_calc_mb_coordinates(d, c, s, j, &ctx->work_chunks[i].mb_coordinates[0]);
-                    ctx->work_chunks[i++].buf_offset = p;
+                    dv_calc_mb_coordinates(d, c, s, j, &work_chunks[i].mb_coordinates[0]);
+                    work_chunks[i++].buf_offset = p;
                 }
                 p += 5;
             }
diff --git a/libavcodec/dv.h b/libavcodec/dv.h
index 2b082d0140..286b267de2 100644
--- a/libavcodec/dv.h
+++ b/libavcodec/dv.h
@@ -95,7 +95,7 @@  enum dv_pack_type {
  */
 #define DV_MAX_BPM 8
 
-int ff_dv_init_dynamic_tables(DVVideoContext *s, const AVDVProfile *d);
+int ff_dv_init_dynamic_tables(DVwork_chunk *work_chunks, const AVDVProfile *d);
 
 static inline int dv_work_pool_size(const AVDVProfile *d)
 {
diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index daee2347e6..1e2c097ed0 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -626,7 +626,7 @@  static int dvvideo_decode_frame(AVCodecContext *avctx, AVFrame *frame,
     }
 
     if (sys != s->sys) {
-        ret = ff_dv_init_dynamic_tables(s, sys);
+        ret = ff_dv_init_dynamic_tables(s->work_chunks, sys);
         if (ret < 0) {
             av_log(avctx, AV_LOG_ERROR, "Error initializing the work tables.\n");
             return ret;
diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c
index 8027feb9b3..712ca325de 100644
--- a/libavcodec/dvenc.c
+++ b/libavcodec/dvenc.c
@@ -67,7 +67,7 @@  static av_cold int dvvideo_encode_init(AVCodecContext *avctx)
         return AVERROR(EINVAL);
     }
 
-    ret = ff_dv_init_dynamic_tables(s, s->sys);
+    ret = ff_dv_init_dynamic_tables(s->work_chunks, s->sys);
     if (ret < 0) {
         av_log(avctx, AV_LOG_ERROR, "Error initializing work tables.\n");
         return ret;