[FFmpeg-cvslog] lavc: mark hurry_up for removal on next major bump

Anton Khirnov git at videolan.org
Sun Apr 3 02:35:24 CEST 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Apr  2 11:56:21 2011 +0200| [8ed2ae09a25e5860342b97f7c2c7729fffaec320] | committer: Anton Khirnov

lavc: mark hurry_up for removal on next major bump

It has been deprecated for about five years, skip_idct/skip_frame should
be used instead.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8ed2ae09a25e5860342b97f7c2c7729fffaec320
---

 libavcodec/avcodec.h   |    4 +++-
 libavcodec/h261dec.c   |    4 +++-
 libavcodec/h263dec.c   |    6 +++++-
 libavcodec/h264.c      |   22 ++++++++++++++++++----
 libavcodec/mpeg12.c    |    4 ++++
 libavcodec/mpegvideo.c |    4 ++++
 libavcodec/mpegvideo.h |    2 ++
 libavcodec/options.c   |    4 +++-
 libavcodec/pthread.c   |    2 ++
 libavcodec/rv34.c      |    4 ++++
 libavcodec/svq1dec.c   |    2 ++
 libavcodec/svq3.c      |    4 +++-
 libavcodec/vc1dec.c    |    6 +++++-
 libavcodec/version.h   |    3 +++
 14 files changed, 61 insertions(+), 10 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 4cd78a3..2122545 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1320,13 +1320,15 @@ typedef struct AVCodecContext {
 
     int b_frame_strategy;
 
+#if FF_API_HURRY_UP
     /**
      * hurry up amount
      * - encoding: unused
      * - decoding: Set by user. 1-> Skip B-frames, 2-> Skip IDCT/dequant too, 5-> Skip everything except header
      * @deprecated Deprecated in favor of skip_idct and skip_frame.
      */
-    int hurry_up;
+    attribute_deprecated int hurry_up;
+#endif
 
     struct AVCodec *codec;
 
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 9b4d4c2..93c5cb4 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -595,12 +595,14 @@ retry:
         goto retry;
     }
 
-    // for hurry_up==5
+    // for skipping the frame
     s->current_picture.pict_type= s->pict_type;
     s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
 
+#if FF_API_HURRY_UP
     /* skip everything if we are in a hurry>=5 */
     if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);
+#endif
     if(  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
        ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
        || avctx->skip_frame >= AVDISCARD_ALL)
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 699d842..86ad0ba 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -591,20 +591,24 @@ retry:
     if((s->codec_id==CODEC_ID_H263 || s->codec_id==CODEC_ID_H263P || s->codec_id == CODEC_ID_H263I))
         s->gob_index = ff_h263_get_gob_height(s);
 
-    // for hurry_up==5
+    // for skipping the frame
     s->current_picture.pict_type= s->pict_type;
     s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
 
     /* skip B-frames if we don't have reference frames */
     if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)) return get_consumed_bytes(s, buf_size);
+#if FF_API_HURRY_UP
     /* skip b frames if we are in a hurry */
     if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return get_consumed_bytes(s, buf_size);
+#endif
     if(   (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
        || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
        ||  avctx->skip_frame >= AVDISCARD_ALL)
         return get_consumed_bytes(s, buf_size);
+#if FF_API_HURRY_UP
     /* skip everything if we are in a hurry>=5 */
     if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);
