diff mbox series

[FFmpeg-devel,2/2] avcodec/mpegvideo: cosmetics

Message ID 1589125170-32558-2-git-send-email-lance.lmwang@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,1/2] avcodec/mpegvideo: prefer to use variable instead of type for sizeof | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Lance Wang May 10, 2020, 3:39 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/mpegvideo.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

Comments

Michael Niedermayer May 11, 2020, 4:59 p.m. UTC | #1
On Sun, May 10, 2020 at 11:39:30PM +0800, lance.lmwang@gmail.com wrote:
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  libavcodec/mpegvideo.c | 27 ++++++++++++++++++---------
>  1 file changed, 18 insertions(+), 9 deletions(-)
> 
> diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
> index 561062f..b993813 100644
> --- a/libavcodec/mpegvideo.c
> +++ b/libavcodec/mpegvideo.c
> @@ -725,12 +725,18 @@ static int init_context_frame(MpegEncContext *s)
>  
>      if (s->encoding) {
>          /* Allocate MV tables */
> -        FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base,                 mv_table_size * 2 * sizeof(*s->p_mv_table_base), fail)
> -        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base,            mv_table_size * 2 * sizeof(*s->b_forw_mv_table_base), fail)
> -        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base,            mv_table_size * 2 * sizeof(*s->b_back_mv_table_base), fail)
> -        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base,      mv_table_size * 2 * sizeof(*s->b_bidir_forw_mv_table_base), fail)
> -        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base,      mv_table_size * 2 * sizeof(*s->b_bidir_back_mv_table_base), fail)
> -        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base,          mv_table_size * 2 * sizeof(*s->b_direct_mv_table_base), fail)
> +        FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base,
> +                          mv_table_size * 2 * sizeof(*s->p_mv_table_base), fail)
> +        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base,
> +                          mv_table_size * 2 * sizeof(*s->b_forw_mv_table_base), fail)
> +        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base,
> +                          mv_table_size * 2 * sizeof(*s->b_back_mv_table_base), fail)
> +        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base,
> +                          mv_table_size * 2 * sizeof(*s->b_bidir_forw_mv_table_base), fail)
> +        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base,
> +                          mv_table_size * 2 * sizeof(*s->b_bidir_back_mv_table_base), fail)
> +        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base,
> +                          mv_table_size * 2 * sizeof(*s->b_direct_mv_table_base), fail)
>          s->p_mv_table            = s->p_mv_table_base + s->mb_stride + 1;
>          s->b_forw_mv_table       = s->b_forw_mv_table_base + s->mb_stride + 1;
>          s->b_back_mv_table       = s->b_back_mv_table_base + s->mb_stride + 1;

I this this is more readable before the change


[...]
Lance Wang May 12, 2020, 12:13 a.m. UTC | #2
On Mon, May 11, 2020 at 06:59:15PM +0200, Michael Niedermayer wrote:
> On Sun, May 10, 2020 at 11:39:30PM +0800, lance.lmwang@gmail.com wrote:
> > From: Limin Wang <lance.lmwang@gmail.com>
> > 
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> >  libavcodec/mpegvideo.c | 27 ++++++++++++++++++---------
> >  1 file changed, 18 insertions(+), 9 deletions(-)
> > 
> > diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
> > index 561062f..b993813 100644
> > --- a/libavcodec/mpegvideo.c
> > +++ b/libavcodec/mpegvideo.c
> > @@ -725,12 +725,18 @@ static int init_context_frame(MpegEncContext *s)
> >  
> >      if (s->encoding) {
> >          /* Allocate MV tables */
> > -        FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base,                 mv_table_size * 2 * sizeof(*s->p_mv_table_base), fail)
> > -        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base,            mv_table_size * 2 * sizeof(*s->b_forw_mv_table_base), fail)
> > -        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base,            mv_table_size * 2 * sizeof(*s->b_back_mv_table_base), fail)
> > -        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base,      mv_table_size * 2 * sizeof(*s->b_bidir_forw_mv_table_base), fail)
> > -        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base,      mv_table_size * 2 * sizeof(*s->b_bidir_back_mv_table_base), fail)
> > -        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base,          mv_table_size * 2 * sizeof(*s->b_direct_mv_table_base), fail)
> > +        FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base,
> > +                          mv_table_size * 2 * sizeof(*s->p_mv_table_base), fail)
> > +        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base,
> > +                          mv_table_size * 2 * sizeof(*s->b_forw_mv_table_base), fail)
> > +        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base,
> > +                          mv_table_size * 2 * sizeof(*s->b_back_mv_table_base), fail)
> > +        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base,
> > +                          mv_table_size * 2 * sizeof(*s->b_bidir_forw_mv_table_base), fail)
> > +        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base,
> > +                          mv_table_size * 2 * sizeof(*s->b_bidir_back_mv_table_base), fail)
> > +        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base,
> > +                          mv_table_size * 2 * sizeof(*s->b_direct_mv_table_base), fail)
> >          s->p_mv_table            = s->p_mv_table_base + s->mb_stride + 1;
> >          s->b_forw_mv_table       = s->b_forw_mv_table_base + s->mb_stride + 1;
> >          s->b_back_mv_table       = s->b_back_mv_table_base + s->mb_stride + 1;
> 
> I this this is more readable before the change
the line is too long so I split two line. Now have updated with new macro, please
review whether it's OK for you. I'm not keep the patch with same thread for the title
different.

