[FFmpeg-devel] [PATCH] h264: fix poc values after reset mmco (broken by adedd840e)

Michael Niedermayer michaelni at gmx.at
Sat Sep 8 01:10:32 CEST 2012


On Fri, Sep 07, 2012 at 04:16:04PM -0400, Jeff Downs wrote:
> Move current picture mmco_reset flagging from mmco execute to mmco decode
> so it is available when used for output picture selection.
> Removes mmco_reset state variable used to mark pics as it isn't needed
> with above.
> Restore (and enhance) code removed by above commit in mmco reset execution
> which resets cur pic's poc and field pocs (spec 8.2.1 paragraph 5),
> poc_msb and poc_lsb (8.2.1.1), and prev_frame_num_offset (8.2.1.2 and 8.2.1.3)
> Files cited in above commit (fate-h264-conformance-{mr2_tandberg_e,mr3_tandberg_b})
> still work properly.
> ---
>  libavcodec/h264.c      |    5 ++---
>  libavcodec/h264.h      |    1 -
>  libavcodec/h264_refs.c |   10 ++++++++--
>  3 files changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
> index 713fda7..99ef286 100644
> --- a/libavcodec/h264.c
> +++ b/libavcodec/h264.c
[...]
> @@ -1505,8 +1503,9 @@ static void decode_postinit(H264Context *h, int setup_finished)
>              h->delayed_pic[i] = h->delayed_pic[i + 1];
>      }
>      if (!out_of_order && pics > s->avctx->has_b_frames) {
> +        Picture *pic = h->delayed_pic[0] ? h->delayed_pic[0] : out;
>          h->next_output_pic = out;
> -        if (out_idx == 0 && h->delayed_pic[0] && (h->delayed_pic[0]->f.key_frame || h->delayed_pic[0]->mmco_reset)) {
> +        if (out_idx == 0 && (pic->f.key_frame || pic->mmco_reset)) {
>              h->next_outputed_poc = INT_MIN;
>          } else
>              h->next_outputed_poc = out->poc;

this hunk looks ok and can be applied seperately if you
submit it in a seperate patch


[...]
> @@ -690,6 +694,8 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb){
>                          return -1;
>                      }*/
>                  }
> +                if (opcode == MMCO_RESET)
> +                    s->current_picture_ptr->mmco_reset = 1;
>                  if(opcode==MMCO_SHORT2LONG || opcode==MMCO_LONG2UNUSED || opcode==MMCO_LONG || opcode==MMCO_SET_MAX_LONG){
>                      unsigned int long_arg= get_ue_golomb_31(gb);
>                      if(long_arg >= 32 || (long_arg >= 16 && !(opcode == MMCO_SET_MAX_LONG && long_arg == 16) && !(opcode == MMCO_LONG2UNUSED && FIELD_PICTURE))){
> -- 

If iam not missing something then this can cause a race in case of
frame multithreading

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Observe your enemies, for they first find out your faults. -- Antisthenes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120908/87282dc4/attachment.asc>


More information about the ffmpeg-devel mailing list