summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-12-19 02:11:50 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-12-19 02:34:18 +0100
commit7c29313b387392fa305365e855fa408cd28c276e (patch)
tree328f30ad4a4e6b606bbbffc1f15f22d2044affb3 /libavcodec
parentf371396dfb95c116a05e9b9f690fa916bb2d815e (diff)
parent2a216ca2ef29282cac9003a716b469b8c80c0a15 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: APIchanges: fill in revision for AVFrame.age deprecation avcodec: deprecate AVFrame.age 4xm: remove unneeded check for remaining unused data. lavf: force threads to 1 in avformat_find_stream_info() swscale: fix overflows in vertical scaling at top/bottom edges. lavf: add OpenMG audio muxer. omadec: split data that will be used in the muxer to a separate file. lavf: rename oma.c -> omadec.c tmv decoder: set correct pix_fmt Conflicts: Changelog doc/APIchanges libavcodec/mpegvideo.c libavcodec/version.h libavformat/oma.c libavformat/version.h libswscale/swscale.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/4xm.c9
-rw-r--r--libavcodec/avcodec.h9
-rw-r--r--libavcodec/internal.h1
-rw-r--r--libavcodec/mpegvideo.c35
-rw-r--r--libavcodec/mpegvideo.h2
-rw-r--r--libavcodec/pthread.c7
-rw-r--r--libavcodec/tmv.c16
-rw-r--r--libavcodec/utils.c10
-rw-r--r--libavcodec/version.h5
9 files changed, 22 insertions, 72 deletions
diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
index f854f1cfb5..43f6a21ea8 100644
--- a/libavcodec/4xm.c
+++ b/libavcodec/4xm.c
@@ -440,15 +440,6 @@ static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length){
dst += 8*stride;
}
- if( bitstream_size != (get_bits_count(&f->gb)+31)/32*4
- || (((const char*)f->wordstream - (const char*)buf + 2)&~2) != extra + bitstream_size + wordstream_size
- || (((const char*)f->bytestream - (const char*)buf + 3)&~3) != extra + bitstream_size + wordstream_size + bytestream_size)
- av_log(f->avctx, AV_LOG_ERROR, " %d %td %td bytes left\n",
- bitstream_size - (get_bits_count(&f->gb)+31)/32*4,
- -(((const char*)f->bytestream - (const char*)buf + 3)&~3) + (extra + bitstream_size + wordstream_size + bytestream_size),
- -(((const char*)f->wordstream - (const char*)buf + 2)&~2) + (extra + bitstream_size + wordstream_size)
- );
-
return 0;
}
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 6d4489c2a4..0b9405ff4d 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1029,13 +1029,12 @@ typedef struct AVFrame {
*/
int quality;
+#if FF_API_AVFRAME_AGE
/**
- * buffer age (1->was last buffer and dint change, 2->..., ...).
- * Set to INT_MAX if the buffer has not been used yet.
- * - encoding: unused
- * - decoding: MUST be set by get_buffer() for video.
+ * @deprecated unused
*/
- int age;
+ attribute_deprecated int age;
+#endif
/**
* is this picture used as reference
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 352be67854..13deb87120 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -30,7 +30,6 @@
#include "avcodec.h"
typedef struct InternalBuffer {
- int last_pic_num;
uint8_t *base[AV_NUM_DATA_POINTERS];
uint8_t *data[AV_NUM_DATA_POINTERS];
int linesize[AV_NUM_DATA_POINTERS];
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 98a771c463..0f26701b42 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -263,9 +263,9 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
else
r = avcodec_default_get_buffer(s->avctx, (AVFrame *) pic);
- if (r < 0 || !pic->f.age || !pic->f.type || !pic->f.data[0]) {
- av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %d %p)\n",
- r, pic->f.age, pic->f.type, pic->f.data[0]);
+ if (r < 0 || !pic->f.type || !pic->f.data[0]) {
+ av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %p)\n",
+ r, pic->f.type, pic->f.data[0]);
av_freep(&pic->f.hwaccel_picture_private);
return -1;
}
@@ -369,15 +369,6 @@ int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared)
1 * sizeof(AVPanScan), fail)
}
- /* It might be nicer if the application would keep track of these
- * but it would require an API change. */
- memmove(s->prev_pict_types + 1, s->prev_pict_types,
- PREV_PICT_TYPES_BUFFER_SIZE-1);
- s->prev_pict_types[0] = s->dropable ? AV_PICTURE_TYPE_B : s->pict_type;
- if (pic->f.age < PREV_PICT_TYPES_BUFFER_SIZE &&
- s->prev_pict_types[pic->f.age] == AV_PICTURE_TYPE_B)
- pic->f.age = INT_MAX; // Skipped MBs in B-frames are quite rare in MPEG-1/2
- // and it is a bit tricky to skip them anyway.
pic->owner2 = s;
return 0;
@@ -574,9 +565,6 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
s->current_picture_ptr = REBASE_PICTURE(s1->current_picture_ptr, s, s1);
s->next_picture_ptr = REBASE_PICTURE(s1->next_picture_ptr, s, s1);
- memcpy(s->prev_pict_types, s1->prev_pict_types,
- PREV_PICT_TYPES_BUFFER_SIZE);
-
// Error/bug resilience
s->next_p_frame_damaged = s1->next_p_frame_damaged;
s->workaround_bugs = s1->workaround_bugs;
@@ -837,7 +825,6 @@ av_cold int MPV_common_init(MpegEncContext *s)
/* init macroblock skip table */
FF_ALLOCZ_OR_GOTO(s->avctx, s->mbskip_table, mb_array_size + 2, fail);
// Note the + 1 is for a quicker mpeg4 slice_end detection
- FF_ALLOCZ_OR_GOTO(s->avctx, s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE, fail);
s->parse_context.state = -1;
if ((s->avctx->debug & (FF_DEBUG_VIS_QP | FF_DEBUG_VIS_MB_TYPE)) ||
@@ -928,7 +915,6 @@ void MPV_common_end(MpegEncContext *s)
av_freep(&s->pred_dir_table);
av_freep(&s->mbskip_table);
- av_freep(&s->prev_pict_types);
av_freep(&s->bitstream_buffer);
s->allocated_bitstream_buffer_size = 0;
@@ -2201,24 +2187,13 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
/* skip only during decoding as we might trash the buffers during encoding a bit */
if(!s->encoding){
uint8_t *mbskip_ptr = &s->mbskip_table[mb_xy];
- const int age = s->current_picture.f.age;
-
- assert(age);
if (s->mb_skipped) {
s->mb_skipped= 0;
assert(s->pict_type!=AV_PICTURE_TYPE_I);
-
- (*mbskip_ptr) ++; /* indicate that this time we skipped it */
- if(*mbskip_ptr >99) *mbskip_ptr= 99;
-
- /* if previous was skipped too, then nothing to do ! */
- if (*mbskip_ptr >= age && s->current_picture.f.reference){
- return;
- }
+ *mbskip_ptr = 1;
} else if(!s->current_picture.f.reference) {
- (*mbskip_ptr) ++; /* increase counter so the age can be compared cleanly */
- if(*mbskip_ptr >99) *mbskip_ptr= 99;
+ *mbskip_ptr = 1;
} else{
*mbskip_ptr = 0; /* not skipped */
}
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 3f7f7865fe..b0b21c7779 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -311,8 +311,6 @@ typedef struct MpegEncContext {
uint8_t *coded_block; ///< used for coded block pattern prediction (msmpeg4v3, wmv1)
int16_t (*ac_val_base)[16];
int16_t (*ac_val[3])[16]; ///< used for for mpeg4 AC prediction, all 3 arrays must be continuous
- uint8_t *prev_pict_types; ///< previous picture types in bitstream order, used for mb skip
-#define PREV_PICT_TYPES_BUFFER_SIZE 256
int mb_skipped; ///< MUST BE SET only during DECODING
uint8_t *mbskip_table; /**< used to avoid copy if macroblock skipped (for black regions for example)
and used for b-frame encoding & decoding (contains skip table of next P Frame) */
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 2be54d8d0a..bca01edef5 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -868,13 +868,6 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
pthread_mutex_unlock(&p->parent->buffer_mutex);
- /*
- * Buffer age is difficult to keep track of between
- * multiple threads, and the optimizations it allows
- * are not worth the effort. It is disabled for now.
- */
- f->age = INT_MAX;
-
return err;
}
diff --git a/libavcodec/tmv.c b/libavcodec/tmv.c
index 424cddf84d..7eb9b6903a 100644
--- a/libavcodec/tmv.c
+++ b/libavcodec/tmv.c
@@ -34,14 +34,6 @@ typedef struct TMVContext {
AVFrame pic;
} TMVContext;
-static av_cold int tmv_decode_init(AVCodecContext *avctx)
-{
- TMVContext *tmv = avctx->priv_data;
-
- avcodec_get_frame_defaults(&tmv->pic);
- return 0;
-}
-
static int tmv_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt)
{
@@ -90,6 +82,14 @@ static int tmv_decode_frame(AVCodecContext *avctx, void *data,
return avpkt->size;
}
+static av_cold int tmv_decode_init(AVCodecContext *avctx)
+{
+ TMVContext *tmv = avctx->priv_data;
+ avctx->pix_fmt = PIX_FMT_PAL8;
+ avcodec_get_frame_defaults(&tmv->pic);
+ return 0;
+}
+
static av_cold int tmv_decode_close(AVCodecContext *avctx)
{
TMVContext *tmv = avctx->priv_data;
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index ef5e1a78f9..af872a70e7 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -373,7 +373,6 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
int w= s->width;
int h= s->height;
InternalBuffer *buf;
- int *picture_number;
AVCodecInternal *avci = s->internal;
if(pic->data[0]!=NULL) {
@@ -394,8 +393,6 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
}
buf = &avci->buffer[avci->buffer_count];
- picture_number = &(avci->buffer[INTERNAL_BUFFER_SIZE]).last_pic_num; //FIXME ugly hack
- (*picture_number)++;
if(buf->base[0] && (buf->width != w || buf->height != h || buf->pix_fmt != s->pix_fmt)){
if(s->active_thread_type&FF_THREAD_FRAME) {
@@ -409,10 +406,7 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
}
}
- if(buf->base[0]){
- pic->age= *picture_number - buf->last_pic_num;
- buf->last_pic_num= *picture_number;
- }else{
+ if (!buf->base[0]) {
int h_chroma_shift, v_chroma_shift;
int size[4] = {0};
int tmpsize;
@@ -451,7 +445,6 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
size[i] = picture.data[i+1] - picture.data[i];
size[i] = tmpsize - (picture.data[i] - picture.data[0]);
- buf->last_pic_num= -256*256*256*64;
memset(buf->base, 0, sizeof(buf->base));
memset(buf->data, 0, sizeof(buf->data));
@@ -480,7 +473,6 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
buf->width = s->width;
buf->height = s->height;
buf->pix_fmt= s->pix_fmt;
- pic->age= 256*256*256*64;
}
pic->type= FF_BUFFER_TYPE_INTERNAL;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index a71e02e75e..360068a95f 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -22,7 +22,7 @@
#define LIBAVCODEC_VERSION_MAJOR 53
#define LIBAVCODEC_VERSION_MINOR 46
-#define LIBAVCODEC_VERSION_MICRO 0
+#define LIBAVCODEC_VERSION_MICRO 1
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
@@ -120,5 +120,8 @@
#define FF_API_OLD_TIMECODE (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
+#ifndef FF_API_AVFRAME_AGE
+#define FF_API_AVFRAME_AGE (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
#endif /* AVCODEC_VERSION_H */