> 
> 
> [...]
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> While the State exists there can be no freedom; when there is freedom there
> will be no State. -- Vladimir Lenin



> _______________________________________________
> 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".
diff mbox series

Patch

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 561062f..b993813 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -725,12 +725,18 @@  static int init_context_frame(MpegEncContext *s)
 
     if (s->encoding) {
         /* Allocate MV tables */
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base,                 mv_table_size * 2 * sizeof(*s->p_mv_table_base), fail)
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base,            mv_table_size * 2 * sizeof(*s->b_forw_mv_table_base), fail)
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base,            mv_table_size * 2 * sizeof(*s->b_back_mv_table_base), fail)
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base,      mv_table_size * 2 * sizeof(*s->b_bidir_forw_mv_table_base), fail)
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base,      mv_table_size * 2 * sizeof(*s->b_bidir_back_mv_table_base), fail)
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base,          mv_table_size * 2 * sizeof(*s->b_direct_mv_table_base), fail)
+        FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base,
+                          mv_table_size * 2 * sizeof(*s->p_mv_table_base), fail)
+        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base,
+                          mv_table_size * 2 * sizeof(*s->b_forw_mv_table_base), fail)
+        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base,
+                          mv_table_size * 2 * sizeof(*s->b_back_mv_table_base), fail)
+        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base,
+                          mv_table_size * 2 * sizeof(*s->b_bidir_forw_mv_table_base), fail)
+        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base,
+                          mv_table_size * 2 * sizeof(*s->b_bidir_back_mv_table_base), fail)
+        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base,
+                          mv_table_size * 2 * sizeof(*s->b_direct_mv_table_base), fail)
         s->p_mv_table            = s->p_mv_table_base + s->mb_stride + 1;
         s->b_forw_mv_table       = s->b_forw_mv_table_base + s->mb_stride + 1;
         s->b_back_mv_table       = s->b_back_mv_table_base + s->mb_stride + 1;
@@ -764,11 +770,14 @@  static int init_context_frame(MpegEncContext *s)
                     s->b_field_mv_table[i][j][k] = s->b_field_mv_table_base[i][j][k] +
                                                    s->mb_stride + 1;
                 }
-                FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_select_table [i][j], mb_array_size * 2 * sizeof(*s->b_field_select_table [i][j]), fail)
-                FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_mv_table_base[i][j], mv_table_size * 2 * sizeof(*s->p_field_mv_table_base[i][j]), fail)
+                FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_select_table [i][j],
+                                  mb_array_size * 2 * sizeof(*s->b_field_select_table [i][j]), fail)
+                FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_mv_table_base[i][j],
+                                  mv_table_size * 2 * sizeof(*s->p_field_mv_table_base[i][j]), fail)
                 s->p_field_mv_table[i][j] = s->p_field_mv_table_base[i][j] + s->mb_stride + 1;
             }
-            FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_select_table[i], mb_array_size * 2 * sizeof(*s->p_field_select_table[i]), fail)
+            FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_select_table[i],
+                              mb_array_size * 2 * sizeof(*s->p_field_select_table[i]), fail)
         }
     }
     if (s->out_format == FMT_H263) {