Mercurial > libavcodec.hg
changeset 2792:0a8c847ad5e7 libavcodec
skip_idct
skip_frame
skip_loop_filter
author | michael |
---|---|
date | Thu, 14 Jul 2005 21:39:36 +0000 |
parents | f191093dc8fe |
children | ae85da6c5c2f |
files | avcodec.h h261.c h263dec.c h264.c mpeg12.c mpegvideo.c svq1.c svq3.c |
diffstat | 8 files changed, 73 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/avcodec.h Thu Jul 14 15:30:39 2005 +0000 +++ b/avcodec.h Thu Jul 14 21:39:36 2005 +0000 @@ -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;
--- a/h261.c Thu Jul 14 15:30:39 2005 +0000 +++ b/h261.c Thu Jul 14 21:39:36 2005 +0000 @@ -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;
--- a/h263dec.c Thu Jul 14 15:30:39 2005 +0000 +++ b/h263dec.c Thu Jul 14 21:39:36 2005 +0000 @@ -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);
--- a/h264.c Thu Jul 14 15:30:39 2005 +0000 +++ b/h264.c Thu Jul 14 21:39:36 2005 +0000 @@ -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:
--- a/mpeg12.c Thu Jul 14 15:30:39 2005 +0000 +++ b/mpeg12.c Thu Jul 14 21:39:36 2005 +0000 @@ -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;
--- a/mpegvideo.c Thu Jul 14 15:30:39 2005 +0000 +++ b/mpegvideo.c Thu Jul 14 21:39:36 2005 +0000 @@ -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);
--- a/svq1.c Thu Jul 14 15:30:39 2005 +0000 +++ b/svq1.c Thu Jul 14 21:39:36 2005 +0000 @@ -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;
--- a/svq3.c Thu Jul 14 15:30:39 2005 +0000 +++ b/svq3.c Thu Jul 14 21:39:36 2005 +0000 @@ -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)