Merge commit '48e139409556861c9e561ce34133891d8eecc3cf'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 29 Nov 2013 23:58:58 +0000 (00:58 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 30 Nov 2013 00:28:04 +0000 (01:28 +0100)
* commit '48e139409556861c9e561ce34133891d8eecc3cf':
  mpeg4videodec: move MpegEncContext.resync_marker into Mpeg4DecContext.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/mpeg4video.h
libavcodec/mpeg4videodec.c
libavcodec/mpegvideo.h
libavcodec/vaapi_mpeg4.c
libavcodec/vdpau.c
libavcodec/vdpau_internal.h
libavcodec/vdpau_mpeg4.c

index d06f54c..c3362e4 100644 (file)
@@ -68,6 +68,8 @@ typedef struct Mpeg4DecContext {
     int vol_sprite_usage;
     // reversible vlc
     int rvlc;
+    ///< could this stream contain resync markers
+    int resync_marker;
 } Mpeg4DecContext;
 
 /* dc encoding for mpeg4 */
index b7549fa..d5329ce 100644 (file)
@@ -109,12 +109,13 @@ void ff_mpeg4_pred_ac(MpegEncContext *s, int16_t *block, int n, int dir)
  * check if the next stuff is a resync marker or the end.
  * @return 0 if not
  */
-static inline int mpeg4_is_resync(MpegEncContext *s)
+static inline int mpeg4_is_resync(Mpeg4DecContext *ctx)
 {
+    MpegEncContext *s = &ctx->m;
     int bits_count = get_bits_count(&s->gb);
     int v          = show_bits(&s->gb, 16);
 
-    if (s->workaround_bugs & FF_BUG_NO_PADDING && !s->resync_marker)
+    if (s->workaround_bugs & FF_BUG_NO_PADDING && !ctx->resync_marker)
         return 0;
 
     while (v <= 0xFF) {
@@ -1268,12 +1269,12 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64])
 
     /* per-MB end of slice check */
     if (--s->mb_num_left <= 0) {
-        if (mpeg4_is_resync(s))
+        if (mpeg4_is_resync(ctx))
             return SLICE_END;
         else
             return SLICE_NOEND;
     } else {
-        if (mpeg4_is_resync(s)) {
+        if (mpeg4_is_resync(ctx)) {
             const int delta = s->mb_x + 1 == s->mb_width ? 2 : 1;
             if (s->cbp_table[xy + delta])
                 return SLICE_END;
@@ -1632,7 +1633,7 @@ intra:
 end:
     /* per-MB end of slice check */
     if (s->codec_id == AV_CODEC_ID_MPEG4) {
-        int next = mpeg4_is_resync(s);
+        int next = mpeg4_is_resync(ctx);
         if (next) {
             if        (s->mb_x + s->mb_y*s->mb_width + 1 >  next && (s->avctx->err_recognition & AV_EF_AGGRESSIVE)) {
                 return -1;
@@ -1968,7 +1969,7 @@ no_cplx_est:
             s->cplx_estimation_trash_b = 0;
         }
 
-        s->resync_marker = !get_bits1(gb); /* resync_marker_disabled */
+        ctx->resync_marker = !get_bits1(gb); /* resync_marker_disabled */
 
         s->data_partitioning = get_bits1(gb);
         if (s->data_partitioning)
@@ -2315,7 +2316,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
                    s->pict_type == AV_PICTURE_TYPE_I ? "I" : (s->pict_type == AV_PICTURE_TYPE_P ? "P" : (s->pict_type == AV_PICTURE_TYPE_B ? "B" : "S")),
                    gb->size_in_bits,s->progressive_sequence, s->alternate_scan,
                    s->top_field_first, s->quarter_sample ? "q" : "h",
-                   s->data_partitioning, s->resync_marker,
+                   s->data_partitioning, ctx->resync_marker,
                    s->num_sprite_warping_points, s->sprite_warping_accuracy,
                    1 - s->no_rounding, s->vo_type,
                    s->vol_control_parameters ? " VOLC" : " ", s->intra_dc_threshold,
index 468c82d..c0c675f 100644 (file)
@@ -615,7 +615,6 @@ typedef struct MpegEncContext {
     int low_latency_sprite;
     int data_partitioning;           ///< data partitioning flag from header
     int partitioned_frame;           ///< is current frame partitioned
-    int resync_marker;               ///< could this stream contain resync markers
     int low_delay;                   ///< no reordering needed / has no b-frames
     int vo_type;
     int vol_control_parameters;      ///< does the stream contain the low_delay flag, used to workaround buggy encoders
index d545966..2fdb10f 100644 (file)
@@ -72,7 +72,7 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_
     pic_param->vol_fields.bits.quarter_sample           = s->quarter_sample;
     pic_param->vol_fields.bits.data_partitioned         = s->data_partitioning;
     pic_param->vol_fields.bits.reversible_vlc           = ctx->rvlc;
-    pic_param->vol_fields.bits.resync_marker_disable    = !s->resync_marker;
+    pic_param->vol_fields.bits.resync_marker_disable    = !ctx->resync_marker;
     pic_param->no_of_sprite_warping_points              = s->num_sprite_warping_points;
     for (i = 0; i < s->num_sprite_warping_points && i < 3; i++) {
         pic_param->sprite_trajectory_du[i]              = s->sprite_traj[i][0];
index 0eebb9c..32a3843 100644 (file)
@@ -345,7 +345,7 @@ void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf,
     render->info.vc1.range_mapuv        = v->range_mapuv;
     /* Specific to simple/main profile only */
     render->info.vc1.multires           = v->multires;
-    render->info.vc1.syncmarker         = v->s.resync_marker;
+    render->info.vc1.syncmarker         = v->resync_marker;
     render->info.vc1.rangered           = v->rangered | (v->rangeredfrm << 1);
     render->info.vc1.maxbframes         = v->s.max_b_frames;
 
@@ -383,9 +383,10 @@ void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf,
 #endif /* (CONFIG_VC1_VDPAU_DECODER */
 
 #if CONFIG_MPEG4_VDPAU_DECODER
-void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf,
+void ff_vdpau_mpeg4_decode_picture(Mpeg4DecContext *ctx, const uint8_t *buf,
                                    int buf_size)
 {
+    MpegEncContext *s = &ctx->m;
     struct vdpau_render_state *render, *last, *next;
     int i;
 
@@ -403,7 +404,7 @@ void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf,
     render->info.mpeg4.vop_coding_type                   = 0;
     render->info.mpeg4.vop_fcode_forward                 = s->f_code;
     render->info.mpeg4.vop_fcode_backward                = s->b_code;
-    render->info.mpeg4.resync_marker_disable             = !s->resync_marker;
+    render->info.mpeg4.resync_marker_disable             = !ctx->resync_marker;
     render->info.mpeg4.interlaced                        = !s->progressive_sequence;
     render->info.mpeg4.quant_type                        = s->mpeg_quant;
     render->info.mpeg4.quarter_sample                    = s->quarter_sample;
index 3296996..cc63411 100644 (file)
@@ -32,6 +32,7 @@
 #include "h264.h"
 
 #include "avcodec.h"
+#include "mpeg4video.h"
 #include "mpegvideo.h"
 #include "version.h"
 
@@ -95,7 +96,7 @@ void ff_vdpau_h264_picture_complete(H264Context *h);
 void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf,
                                  int buf_size);
 
-void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf,
+void ff_vdpau_mpeg4_decode_picture(Mpeg4DecContext *s, const uint8_t *buf,
                                    int buf_size);
 
 #endif /* AVCODEC_VDPAU_INTERNAL_H */
index 84683a4..282796e 100644 (file)
 #include <vdpau/vdpau.h>
 
 #include "avcodec.h"
+#include "mpeg4video.h"
 #include "vdpau.h"
 #include "vdpau_internal.h"
 
 static int vdpau_mpeg4_start_frame(AVCodecContext *avctx,
                                    const uint8_t *buffer, uint32_t size)
 {
-    MpegEncContext * const s = avctx->priv_data;
+    Mpeg4DecContext *ctx = avctx->priv_data;
+    MpegEncContext * const s = &ctx->m;
     Picture *pic             = s->current_picture_ptr;
     struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private;
     VdpPictureInfoMPEG4Part2 *info = &pic_ctx->info.mpeg4;
@@ -62,7 +64,7 @@ static int vdpau_mpeg4_start_frame(AVCodecContext *avctx,
     info->vop_time_increment_resolution     = s->avctx->time_base.den;
     info->vop_fcode_forward                 = s->f_code;
     info->vop_fcode_backward                = s->b_code;
-    info->resync_marker_disable             = !s->resync_marker;
+    info->resync_marker_disable             = !ctx->resync_marker;
     info->interlaced                        = !s->progressive_sequence;
     info->quant_type                        = s->mpeg_quant;
     info->quarter_sample                    = s->quarter_sample;