OSDN Git Service

Merge commit 'ee8af2dd99dcb7a01a667deedec81d1aa2a00d72'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 29 Nov 2013 21:35:52 +0000 (22:35 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 29 Nov 2013 21:35:52 +0000 (22:35 +0100)
* commit 'ee8af2dd99dcb7a01a667deedec81d1aa2a00d72':
  mpeg4videodec: move MpegEncContext.shape to Mpeg4DecContext

Conflicts:
libavcodec/h263dec.c
libavcodec/mpeg4videodec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/h263dec.c
libavcodec/ituh263dec.c
libavcodec/mpeg4video.h
libavcodec/mpeg4video_parser.c
libavcodec/mpeg4videodec.c
libavcodec/mpegvideo.c
libavcodec/mpegvideo.h

@@@ -463,10 -438,13 +463,10 @@@ retry
          if (s->avctx->extradata_size && s->picture_number == 0) {
              GetBitContext gb;
  
 -            ret = init_get_bits8(&gb, s->avctx->extradata,
 -                                 s->avctx->extradata_size);
 -            if (ret < 0)
 -                return ret;
 -            ff_mpeg4_decode_picture_header(avctx->priv_data, &gb);
 +            if (init_get_bits8(&gb, s->avctx->extradata, s->avctx->extradata_size) >= 0 )
-                 ff_mpeg4_decode_picture_header(s, &gb);
++                ff_mpeg4_decode_picture_header(avctx->priv_data, &gb);
          }
-         ret = ff_mpeg4_decode_picture_header(s, &s->gb);
+         ret = ff_mpeg4_decode_picture_header(avctx->priv_data, &s->gb);
      } else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) {
          ret = ff_intel_h263_decode_picture_header(s);
      } else if (CONFIG_FLV_DECODER && s->h263_flv) {
Simple merge
@@@ -107,9 -109,8 +109,9 @@@ void ff_mpeg4_merge_partitions(MpegEncC
  void ff_clean_mpeg4_qscales(MpegEncContext *s);
  int ff_mpeg4_decode_partitions(MpegEncContext *s);
  int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s);
- int ff_mpeg4_decode_video_packet_header(MpegEncContext *s);
+ int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx);
  void ff_mpeg4_init_direct_mv(MpegEncContext *s);
 +void ff_mpeg4videodec_static_init(void);
  
  /**
   *
Simple merge
@@@ -1763,13 -1732,13 +1766,13 @@@ static int decode_vol_header(Mpeg4DecCo
  
      s->t_frame = 0;
  
-     if (s->shape != BIN_ONLY_SHAPE) {
-         if (s->shape == RECT_SHAPE) {
+     if (ctx->shape != BIN_ONLY_SHAPE) {
+         if (ctx->shape == RECT_SHAPE) {
 -            skip_bits1(gb);   /* marker */
 +            check_marker(gb, "before width");
              width = get_bits(gb, 13);
 -            skip_bits1(gb);   /* marker */
 +            check_marker(gb, "before height");
              height = get_bits(gb, 13);
 -            skip_bits1(gb);   /* marker */
 +            check_marker(gb, "after height");
              if (width && height &&  /* they should be non zero but who knows */
                  !(s->width && s->codec_tag == AV_RL32("MP4S"))) {
                  if (s->width && s->height &&
@@@ -2087,10 -2041,10 +2090,11 @@@ static int decode_user_data(MpegEncCont
      return 0;
  }
  
- static int decode_vop_header(MpegEncContext *s, GetBitContext *gb)
+ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
  {
+     MpegEncContext *s = &ctx->m;
      int time_incr, time_increment;
 +    int64_t pts;
  
      s->pict_type = get_bits(gb, 2) + AV_PICTURE_TYPE_I;        /* pict type: I = 0 , P = 1 */
      if (s->pict_type == AV_PICTURE_TYPE_B && s->low_delay &&
              av_log(s->avctx, AV_LOG_ERROR, "vop not coded\n");
          return FRAME_SKIPPED;
      }
-     if (s->shape != BIN_ONLY_SHAPE &&
 +    if (s->new_pred)
 +        decode_new_pred(s, gb);
 +
+     if (ctx->shape != BIN_ONLY_SHAPE &&
                      (s->pict_type == AV_PICTURE_TYPE_P ||
                       (s->pict_type == AV_PICTURE_TYPE_S &&
                        s->vol_sprite_usage == GMC_SPRITE))) {
          s->low_delay = 1;
      s->avctx->has_b_frames = !s->low_delay;
  
-     return decode_vop_header(s, gb);
+     return decode_vop_header(ctx, gb);
  }
  
 +av_cold void ff_mpeg4videodec_static_init(void) {
 +    static int done = 0;
 +
 +    if (!done) {
 +        ff_init_rl(&ff_mpeg4_rl_intra, ff_mpeg4_static_rl_table_store[0]);
 +        ff_init_rl(&ff_rvlc_rl_inter, ff_mpeg4_static_rl_table_store[1]);
 +        ff_init_rl(&ff_rvlc_rl_intra, ff_mpeg4_static_rl_table_store[2]);
 +        INIT_VLC_RL(ff_mpeg4_rl_intra, 554);
 +        INIT_VLC_RL(ff_rvlc_rl_inter, 1072);
 +        INIT_VLC_RL(ff_rvlc_rl_intra, 1072);
 +        INIT_VLC_STATIC(&dc_lum, DC_VLC_BITS, 10 /* 13 */,
 +                        &ff_mpeg4_DCtab_lum[0][1], 2, 1,
 +                        &ff_mpeg4_DCtab_lum[0][0], 2, 1, 512);
 +        INIT_VLC_STATIC(&dc_chrom, DC_VLC_BITS, 10 /* 13 */,
 +                        &ff_mpeg4_DCtab_chrom[0][1], 2, 1,
 +                        &ff_mpeg4_DCtab_chrom[0][0], 2, 1, 512);
 +        INIT_VLC_STATIC(&sprite_trajectory, SPRITE_TRAJ_VLC_BITS, 15,
 +                        &ff_sprite_trajectory_tab[0][1], 4, 2,
 +                        &ff_sprite_trajectory_tab[0][0], 4, 2, 128);
 +        INIT_VLC_STATIC(&mb_type_b_vlc, MB_TYPE_B_VLC_BITS, 4,
 +                        &ff_mb_type_b_tab[0][1], 2, 1,
 +                        &ff_mb_type_b_tab[0][0], 2, 1, 16);
 +        done = 1;
 +    }
 +}
 +
  static int mpeg4_update_thread_context(AVCodecContext *dst,
                                         const AVCodecContext *src)
  {
Simple merge
Simple merge