export mbskip_table for direct rendering
add hurry_up support Originally committed as revision 424 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
d7e9533aa0
commit
2417652e9f
@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
#define LIBAVCODEC_VERSION_INT 0x000406
|
#define LIBAVCODEC_VERSION_INT 0x000406
|
||||||
#define LIBAVCODEC_VERSION "0.4.6"
|
#define LIBAVCODEC_VERSION "0.4.6"
|
||||||
#define LIBAVCODEC_BUILD 4603
|
#define LIBAVCODEC_BUILD 4604
|
||||||
#define LIBAVCODEC_BUILD_STR "4603"
|
#define LIBAVCODEC_BUILD_STR "4604"
|
||||||
|
|
||||||
enum CodecID {
|
enum CodecID {
|
||||||
CODEC_ID_NONE,
|
CODEC_ID_NONE,
|
||||||
@ -141,6 +141,8 @@ typedef struct AVCodecContext {
|
|||||||
int key_frame; /* true if the previous compressed frame was
|
int key_frame; /* true if the previous compressed frame was
|
||||||
a key frame (intra, or seekable) */
|
a key frame (intra, or seekable) */
|
||||||
int delay; /* number of frames the decoded output will be delayed relative to the encoded input */
|
int delay; /* number of frames the decoded output will be delayed relative to the encoded input */
|
||||||
|
uint8_t *mbskip_table; /* =1 if MB didnt change, is only valid for I/P frames
|
||||||
|
stride= mb_width = (width+15)>>4 */
|
||||||
|
|
||||||
/* encoding parameters */
|
/* encoding parameters */
|
||||||
int quality; /* quality of the previous encoded frame
|
int quality; /* quality of the previous encoded frame
|
||||||
@ -157,6 +159,9 @@ typedef struct AVCodecContext {
|
|||||||
int rc_strategy;
|
int rc_strategy;
|
||||||
int b_frame_strategy;
|
int b_frame_strategy;
|
||||||
|
|
||||||
|
int hurry_up; /* when set to 1 during decoding, b frames will be skiped
|
||||||
|
when set to 2 idct/dequant will be skipped too */
|
||||||
|
|
||||||
struct AVCodec *codec;
|
struct AVCodec *codec;
|
||||||
void *priv_data;
|
void *priv_data;
|
||||||
|
|
||||||
|
@ -74,6 +74,7 @@ static int h263_decode_init(AVCodecContext *avctx)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
s->codec_id= avctx->codec->id;
|
s->codec_id= avctx->codec->id;
|
||||||
|
avctx->mbskip_table= s->mbskip_table;
|
||||||
|
|
||||||
/* for h263, we allocate the images after having read the header */
|
/* for h263, we allocate the images after having read the header */
|
||||||
if (avctx->codec->id != CODEC_ID_H263 && avctx->codec->id != CODEC_ID_MPEG4)
|
if (avctx->codec->id != CODEC_ID_H263 && avctx->codec->id != CODEC_ID_MPEG4)
|
||||||
@ -108,6 +109,8 @@ static int h263_decode_frame(AVCodecContext *avctx,
|
|||||||
printf("*****frame %d size=%d\n", avctx->frame_number, buf_size);
|
printf("*****frame %d size=%d\n", avctx->frame_number, buf_size);
|
||||||
printf("bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]);
|
printf("bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
s->hurry_up= avctx->hurry_up;
|
||||||
|
|
||||||
/* no supplementary picture */
|
/* no supplementary picture */
|
||||||
if (buf_size == 0) {
|
if (buf_size == 0) {
|
||||||
@ -154,6 +157,8 @@ static int h263_decode_frame(AVCodecContext *avctx,
|
|||||||
return -1;
|
return -1;
|
||||||
/* skip b frames if we dont have reference frames */
|
/* skip b frames if we dont have reference frames */
|
||||||
if(s->num_available_buffers<2 && s->pict_type==B_TYPE) return 0;
|
if(s->num_available_buffers<2 && s->pict_type==B_TYPE) return 0;
|
||||||
|
/* skip b frames if we are in a hurry */
|
||||||
|
if(s->hurry_up && s->pict_type==B_TYPE) return 0;
|
||||||
|
|
||||||
MPV_frame_start(s);
|
MPV_frame_start(s);
|
||||||
|
|
||||||
|
@ -1187,6 +1187,7 @@ static int mpeg_decode_init(AVCodecContext *avctx)
|
|||||||
s->mpeg_enc_ctx.picture_number = 0;
|
s->mpeg_enc_ctx.picture_number = 0;
|
||||||
s->repeat_field = 0;
|
s->repeat_field = 0;
|
||||||
s->mpeg_enc_ctx.codec_id= avctx->codec->id;
|
s->mpeg_enc_ctx.codec_id= avctx->codec->id;
|
||||||
|
avctx->mbskip_table= s->mpeg_enc_ctx.mbskip_table;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1145,6 +1145,9 @@ static inline void put_dct(MpegEncContext *s,
|
|||||||
static inline void add_dct(MpegEncContext *s,
|
static inline void add_dct(MpegEncContext *s,
|
||||||
DCTELEM *block, int i, UINT8 *dest, int line_size)
|
DCTELEM *block, int i, UINT8 *dest, int line_size)
|
||||||
{
|
{
|
||||||
|
/* skip dequant / idct if we are really late ;) */
|
||||||
|
if(s->hurry_up>1) return;
|
||||||
|
|
||||||
if (s->block_last_index[i] >= 0) {
|
if (s->block_last_index[i] >= 0) {
|
||||||
if (!s->mpeg2)
|
if (!s->mpeg2)
|
||||||
if(s->encoding || (!s->h263_msmpeg4))
|
if(s->encoding || (!s->h263_msmpeg4))
|
||||||
|
@ -196,6 +196,9 @@ typedef struct MpegEncContext {
|
|||||||
int no_rounding; /* apply no rounding to motion compensation (MPEG4, msmpeg4, ...)
|
int no_rounding; /* apply no rounding to motion compensation (MPEG4, msmpeg4, ...)
|
||||||
for b-frames rounding mode is allways 0 */
|
for b-frames rounding mode is allways 0 */
|
||||||
|
|
||||||
|
int hurry_up; /* when set to 1 during decoding, b frames will be skiped
|
||||||
|
when set to 2 idct/dequant will be skipped too */
|
||||||
|
|
||||||
/* macroblock layer */
|
/* macroblock layer */
|
||||||
int mb_x, mb_y;
|
int mb_x, mb_y;
|
||||||
int mb_incr;
|
int mb_incr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user