Commit e0a3d744 authored by Juanjo's avatar Juanjo

- repeat_pict meaning changed, now it signals the extra delay for the

decoded frame.
- extra_delay = (repeat_pict / 2) * (1/fps)

Originally committed as revision 496 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent c02dbee1
...@@ -5,8 +5,8 @@ ...@@ -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 4608 #define LIBAVCODEC_BUILD 4609
#define LIBAVCODEC_BUILD_STR "4608" #define LIBAVCODEC_BUILD_STR "4609"
enum CodecID { enum CodecID {
CODEC_ID_NONE, CODEC_ID_NONE,
...@@ -130,8 +130,9 @@ typedef struct AVCodecContext { ...@@ -130,8 +130,9 @@ typedef struct AVCodecContext {
#define FF_ASPECT_16_9_525 5 #define FF_ASPECT_16_9_525 5
int gop_size; /* 0 = intra only */ int gop_size; /* 0 = intra only */
enum PixelFormat pix_fmt; /* pixel format, see PIX_FMT_xxx */ enum PixelFormat pix_fmt; /* pixel format, see PIX_FMT_xxx */
int repeat_pict; /* set this to 1 if you want the decoder int repeat_pict; /* when decoding, this signal how much the picture */
to repeat frames for 3:2 pulldown (MPEG-2) */ /* must be delayed. */
/* extra_delay = (repeat_pict / 2) * (1/fps) */
/* if non NULL, 'draw_horiz_band' is called by the libavcodec /* if non NULL, 'draw_horiz_band' is called by the libavcodec
decoder to draw an horizontal band. It improve cache usage. Not decoder to draw an horizontal band. It improve cache usage. Not
all codecs can do that. You must check the codec capabilities all codecs can do that. You must check the codec capabilities
......
...@@ -1338,6 +1338,8 @@ static void mpeg_decode_picture_coding_extension(MpegEncContext *s) ...@@ -1338,6 +1338,8 @@ static void mpeg_decode_picture_coding_extension(MpegEncContext *s)
/* composite display not parsed */ /* composite display not parsed */
dprintf("intra_dc_precision=%d\n", s->intra_dc_precision); dprintf("intra_dc_precision=%d\n", s->intra_dc_precision);
dprintf("picture_structure=%d\n", s->picture_structure); dprintf("picture_structure=%d\n", s->picture_structure);
dprintf("top field first=%d\n", s->top_field_first);
dprintf("repeat first field=%d\n", s->repeat_first_field);
dprintf("conceal=%d\n", s->concealment_motion_vectors); dprintf("conceal=%d\n", s->concealment_motion_vectors);
dprintf("intra_vlc_format=%d\n", s->intra_vlc_format); dprintf("intra_vlc_format=%d\n", s->intra_vlc_format);
dprintf("alternate_scan=%d\n", s->alternate_scan); dprintf("alternate_scan=%d\n", s->alternate_scan);
...@@ -1587,15 +1589,18 @@ static int mpeg_decode_frame(AVCodecContext *avctx, ...@@ -1587,15 +1589,18 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
buf_ptr = buf; buf_ptr = buf;
buf_end = buf + buf_size; buf_end = buf + buf_size;
if (s->repeat_field % 2 == 1 && avctx->repeat_pict) { #if 0
if (s->repeat_field % 2 == 1) {
s->repeat_field++; s->repeat_field++;
//fprintf(stderr,"\nRepeating last frame: %d -> %d! pict: %d %d", avctx->frame_number-1, avctx->frame_number, //fprintf(stderr,"\nRepeating last frame: %d -> %d! pict: %d %d", avctx->frame_number-1, avctx->frame_number,
// s2->picture_number, s->repeat_field); // s2->picture_number, s->repeat_field);
*data_size = sizeof(AVPicture); if (avctx->flags & CODEC_FLAG_REPEAT_FIELD) {
goto the_end; *data_size = sizeof(AVPicture);
goto the_end;
}
} }
#endif
while (buf_ptr < buf_end) { while (buf_ptr < buf_end) {
buf_start = buf_ptr; buf_start = buf_ptr;
/* find start next code */ /* find start next code */
...@@ -1645,13 +1650,27 @@ static int mpeg_decode_frame(AVCodecContext *avctx, ...@@ -1645,13 +1650,27 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
if (ret == 1) { if (ret == 1) {
/* got a picture: exit */ /* got a picture: exit */
/* first check if we must repeat the frame */ /* first check if we must repeat the frame */
avctx->repeat_pict = 0;
#if 0
if (s2->progressive_frame && s2->repeat_first_field) { if (s2->progressive_frame && s2->repeat_first_field) {
//fprintf(stderr,"\nRepeat this frame: %d! pict: %d",avctx->frame_number,s2->picture_number); //fprintf(stderr,"\nRepeat this frame: %d! pict: %d",avctx->frame_number,s2->picture_number);
s2->repeat_first_field = 0; //s2->repeat_first_field = 0;
s2->progressive_frame = 0; //s2->progressive_frame = 0;
if (++s->repeat_field > 2) if (++s->repeat_field > 2)
s->repeat_field = 0; s->repeat_field = 0;
avctx->repeat_pict = 1;
} }
#endif
if (s2->repeat_first_field) {
if (s2->progressive_sequence) {
if (s2->top_field_first)
avctx->repeat_pict = 4;
else
avctx->repeat_pict = 2;
} else if (s2->progressive_frame) {
avctx->repeat_pict = 1;
}
}
*data_size = sizeof(AVPicture); *data_size = sizeof(AVPicture);
goto the_end; goto the_end;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment