diff mbox series

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

Message ID 20220824084318.333-7-anton@khirnov.net
State Accepted
Commit 69bad628ec37dc75813ae015df7ce4022d002d9a
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
Pass the two variables needed from it directly.

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

Comments

Andreas Rheinhardt Aug. 24, 2022, 12:57 p.m. UTC | #1
Anton Khirnov:
> Pass the two variables needed from it directly.
> 
> This is done in preparation to splitting DVVideoContext.
> ---
>  libavcodec/dv.h    | 5 +++--
>  libavcodec/dvdec.c | 2 +-
>  libavcodec/dvenc.c | 2 +-
>  3 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/dv.h b/libavcodec/dv.h
> index 286b267de2..6430688795 100644
> --- a/libavcodec/dv.h
> +++ b/libavcodec/dv.h
> @@ -107,7 +107,8 @@ static inline int dv_work_pool_size(const AVDVProfile *d)
>      return size;
>  }
>  
> -static inline void dv_calculate_mb_xy(const DVVideoContext *s,
> +static inline void dv_calculate_mb_xy(const AVDVProfile *sys,
> +                                      const uint8_t *buf,
>                                        const DVwork_chunk *work_chunk,
>                                        int m, int *mb_x, int *mb_y)
>  {
> @@ -116,7 +117,7 @@ static inline void dv_calculate_mb_xy(const DVVideoContext *s,
>  
>      /* We work with 720p frames split in half.
>       * The odd half-frame (chan == 2,3) is displaced :-( */
> -    if (s->sys->height == 720 && !(s->buf[1] & 0x0C))
> +    if (sys->height == 720 && !(buf[1] & 0x0C))
>          /* shifting the Y coordinate down by 72/2 macro blocks */
>          *mb_y -= (*mb_y > 17) ? 18 : -72;
>  }
> diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
> index 1e2c097ed0..7f9e4eb0c0 100644
> --- a/libavcodec/dvdec.c
> +++ b/libavcodec/dvdec.c
> @@ -535,7 +535,7 @@ retry:
>      block = &sblock[0][0];
>      mb    = mb_data;
>      for (mb_index = 0; mb_index < 5; mb_index++) {
> -        dv_calculate_mb_xy(s, work_chunk, mb_index, &mb_x, &mb_y);
> +        dv_calculate_mb_xy(s->sys, s->buf, work_chunk, mb_index, &mb_x, &mb_y);
>  
>          /* idct_put'ting luminance */
>          if ((s->sys->pix_fmt == AV_PIX_FMT_YUV420P)                      ||
> diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c
> index 712ca325de..c12fce9e8b 100644
> --- a/libavcodec/dvenc.c
> +++ b/libavcodec/dvenc.c
> @@ -866,7 +866,7 @@ static int dv_encode_video_segment(AVCodecContext *avctx, void *arg)
>      p = dif = &s->buf[work_chunk->buf_offset * 80];
>      enc_blk = &enc_blks[0];
>      for (mb_index = 0; mb_index < 5; mb_index++) {
> -        dv_calculate_mb_xy(s, work_chunk, mb_index, &mb_x, &mb_y);
> +        dv_calculate_mb_xy(s->sys, s->buf, work_chunk, mb_index, &mb_x, &mb_y);
>  
>          qnos[mb_index] = DV_PROFILE_IS_HD(s->sys) ? 1 : 15;
>  

LGTM.

- Andreas
diff mbox series

Patch

diff --git a/libavcodec/dv.h b/libavcodec/dv.h
index 286b267de2..6430688795 100644
--- a/libavcodec/dv.h
+++ b/libavcodec/dv.h
@@ -107,7 +107,8 @@  static inline int dv_work_pool_size(const AVDVProfile *d)
     return size;
 }
 
-static inline void dv_calculate_mb_xy(const DVVideoContext *s,
+static inline void dv_calculate_mb_xy(const AVDVProfile *sys,
+                                      const uint8_t *buf,
                                       const DVwork_chunk *work_chunk,
                                       int m, int *mb_x, int *mb_y)
 {
@@ -116,7 +117,7 @@  static inline void dv_calculate_mb_xy(const DVVideoContext *s,
 
     /* We work with 720p frames split in half.
      * The odd half-frame (chan == 2,3) is displaced :-( */
-    if (s->sys->height == 720 && !(s->buf[1] & 0x0C))
+    if (sys->height == 720 && !(buf[1] & 0x0C))
         /* shifting the Y coordinate down by 72/2 macro blocks */
         *mb_y -= (*mb_y > 17) ? 18 : -72;
 }
diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index 1e2c097ed0..7f9e4eb0c0 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -535,7 +535,7 @@  retry:
     block = &sblock[0][0];
     mb    = mb_data;
     for (mb_index = 0; mb_index < 5; mb_index++) {
-        dv_calculate_mb_xy(s, work_chunk, mb_index, &mb_x, &mb_y);
+        dv_calculate_mb_xy(s->sys, s->buf, work_chunk, mb_index, &mb_x, &mb_y);
 
         /* idct_put'ting luminance */
         if ((s->sys->pix_fmt == AV_PIX_FMT_YUV420P)                      ||
diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c
index 712ca325de..c12fce9e8b 100644
--- a/libavcodec/dvenc.c
+++ b/libavcodec/dvenc.c
@@ -866,7 +866,7 @@  static int dv_encode_video_segment(AVCodecContext *avctx, void *arg)
     p = dif = &s->buf[work_chunk->buf_offset * 80];
     enc_blk = &enc_blks[0];
     for (mb_index = 0; mb_index < 5; mb_index++) {
-        dv_calculate_mb_xy(s, work_chunk, mb_index, &mb_x, &mb_y);
+        dv_calculate_mb_xy(s->sys, s->buf, work_chunk, mb_index, &mb_x, &mb_y);
 
         qnos[mb_index] = DV_PROFILE_IS_HD(s->sys) ? 1 : 15;