[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec avcodec.h, 1.406, 1.407 h261.c, 1.26, 1.27 h263dec.c, 1.168, 1.169 h264.c, 1.143, 1.144 mpeg12.c, 1.240, 1.241 mpegvideo.c, 1.485, 1.486 svq1.c, 1.56, 1.57 svq3.c, 1.27, 1.28

Michael Niedermayer CVS michael
Thu Jul 14 23:39:40 CEST 2005


Update of /cvsroot/ffmpeg/ffmpeg/libavcodec
In directory mail:/var2/tmp/cvs-serv30409/libavcodec

Modified Files:
	avcodec.h h261.c h263dec.c h264.c mpeg12.c mpegvideo.c svq1.c 
	svq3.c 
Log Message:
skip_idct
skip_frame
skip_loop_filter


Index: avcodec.h
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/avcodec.h,v
retrieving revision 1.406
retrieving revision 1.407
diff -u -d -r1.406 -r1.407
--- avcodec.h	14 Jul 2005 14:34:39 -0000	1.406
+++ avcodec.h	14 Jul 2005 21:39:35 -0000	1.407
@@ -17,7 +17,8 @@
 
 #define FFMPEG_VERSION_INT     0x000409
 #define FFMPEG_VERSION         "CVS"
-#define LIBAVCODEC_BUILD       4757
+#define LIBAVCODEC_BUILD       4758
+
 
 #define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
 #define LIBAVCODEC_VERSION     FFMPEG_VERSION
@@ -284,6 +285,16 @@
     AV_ROUND_NEAR_INF = 5, ///< round to nearest and halfway cases away from zero
 };
 
+enum AVDiscard{
+//we leave some space between them for extensions (drop some keyframes for intra only or drop just some bidir frames)
+    AVDISCARD_NONE   =-16, ///< discard nothing
+    AVDISCARD_DEFAULT=  0, ///< discard useless packets like 0 size packets in avi
+    AVDISCARD_NONREF =  8, ///< discard all non reference
+    AVDISCARD_BIDIR  = 16, ///< discard all bidirectional frames
+    AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
+    AVDISCARD_ALL    = 48, ///< discard all
+};
+
 typedef struct RcOverride{
     int start_frame;
     int end_frame;
@@ -858,6 +869,7 @@
 
     /**
      * hurry up amount.
+     * deprecated in favor of skip_idct and skip_frame
      * - encoding: unused
      * - decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header
      */
@@ -1807,6 +1819,27 @@
      * - decoding: unused
      */
     int me_penalty_compensation;
+
+    /**
+     * 
+     * - encoding: unused
+     * - decoding: set by user.
+     */
+    enum AVDiscard skip_loop_filter;
+
+    /**
+     * 
+     * - encoding: unused
+     * - decoding: set by user.
+     */
+    enum AVDiscard skip_idct;
+
+    /**
+     * 
+     * - encoding: unused
+     * - decoding: set by user.
+     */
+    enum AVDiscard skip_frame;
 } AVCodecContext;
 
 

Index: h261.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/h261.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- h261.c	30 Apr 2005 21:43:56 -0000	1.26
+++ h261.c	14 Jul 2005 21:39:35 -0000	1.27
@@ -970,6 +970,10 @@
 
     /* skip everything if we are in a hurry>=5 */
     if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);
+    if(  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==B_TYPE)
+       ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=I_TYPE)
+       || avctx->skip_frame >= AVDISCARD_ALL)
+        return get_consumed_bytes(s, buf_size);
 
     if(MPV_frame_start(s, avctx) < 0)
         return -1;

Index: h263dec.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/h263dec.c,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -d -r1.168 -r1.169
--- h263dec.c	17 Jun 2005 15:02:52 -0000	1.168
+++ h263dec.c	14 Jul 2005 21:39:35 -0000	1.169
@@ -673,6 +673,10 @@
     if(s->last_picture_ptr==NULL && (s->pict_type==B_TYPE || s->dropable)) return get_consumed_bytes(s, buf_size);
     /* skip b frames if we are in a hurry */
     if(avctx->hurry_up && s->pict_type==B_TYPE) return get_consumed_bytes(s, buf_size);
+    if(   (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==B_TYPE)
+       || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=I_TYPE)
+       ||  avctx->skip_frame >= AVDISCARD_ALL) 
+        return get_consumed_bytes(s, buf_size);
     /* skip everything if we are in a hurry>=5 */
     if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);
     

Index: h264.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/h264.c,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -d -r1.143 -r1.144
--- h264.c	2 Jul 2005 19:39:58 -0000	1.143
+++ h264.c	14 Jul 2005 21:39:35 -0000	1.144
@@ -4349,6 +4349,11 @@
             h->slice_beta_offset = get_se_golomb(&s->gb) << 1;
         }
     }
+    if(   s->avctx->skip_loop_filter >= AVDISCARD_ALL
+       ||(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && h->slice_type != I_TYPE)
+       ||(s->avctx->skip_loop_filter >= AVDISCARD_BIDIR  && h->slice_type == B_TYPE)
+       ||(s->avctx->skip_loop_filter >= AVDISCARD_NONREF && h->nal_ref_idc == 0))
+        h->deblocking_filter= 0;
 
 #if 0 //FMO
     if( h->pps.num_slice_groups > 1  && h->pps.mb_slice_group_map_type >= 3 && h->pps.mb_slice_group_map_type <= 5)
