summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2003-02-26 17:26:20 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-02-26 17:26:20 +0000
commit2ec23b6d44313a2f8a69120e46369b801a5cce38 (patch)
tree90fb255f3738ed971641174b5ec20a0c7514fe9a
parent5082f759e0d02b26e1b4dba8341d516079cfb115 (diff)
move repeat_pict field from AVCodecContext -> AVFrame (closes bug #683536)
Originally committed as revision 1608 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/avcodec.h19
-rw-r--r--libavcodec/mpeg12.c39
-rw-r--r--libavformat/utils.c2
3 files changed, 28 insertions, 32 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 297f5022e6..0ca39ab936 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -16,8 +16,8 @@ extern "C" {
#define LIBAVCODEC_VERSION_INT 0x000406
#define LIBAVCODEC_VERSION "0.4.6"
-#define LIBAVCODEC_BUILD 4657
-#define LIBAVCODEC_BUILD_STR "4657"
+#define LIBAVCODEC_BUILD 4658
+#define LIBAVCODEC_BUILD_STR "4658"
enum CodecID {
CODEC_ID_NONE,
@@ -280,6 +280,15 @@ static const int Motion_Est_QTab[] = { ME_ZERO, ME_PHODS, ME_LOG,
* Note: user allocated (direct rendering) & internal buffers can not coexist currently\
*/\
int type;\
+ \
+ /**\
+ * when decoding, this signal how much the picture must be delayed.\
+ * extra_delay = repeat_pict / (2*fps)\
+ * encoding: unused\
+ * decoding: set by lavc\
+ */\
+ int repeat_pict;
+
#define FF_BUFFER_TYPE_INTERNAL 1
#define FF_BUFFER_TYPE_USER 2 // Direct rendering buffers
@@ -379,11 +388,7 @@ typedef struct AVCodecContext {
* decoding: set by lavc.
*/
enum PixelFormat pix_fmt;
-
- int repeat_pict; /* when decoding, this signal how much the picture */
- /* must be delayed. */
- /* extra_delay = (repeat_pict / 2) * (1/fps) */
-
+
/**
* if non NULL, 'draw_horiz_band' is called by the libavcodec
* decoder to draw an horizontal band. It improve cache usage. Not
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 35fb5c819a..d265338af1 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1786,7 +1786,21 @@ static int mpeg_decode_slice(AVCodecContext *avctx,
s->first_slice = 0;
if(MPV_frame_start(s, avctx) < 0)
return DECODE_SLICE_FATAL_ERROR;
-
+ /* first check if we must repeat the frame */
+ s->current_picture.repeat_pict = 0;
+
+ if (s->repeat_first_field) {
+ if (s->progressive_sequence) {
+ if (s->top_field_first)
+ s->current_picture.repeat_pict = 4;
+ else
+ s->current_picture.repeat_pict = 2;
+ } else if (s->progressive_frame) {
+ s->current_picture.repeat_pict = 1;
+ }
+ }
+// printf("%d \n", s->current_picture.repeat_pict);
+
if(s->avctx->debug&FF_DEBUG_PICT_INFO){
printf("qp:%d fc:%2d%2d%2d%2d %s %s %s %s dc:%d pstruct:%d fdct:%d cmv:%d qtype:%d ivlc:%d rff:%d %s\n",
s->qscale, s->mpeg_f_code[0][0],s->mpeg_f_code[0][1],s->mpeg_f_code[1][0],s->mpeg_f_code[1][1],
@@ -2146,29 +2160,6 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
ret = mpeg_decode_slice(avctx, picture,
start_code, s->buffer, input_size);
if (ret == DECODE_SLICE_EOP) {
- /* got a picture: exit */
- /* first check if we must repeat the frame */
- avctx->repeat_pict = 0;
-#if 0
- if (s2->progressive_frame && s2->repeat_first_field) {
- //fprintf(stderr,"\nRepeat this frame: %d! pict: %d",avctx->frame_number,s2->picture_number);
- //s2->repeat_first_field = 0;
- //s2->progressive_frame = 0;
- if (++s->repeat_field > 2)
- 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);
goto the_end;
}else if(ret<0){
diff --git a/libavformat/utils.c b/libavformat/utils.c
index d6e888b9f3..93048490fb 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -605,7 +605,7 @@ int av_find_stream_info(AVFormatContext *ic)
TS case we do not do it because it would be
too long */
st->codec_info_nb_real_frames++;
- st->codec_info_nb_repeat_frames += st->codec.repeat_pict;
+ st->codec_info_nb_repeat_frames += st->codec.coded_frame->repeat_pict;
#if 0
/* XXX: testing */
if ((st->codec_info_nb_real_frames % 24) == 23) {