aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-03-25 01:56:53 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-03-25 01:56:53 +0100
commit8bf95e8bd5c20eb940bd9583d3f947d8210eeb56 (patch)
tree43936a02f5da95392199e07b1ad38980e0ac2bc8 /libavcodec
parentf4c380a5e65c60422c6f62cab7bfe6155276d11d (diff)
parentd5ed5e7d0c1fa46de348db0de4c82b0f621db3d4 (diff)
downloadffmpeg-8bf95e8bd5c20eb940bd9583d3f947d8210eeb56.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: avc: Add a function for converting mp4 style extradata to annex b pthread: free progress if buffer allocation failed. lavc/avconv: support changing frame sizes in codecs with frame mt. libavformat: Document who sets the AVStream.id field utvideo: mark output picture as keyframe. sunrast: Add support for negative linesize. vp8: fix update_lf_deltas in libavcodec/vp8.c ralf: read Huffman code lengths without GetBitContext Conflicts: ffmpeg.c libavcodec/sunrastenc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/pthread.c8
-rw-r--r--libavcodec/ralf.c8
-rw-r--r--libavcodec/utils.c9
-rw-r--r--libavcodec/utvideo.c2
-rw-r--r--libavcodec/vp8.c20
5 files changed, 30 insertions, 17 deletions
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index d8f8858c1e..e155f73680 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -646,10 +646,6 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
*picture = p->frame;
*got_picture_ptr = p->got_frame;
picture->pkt_dts = p->avpkt.dts;
- picture->sample_aspect_ratio = avctx->sample_aspect_ratio;
- picture->width = avctx->width;
- picture->height = avctx->height;
- picture->format = avctx->pix_fmt;
/*
* A later call with avkpt->size == 0 may loop over all threads,
@@ -995,6 +991,10 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
ff_thread_finish_setup(avctx);
}
+ if (err) {
+ free_progress(f);
+ f->thread_opaque = NULL;
+ }
pthread_mutex_unlock(&p->parent->buffer_mutex);
return err;
diff --git a/libavcodec/ralf.c b/libavcodec/ralf.c
index 38e7e69cb7..0e5b04663f 100644
--- a/libavcodec/ralf.c
+++ b/libavcodec/ralf.c
@@ -80,17 +80,17 @@ static int init_ralf_vlc(VLC *vlc, const uint8_t *data, int elems)
int counts[17], prefixes[18];
int i, cur_len;
int max_bits = 0;
- GetBitContext gb;
-
- init_get_bits(&gb, data, elems * 4);
+ int nb = 0;
for (i = 0; i <= 16; i++)
counts[i] = 0;
for (i = 0; i < elems; i++) {
- cur_len = get_bits(&gb, 4) + 1;
+ cur_len = (nb ? *data & 0xF : *data >> 4) + 1;
counts[cur_len]++;
max_bits = FFMAX(max_bits, cur_len);
lens[i] = cur_len;
+ data += nb;
+ nb ^= 1;
}
prefixes[1] = 0;
for (i = 1; i <= 16; i++)
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 58435d43aa..9c662c2ba3 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -425,11 +425,6 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
buf = &avci->buffer[avci->buffer_count];
if(buf->base[0] && (buf->width != w || buf->height != h || buf->pix_fmt != s->pix_fmt)){
- if(s->active_thread_type&FF_THREAD_FRAME) {
- av_log_missing_feature(s, "Width/height changing with frame threads is", 0);
- return -1;
- }
-
for (i = 0; i < AV_NUM_DATA_POINTERS; i++) {
av_freep(&buf->base[i]);
buf->data[i]= NULL;
@@ -513,6 +508,10 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
}
pic->extended_data = pic->data;
avci->buffer_count++;
+ pic->width = buf->width;
+ pic->height = buf->height;
+ pic->format = buf->pix_fmt;
+ pic->sample_aspect_ratio = s->sample_aspect_ratio;
if (s->pkt) {
pic->pkt_pts = s->pkt->pts;
diff --git a/libavcodec/utvideo.c b/libavcodec/utvideo.c
index cadac5c3f3..cdc688da22 100644
--- a/libavcodec/utvideo.c
+++ b/libavcodec/utvideo.c
@@ -490,6 +490,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
break;
}
+ c->pic.key_frame = 1;
+ c->pic.pict_type = AV_PICTURE_TYPE_I;
*data_size = sizeof(AVFrame);
*(AVFrame*)data = c->pic;
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 9b12aa8908..a7a1512b89 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -162,11 +162,23 @@ static void update_lf_deltas(VP8Context *s)
VP56RangeCoder *c = &s->c;
int i;
- for (i = 0; i < 4; i++)
- s->lf_delta.ref[i] = vp8_rac_get_sint(c, 6);
+ for (i = 0; i < 4; i++) {
+ if (vp8_rac_get(c)) {
+ s->lf_delta.ref[i] = vp8_rac_get_uint(c, 6);
+
+ if (vp8_rac_get(c))
+ s->lf_delta.ref[i] = -s->lf_delta.ref[i];
+ }
+ }
+
+ for (i = MODE_I4x4; i <= VP8_MVMODE_SPLIT; i++) {
+ if (vp8_rac_get(c)) {
+ s->lf_delta.mode[i] = vp8_rac_get_uint(c, 6);
- for (i = MODE_I4x4; i <= VP8_MVMODE_SPLIT; i++)
- s->lf_delta.mode[i] = vp8_rac_get_sint(c, 6);
+ if (vp8_rac_get(c))
+ s->lf_delta.mode[i] = -s->lf_delta.mode[i];
+ }
+ }
}
static int setup_partitions(VP8Context *s, const uint8_t *buf, int buf_size)