@@ -7245,7 +7250,8 @@
 
         buf_index += consumed;
 
-        if( s->hurry_up == 1 && h->nal_ref_idc  == 0 )
+        if(  (s->hurry_up == 1 && h->nal_ref_idc  == 0)
+           ||(avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc  == 0))
             continue;
         
         switch(h->nal_unit_type){
@@ -7261,7 +7267,7 @@
                 av_log(h->s.avctx, AV_LOG_ERROR, "decode_slice_header error\n");
                 break;
             }
-            if(h->redundant_pic_count==0 && s->hurry_up < 5 )
+            if(h->redundant_pic_count==0 && s->hurry_up < 5 && avctx->skip_frame < AVDISCARD_ALL)
                 decode_slice(h);
             break;
         case NAL_DPA:
@@ -7282,7 +7288,8 @@
             init_get_bits(&h->inter_gb, ptr, bit_length);
             h->inter_gb_ptr= &h->inter_gb;
 
-            if(h->redundant_pic_count==0 && h->intra_gb_ptr && s->data_partitioning && s->hurry_up < 5 )
+            if(h->redundant_pic_count==0 && h->intra_gb_ptr && s->data_partitioning 
+               && s->hurry_up < 5 && avctx->skip_frame < AVDISCARD_ALL)
                 decode_slice(h);
             break;
         case NAL_SEI:

Index: mpeg12.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/mpeg12.c,v
retrieving revision 1.240
retrieving revision 1.241
diff -u -d -r1.240 -r1.241
--- mpeg12.c	11 Jul 2005 22:15:03 -0000	1.240
+++ mpeg12.c	14 Jul 2005 21:39:35 -0000	1.241
@@ -3086,7 +3086,7 @@
         /* find start next code */
         start_code = find_start_code(&buf_ptr, buf_end);
         if (start_code < 0){
-            if(s2->pict_type != B_TYPE || avctx->hurry_up==0){
+            if(s2->pict_type != B_TYPE || avctx->skip_frame <= AVDISCARD_DEFAULT){
                 if(avctx->thread_count > 1){
                     int i;
 
@@ -3146,6 +3146,10 @@
                         }
                         /* skip b frames if we are in a hurry */
                         if(avctx->hurry_up && s2->pict_type==B_TYPE) break;
+                        if(  (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==B_TYPE)
+                           ||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=I_TYPE)
+                           || avctx->skip_frame >= AVDISCARD_ALL)
+                            break;
                         /* skip everything if we are in a hurry>=5 */
                         if(avctx->hurry_up>=5) break;
                         

Index: mpegvideo.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/mpegvideo.c,v
retrieving revision 1.485
retrieving revision 1.486
diff -u -d -r1.485 -r1.486
--- mpegvideo.c	17 Jun 2005 15:02:52 -0000	1.485
+++ mpegvideo.c	14 Jul 2005 21:39:35 -0000	1.486
@@ -3777,7 +3777,13 @@
             }
 
             /* skip dequant / idct if we are really late ;) */
-            if(s->hurry_up>1) return;
+            if(s->hurry_up>1) goto skip_idct;
+            if(s->avctx->skip_idct){
+                if(  (s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == B_TYPE)
+                   ||(s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != I_TYPE)
+                   || s->avctx->skip_idct >= AVDISCARD_ALL)
+                    goto skip_idct;
+            }
 
             /* add dct residue */
             if(s->encoding || !(   s->h263_msmpeg4 || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO
@@ -3863,6 +3869,7 @@
                 }//gray
             }
         }
+skip_idct:
         if(!readable){
             s->dsp.put_pixels_tab[0][0](s->dest[0], dest_y ,   linesize,16);
             s->dsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[1], dest_cb, uvlinesize,16 >> s->chroma_y_shift);

Index: svq1.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/svq1.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- svq1.c	24 Feb 2005 19:08:50 -0000	1.56
+++ svq1.c	14 Jul 2005 21:39:35 -0000	1.57
@@ -748,6 +748,10 @@
   if(s->pict_type==B_TYPE && s->last_picture_ptr==NULL) return buf_size;
   
   if(avctx->hurry_up && s->pict_type==B_TYPE) return buf_size;
+  if(  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==B_TYPE)
+     ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=I_TYPE)
+     || avctx->skip_frame >= AVDISCARD_ALL)
+      return buf_size;                            
 
   if(MPV_frame_start(s, avctx) < 0)
       return -1;

Index: svq3.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/svq3.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- svq3.c	18 Apr 2005 12:08:16 -0000	1.27
+++ svq3.c	14 Jul 2005 21:39:35 -0000	1.28
@@ -896,6 +896,10 @@
   if (avctx->hurry_up && s->pict_type == B_TYPE) return 0;
   /* skip everything if we are in a hurry >= 5 */
   if (avctx->hurry_up >= 5) return 0;
+  if(  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==B_TYPE)
+     ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=I_TYPE)
+     || avctx->skip_frame >= AVDISCARD_ALL)
+      return 0;
 
   if (s->next_p_frame_damaged) {
     if (s->pict_type == B_TYPE)





More information about the ffmpeg-cvslog mailing list