diff mbox

[FFmpeg-devel,1/2] avcodec: remove unnecessary calls to ff_init_buffer_info()

Message ID 20180214001801.6546-1-jamrial@gmail.com
State Accepted
Headers show

Commit Message

James Almer Feb. 14, 2018, 12:18 a.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
Tested with FATE using one and four threads, frame and slice.

 libavcodec/decode.c        | 2 --
 libavcodec/pthread_frame.c | 2 --
 libavcodec/smvjpegdec.c    | 1 -
 3 files changed, 5 deletions(-)

Comments

wm4 Feb. 14, 2018, 5:15 a.m. UTC | #1
On Tue, 13 Feb 2018 21:18:00 -0300
James Almer <jamrial@gmail.com> wrote:

> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> Tested with FATE using one and four threads, frame and slice.
> 
>  libavcodec/decode.c        | 2 --
>  libavcodec/pthread_frame.c | 2 --
>  libavcodec/smvjpegdec.c    | 1 -
>  3 files changed, 5 deletions(-)
> 
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index 522720c07a..56be9f6064 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -1916,8 +1916,6 @@ static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame)
>          av_frame_unref(frame);
>      }
>  
> -    ff_init_buffer_info(avctx, frame);
> -
>      if (!frame->data[0])
>          return ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);
>  
> diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
> index 25aa3e2cd2..5104b1beba 100644
> --- a/libavcodec/pthread_frame.c
> +++ b/libavcodec/pthread_frame.c
> @@ -886,8 +886,6 @@ static int thread_get_buffer_internal(AVCodecContext *avctx, ThreadFrame *f, int
>  
>      f->owner[0] = f->owner[1] = avctx;
>  
> -    ff_init_buffer_info(avctx, f->f);
> -
>      if (!(avctx->active_thread_type & FF_THREAD_FRAME))
>          return ff_get_buffer(avctx, f->f, flags);
>  
> diff --git a/libavcodec/smvjpegdec.c b/libavcodec/smvjpegdec.c
> index 018e135b30..0b05d19f7b 100644
> --- a/libavcodec/smvjpegdec.c
> +++ b/libavcodec/smvjpegdec.c
> @@ -193,7 +193,6 @@ static int smvjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_siz
>          s->picture[1]->width         = avctx->width;
>          s->picture[1]->height        = avctx->height;
>          s->picture[1]->format        = avctx->pix_fmt;
> -        /* ff_init_buffer_info(avctx, &s->picture[1]); */
>          smv_img_pnt(s->picture[1]->data, mjpeg_data->data, mjpeg_data->linesize,
>                      avctx->pix_fmt, avctx->width, avctx->height, cur_frame);
>          for (i = 0; i < AV_NUM_DATA_POINTERS; i++)

Seems like these calls are indeed redundant (and one was commented).
So both patches LGTM. Maybe it'd actually be helpful to squash the two
commits, but no strong opinion.
James Almer Feb. 15, 2018, 12:02 a.m. UTC | #2
On 2/14/2018 2:15 AM, wm4 wrote:
> On Tue, 13 Feb 2018 21:18:00 -0300
> James Almer <jamrial@gmail.com> wrote:
> 
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>> Tested with FATE using one and four threads, frame and slice.
>>
>>  libavcodec/decode.c        | 2 --
>>  libavcodec/pthread_frame.c | 2 --
>>  libavcodec/smvjpegdec.c    | 1 -
>>  3 files changed, 5 deletions(-)
>>
>> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
>> index 522720c07a..56be9f6064 100644
>> --- a/libavcodec/decode.c
>> +++ b/libavcodec/decode.c
>> @@ -1916,8 +1916,6 @@ static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame)
>>          av_frame_unref(frame);
>>      }
>>  
>> -    ff_init_buffer_info(avctx, frame);
>> -
>>      if (!frame->data[0])
>>          return ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);
>>  
>> diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
>> index 25aa3e2cd2..5104b1beba 100644
>> --- a/libavcodec/pthread_frame.c
>> +++ b/libavcodec/pthread_frame.c
>> @@ -886,8 +886,6 @@ static int thread_get_buffer_internal(AVCodecContext *avctx, ThreadFrame *f, int
>>  
>>      f->owner[0] = f->owner[1] = avctx;
>>  
>> -    ff_init_buffer_info(avctx, f->f);
>> -
>>      if (!(avctx->active_thread_type & FF_THREAD_FRAME))
>>          return ff_get_buffer(avctx, f->f, flags);
>>  
>> diff --git a/libavcodec/smvjpegdec.c b/libavcodec/smvjpegdec.c
>> index 018e135b30..0b05d19f7b 100644
>> --- a/libavcodec/smvjpegdec.c
>> +++ b/libavcodec/smvjpegdec.c
>> @@ -193,7 +193,6 @@ static int smvjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_siz
>>          s->picture[1]->width         = avctx->width;
>>          s->picture[1]->height        = avctx->height;
>>          s->picture[1]->format        = avctx->pix_fmt;
>> -        /* ff_init_buffer_info(avctx, &s->picture[1]); */
>>          smv_img_pnt(s->picture[1]->data, mjpeg_data->data, mjpeg_data->linesize,
>>                      avctx->pix_fmt, avctx->width, avctx->height, cur_frame);
>>          for (i = 0; i < AV_NUM_DATA_POINTERS; i++)
> 
> Seems like these calls are indeed redundant (and one was commented).
> So both patches LGTM. Maybe it'd actually be helpful to squash the two
> commits, but no strong opinion.	

Squashed and pushed. Thanks.
diff mbox

Patch

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 522720c07a..56be9f6064 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1916,8 +1916,6 @@  static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame)
         av_frame_unref(frame);
     }
 
-    ff_init_buffer_info(avctx, frame);
-
     if (!frame->data[0])
         return ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);
 
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 25aa3e2cd2..5104b1beba 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -886,8 +886,6 @@  static int thread_get_buffer_internal(AVCodecContext *avctx, ThreadFrame *f, int
 
     f->owner[0] = f->owner[1] = avctx;
 
-    ff_init_buffer_info(avctx, f->f);
-
     if (!(avctx->active_thread_type & FF_THREAD_FRAME))
         return ff_get_buffer(avctx, f->f, flags);
 
diff --git a/libavcodec/smvjpegdec.c b/libavcodec/smvjpegdec.c
index 018e135b30..0b05d19f7b 100644
--- a/libavcodec/smvjpegdec.c
+++ b/libavcodec/smvjpegdec.c
@@ -193,7 +193,6 @@  static int smvjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_siz
         s->picture[1]->width         = avctx->width;
         s->picture[1]->height        = avctx->height;
         s->picture[1]->format        = avctx->pix_fmt;
-        /* ff_init_buffer_info(avctx, &s->picture[1]); */
         smv_img_pnt(s->picture[1]->data, mjpeg_data->data, mjpeg_data->linesize,
                     avctx->pix_fmt, avctx->width, avctx->height, cur_frame);
         for (i = 0; i < AV_NUM_DATA_POINTERS; i++)