On Mon, 27 Feb 2012 22:18:03 +0100, Diego Biurrun <[email protected]> wrote:
> ---
>  libavcodec/cavsdec.c          |   10 ++++----
>  libavcodec/error_resilience.c |    6 ++--
>  libavcodec/h264.c             |   35 +++++++++++++++++++++++----------
>  libavcodec/h264_direct.c      |    4 ++-
>  libavcodec/ljpegenc.c         |    2 +-
>  libavcodec/mpeg4videodec.c    |    7 +++--
>  libavcodec/mpegvideo.c        |   42 ++++++++++++++++++++--------------------
>  libavcodec/mpegvideo_enc.c    |   12 +++++-----
>  8 files changed, 67 insertions(+), 51 deletions(-)
> 
> diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c
> index 12564e8..f59c73a 100644
> --- a/libavcodec/cavsdec.c
> +++ b/libavcodec/cavsdec.c
> @@ -500,9 +500,9 @@ static int decode_pic(AVSContext *h) {
>      }
>      /* release last B frame */
>      if(h->picture.f.data[0])
> -        s->avctx->release_buffer(s->avctx, (AVFrame *)&h->picture);
> +        s->avctx->release_buffer(s->avctx, &h->picture.f);
>  
> -    s->avctx->get_buffer(s->avctx, (AVFrame *)&h->picture);
> +    s->avctx->get_buffer(s->avctx, &h->picture.f);
>      ff_cavs_init_pic(h);
>      h->picture.poc = get_bits(&s->gb,8)*2;
>  
> @@ -591,7 +591,7 @@ static int decode_pic(AVSContext *h) {
>      }
>      if(h->pic_type != AV_PICTURE_TYPE_B) {
>          if(h->DPB[1].f.data[0])
> -            s->avctx->release_buffer(s->avctx, (AVFrame *)&h->DPB[1]);
> +            s->avctx->release_buffer(s->avctx, &h->DPB[1].f);
>          h->DPB[1] = h->DPB[0];
>          h->DPB[0] = h->picture;
>          memset(&h->picture,0,sizeof(Picture));
> @@ -675,9 +675,9 @@ static int cavs_decode_frame(AVCodecContext * avctx,void 
> *data, int *data_size,
>          case PIC_I_START_CODE:
>              if(!h->got_keyframe) {
>                  if(h->DPB[0].f.data[0])
> -                    avctx->release_buffer(avctx, (AVFrame *)&h->DPB[0]);
> +                    avctx->release_buffer(avctx, &h->DPB[0].f);
>                  if(h->DPB[1].f.data[0])
> -                    avctx->release_buffer(avctx, (AVFrame *)&h->DPB[1]);
> +                    avctx->release_buffer(avctx, &h->DPB[1].f);
>                  h->got_keyframe = 1;
>              }
>          case PIC_PB_START_CODE:
> diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
> index e28cc35..0fab8be 100644
> --- a/libavcodec/error_resilience.c
> +++ b/libavcodec/error_resilience.c
> @@ -592,7 +592,7 @@ skip_mean_and_median:
>                          if (s->avctx->codec_id == CODEC_ID_H264) {
>                              // FIXME
>                          } else {
> -                            ff_thread_await_progress((AVFrame *) 
> s->last_picture_ptr,
> +                            ff_thread_await_progress(&s->last_picture_ptr->f,
>                                                       mb_y, 0);
>                          }
>                          if (!s->last_picture.f.motion_val[0] ||
> @@ -763,7 +763,7 @@ static int is_intra_more_likely(MpegEncContext *s)
>                  if (s->avctx->codec_id == CODEC_ID_H264) {
>                      // FIXME
>                  } else {
> -                    ff_thread_await_progress((AVFrame *) s->last_picture_ptr,
> +                    ff_thread_await_progress(&s->last_picture_ptr->f,
>                                               mb_y, 0);
>                  }
>                  is_intra_likely += s->dsp.sad[0](NULL, last_mb_ptr, mb_ptr,
> @@ -1144,7 +1144,7 @@ void ff_er_frame_end(MpegEncContext *s)
>                      if (s->avctx->codec_id == CODEC_ID_H264) {
>                          // FIXME
>                      } else {
> -                        ff_thread_await_progress((AVFrame *) 
> s->next_picture_ptr, mb_y, 0);
> +                        ff_thread_await_progress(&s->next_picture_ptr->f, 
> mb_y, 0);
>                      }
>                      s->mv[0][0][0] = s->next_picture.f.motion_val[0][xy][0] 
> *  time_pb            / time_pp;
>                      s->mv[0][0][1] = s->next_picture.f.motion_val[0][xy][1] 
> *  time_pb            / time_pp;
> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
> index 6eb2456..a882c35 100644
> --- a/libavcodec/h264.c
> +++ b/libavcodec/h264.c
> @@ -361,14 +361,26 @@ static void await_references(H264Context *h){
>                  nrefs[list]--;
>  
>                  if(!FIELD_PICTURE && ref_field_picture){ // frame 
> referencing two fields
> -                    ff_thread_await_progress((AVFrame*)ref_pic, FFMIN((row 
> >> 1) - !(row&1), pic_height-1), 1);
> -                    ff_thread_await_progress((AVFrame*)ref_pic, FFMIN((row 
> >> 1)           , pic_height-1), 0);
> +                    ff_thread_await_progress(&ref_pic->f,
> +                                             FFMIN((row >> 1) - !(row & 1),
> +                                                   pic_height - 1),
> +                                             1);
> +                    ff_thread_await_progress(&ref_pic->f,
> +                                             FFMIN((row >> 1), pic_height - 
> 1),
> +                                             0);
>                  }else if(FIELD_PICTURE && !ref_field_picture){ // field 
> referencing one field of a frame
> -                    ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row*2 
> + ref_field    , pic_height-1), 0);
> +                    ff_thread_await_progress(&ref_pic->f,
> +                                             FFMIN(row * 2 + ref_field,
> +                                                   pic_height - 1),
> +                                             0);
>                  }else if(FIELD_PICTURE){
> -                    ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row, 
> pic_height-1), ref_field);
> +                    ff_thread_await_progress(&ref_pic->f,
> +                                             FFMIN(row, pic_height - 1),
> +                                             ref_field);
>                  }else{
> -                    ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row, 
> pic_height-1), 0);
> +                    ff_thread_await_progress(&ref_pic->f,
> +                                             FFMIN(row, pic_height - 1),
> +                                             0);

IMO this looks much more readable without splitting the lines.

>                  }
>              }
>          }
> @@ -2522,8 +2534,9 @@ static int field_end(H264Context *h, int in_setup){
>      s->mb_y= 0;
>  
>      if (!in_setup && !s->dropable)
> -        ff_thread_report_progress((AVFrame*)s->current_picture_ptr, 
> (16*s->mb_height >> FIELD_PICTURE) - 1,
> -                                 s->picture_structure==PICT_BOTTOM_FIELD);
> +        ff_thread_report_progress(&s->current_picture_ptr->f,
> +                                  (16 * s->mb_height >> FIELD_PICTURE) - 1,
> +                                  s->picture_structure == PICT_BOTTOM_FIELD);
>  
>      if (CONFIG_H264_VDPAU_DECODER && 
> s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
>          ff_vdpau_h264_set_reference_frames(s);
> @@ -2888,8 +2901,8 @@ static int decode_slice_header(H264Context *h, 
> H264Context *h0){
>              h->prev_frame_num++;
>              h->prev_frame_num %= 1<<h->sps.log2_max_frame_num;
>              s->current_picture_ptr->frame_num= h->prev_frame_num;
> -            ff_thread_report_progress((AVFrame*)s->current_picture_ptr, 
> INT_MAX, 0);
> -            ff_thread_report_progress((AVFrame*)s->current_picture_ptr, 
> INT_MAX, 1);
> +            ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 
> 0);
> +            ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 
> 1);
>              ff_generate_sliding_window_mmcos(h);
>              if (ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index) < 
> 0 &&
>                  (s->avctx->err_recognition & AV_EF_EXPLODE))
> @@ -3552,8 +3565,8 @@ static void decode_finish_row(H264Context *h){
>  
>      if (s->dropable) return;
>  
> -    ff_thread_report_progress((AVFrame*)s->current_picture_ptr, top + height 
> - 1,
> -                             s->picture_structure==PICT_BOTTOM_FIELD);
> +    ff_thread_report_progress(&s->current_picture_ptr->f, top + height - 1,
> +                              s->picture_structure == PICT_BOTTOM_FIELD);
>  }
>  
>  static int decode_slice(struct AVCodecContext *avctx, void *arg){
> diff --git a/libavcodec/h264_direct.c b/libavcodec/h264_direct.c
> index a953728..d72c67b 100644
> --- a/libavcodec/h264_direct.c
> +++ b/libavcodec/h264_direct.c
> @@ -153,7 +153,9 @@ static void await_reference_mb_row(H264Context * const h, 
> Picture *ref, int mb_y
>      //FIXME it can be safe to access mb stuff
>      //even if pixels aren't deblocked yet
>  
> -    ff_thread_await_progress((AVFrame*)ref, FFMIN(16*mb_y >> 
> ref_field_picture, ref_height-1),
> +    ff_thread_await_progress(&ref->f,
> +                             FFMIN(16 * mb_y >> ref_field_picture,
> +                                   ref_height - 1),
>                               ref_field_picture && ref_field);

Same here.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to