+#endif
 
     if(s->next_p_frame_damaged){
         if(s->pict_type==FF_B_TYPE)
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 83ac103..dbf71a7 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2820,8 +2820,12 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
 
         buf_index += consumed;
 
-        if(  (s->hurry_up == 1 && h->nal_ref_idc  == 0) //FIXME do not discard SEI id
-           ||(avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc  == 0))
+        //FIXME do not discard SEI id
+        if(
+#if FF_API_HURRY_UP
+           (s->hurry_up == 1 && h->nal_ref_idc  == 0) ||
+#endif
+           (avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc  == 0))
             continue;
 
       again:
@@ -2852,7 +2856,10 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
             s->current_picture_ptr->key_frame |=
                     (hx->nal_unit_type == NAL_IDR_SLICE) ||
                     (h->sei_recovery_frame_cnt >= 0);
-            if(hx->redundant_pic_count==0 && hx->s.hurry_up < 5
+            if(hx->redundant_pic_count==0
+#if FF_API_HURRY_UP
+               && hx->s.hurry_up < 5
+#endif
                && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
                && (avctx->skip_frame < AVDISCARD_BIDIR  || hx->slice_type_nos!=FF_B_TYPE)
                && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
@@ -2890,7 +2897,9 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
 
             if(hx->redundant_pic_count==0 && hx->intra_gb_ptr && hx->s.data_partitioning
                && s->context_initialized
+#if FF_API_HURRY_UP
                && s->hurry_up < 5
+#endif
                && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
                && (avctx->skip_frame < AVDISCARD_BIDIR  || hx->slice_type_nos!=FF_B_TYPE)
                && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
@@ -3011,7 +3020,12 @@ static int decode_frame(AVCodecContext *avctx,
     }
 
     if(!(s->flags2 & CODEC_FLAG2_CHUNKS) && !s->current_picture_ptr){
-        if (avctx->skip_frame >= AVDISCARD_NONREF || s->hurry_up) return 0;
+        if (avctx->skip_frame >= AVDISCARD_NONREF
+#if FF_API_HURRY_UP
+                || s->hurry_up
+#endif
+           )
+            return 0;
         av_log(avctx, AV_LOG_ERROR, "no frame!\n");
         return -1;
     }
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index c47b6e2..06aa8ab 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -2398,14 +2398,18 @@ static int decode_chunks(AVCodecContext *avctx,
                 /* Skip P-frames if we do not have a reference frame or we have an invalid header. */
                     if(s2->pict_type==FF_P_TYPE && !s->sync) break;
                 }
+#if FF_API_HURRY_UP
                 /* Skip B-frames if we are in a hurry. */
                 if(avctx->hurry_up && s2->pict_type==FF_B_TYPE) break;
+#endif
                 if(  (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==FF_B_TYPE)
                     ||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=FF_I_TYPE)
                     || avctx->skip_frame >= AVDISCARD_ALL)
                     break;
+#if FF_API_HURRY_UP
                 /* Skip everything if we are in a hurry>=5. */
                 if(avctx->hurry_up>=5) break;
+#endif
 
                 if (!s->mpeg_enc_ctx_allocated) break;
 
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 1c5ff27..b6cc459 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1025,7 +1025,9 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
         }
     }
 
+#if FF_API_HURRY_UP
     s->hurry_up= s->avctx->hurry_up;
+#endif
     s->error_recognition= avctx->error_recognition;
 
     /* set dequantizer, we can't do it during init as it might change for mpeg4
@@ -1962,7 +1964,9 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
             }
 
             /* skip dequant / idct if we are really late ;) */
+#if FF_API_HURRY_UP
             if(s->hurry_up>1) goto skip_idct;
+#endif
             if(s->avctx->skip_idct){
                 if(  (s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE)
                    ||(s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE)
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index e92fdd1..0ff08d2 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -387,8 +387,10 @@ typedef struct MpegEncContext {
     int no_rounding;  /**< apply no rounding to motion compensation (MPEG4, msmpeg4, ...)
                         for b-frames rounding mode is always 0 */
 
+#if FF_API_HURRY_UP
     int hurry_up;     /**< when set to 1 during decoding, b frames will be skipped
                          when set to 2 idct/dequant will be skipped too */
+#endif
 
     /* macroblock layer */
     int mb_x, mb_y;
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 77b1f22..f7fa454 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -125,7 +125,9 @@ static const AVOption options[]={
 {"rc_strategy", "ratecontrol method", OFFSET(rc_strategy), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
 {"b_strategy", "strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX, V|E},
 {"wpredp", "weighted prediction analysis method", OFFSET(weighted_p_pred), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX, V|E},
-{"hurry_up", NULL, OFFSET(hurry_up), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D},
+#if FF_API_HURRY_UP
+{"hurry_up", "deprecated, use skip_idct/skip_frame instead", OFFSET(hurry_up), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D},
+#endif
 {"ps", "rtp payload size in bytes", OFFSET(rtp_payload_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
 {"mv_bits", NULL, OFFSET(mv_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
 {"header_bits", NULL, OFFSET(header_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index d6086d6..c40fde3 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -380,7 +380,9 @@ static void update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
     dst->release_buffer = src->release_buffer;
 
     dst->opaque   = src->opaque;
+#if FF_API_HURRY_UP
     dst->hurry_up = src->hurry_up;
+#endif
     dst->dsp_mask = src->dsp_mask;
     dst->debug    = src->debug;
     dst->debug_mv = src->debug_mv;
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 6eebf2a..8122b66 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1454,15 +1454,19 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
     }
     if((!s->last_picture_ptr || !s->last_picture_ptr->data[0]) && si.type == FF_B_TYPE)
         return -1;
+#if FF_API_HURRY_UP
     /* skip b frames if we are in a hurry */
     if(avctx->hurry_up && si.type==FF_B_TYPE) return buf_size;
+#endif
     if(   (avctx->skip_frame >= AVDISCARD_NONREF && si.type==FF_B_TYPE)
        || (avctx->skip_frame >= AVDISCARD_NONKEY && si.type!=FF_I_TYPE)
        ||  avctx->skip_frame >= AVDISCARD_ALL)
         return buf_size;
+#if FF_API_HURRY_UP
     /* skip everything if we are in a hurry>=5 */
     if(avctx->hurry_up>=5)
         return buf_size;
+#endif
 
     for(i=0; i<slice_count; i++){
         int offset= get_slice_offset(avctx, slices_hdr, i);
diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c
index 29490bd..5439abb 100644
--- a/libavcodec/svq1dec.c
+++ b/libavcodec/svq1dec.c
@@ -684,7 +684,9 @@ static int svq1_decode_frame(AVCodecContext *avctx,
   //this should be removed after libavcodec can handle more flexible picture types & ordering
   if(s->pict_type==FF_B_TYPE && s->last_picture_ptr==NULL) return buf_size;
 
+#if FF_API_HURRY_UP
   if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return buf_size;
+#endif
   if(  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
      ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
      || avctx->skip_frame >= AVDISCARD_ALL)
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index a385373..5886713 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -945,19 +945,21 @@ static int svq3_decode_frame(AVCodecContext *avctx,
                s->adaptive_quant, s->qscale, h->slice_num);
     }
 
-    /* for hurry_up == 5 */
+    /* for skipping the frame */
     s->current_picture.pict_type = s->pict_type;
     s->current_picture.key_frame = (s->pict_type == FF_I_TYPE);
 
     /* Skip B-frames if we do not have reference frames. */
     if (s->last_picture_ptr == NULL && s->pict_type == FF_B_TYPE)
         return 0;
+#if FF_API_HURRY_UP
     /* Skip B-frames if we are in a hurry. */
     if (avctx->hurry_up && s->pict_type == FF_B_TYPE)
         return 0;
     /* Skip everything if we are in a hurry >= 5. */
     if (avctx->hurry_up >= 5)
         return 0;
+#endif
     if (  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE)
         ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE)
         || avctx->skip_frame >= AVDISCARD_ALL)
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 55f12a6..cde284d 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -3374,7 +3374,7 @@ static int vc1_decode_frame(AVCodecContext *avctx,
         goto err;
     }
 
-    // for hurry_up==5
+    // for skipping the frame
     s->current_picture.pict_type= s->pict_type;
     s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
 
@@ -3382,17 +3382,21 @@ static int vc1_decode_frame(AVCodecContext *avctx,
     if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)){
         goto err;
     }
+#if FF_API_HURRY_UP
     /* skip b frames if we are in a hurry */
     if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return -1;//buf_size;
+#endif
     if(   (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
        || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
        ||  avctx->skip_frame >= AVDISCARD_ALL) {
         goto end;
     }
+#if FF_API_HURRY_UP
     /* skip everything if we are in a hurry>=5 */
     if(avctx->hurry_up>=5) {
         goto err;
     }
+#endif
 
     if(s->next_p_frame_damaged){
         if(s->pict_type==FF_B_TYPE)
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 5aa0b82..3d13f79 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -71,5 +71,8 @@
 #ifndef FF_API_OLD_AUDIOCONVERT
 #define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 53)
 #endif
+#ifndef FF_API_HURRY_UP
+#define FF_API_HURRY_UP         (LIBAVCODEC_VERSION_MAJOR < 53)
+#endif
 
 #endif /* AVCODEC_VERSION_H */



More information about the ffmpeg-cvslog mailing list