From 3aa661ec561d7a20812b84b353b0d7855ac346c8 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 1 Oct 2011 17:41:28 +0200 Subject: [PATCH 01/18] h264: improve parsing of broken AVC SPS Parsing the entire NAL as SPS fixes decoding of some AVC bitstreams with broken escaping. Since the size of the NAL unit is known and checked against the buffer end we can parse it entirely without buffer overreads. Fixes playback of http://streams.videolan.org/streams/mp4/Mr_MrsSmith-h264_aac.mp4 Signed-off-by: Janne Grunau --- libavcodec/h264.c | 9 ++++++++- libavcodec/h264_ps.c | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 20aed27fd1..c3ef3f0110 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -3925,7 +3925,14 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ break; case NAL_SPS: init_get_bits(&s->gb, ptr, bit_length); - ff_h264_decode_seq_parameter_set(h); + if (ff_h264_decode_seq_parameter_set(h) < 0 && + h->is_avc && (nalsize != consumed) && nalsize) { + av_log(h->s.avctx, AV_LOG_DEBUG, "SPS decoding failure, " + "try parsing the coomplete NAL\n"); + init_get_bits(&s->gb, buf + buf_index + 1 - consumed, + 8 * (nalsize - 1)); + ff_h264_decode_seq_parameter_set(h); + } if (s->flags& CODEC_FLAG_LOW_DELAY || (h->sps.bitstream_restriction_flag && !h->sps.num_reorder_frames)) diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c index 287702c7c4..276eb77d1d 100644 --- a/libavcodec/h264_ps.c +++ b/libavcodec/h264_ps.c @@ -228,7 +228,6 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps){ get_ue_golomb(&s->gb); /*max_dec_frame_buffering*/ if (get_bits_left(&s->gb) < 0) { - av_log(h->s.avctx, AV_LOG_ERROR, "Overread VUI by %d bits\n", -get_bits_left(&s->gb)); sps->num_reorder_frames=0; sps->bitstream_restriction_flag= 0; } @@ -238,6 +237,10 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps){ return -1; } } + if (get_bits_left(&s->gb) < 0) { + av_log(h->s.avctx, AV_LOG_ERROR, "Overread VUI by %d bits\n", -get_bits_left(&s->gb)); + return AVERROR_INVALIDDATA; + } return 0; } From 015da6e394192c9fde7929fc38d5d5acb805c26c Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Mon, 12 Mar 2012 23:42:53 +0000 Subject: [PATCH 02/18] anm decoder: move buffer allocation from decode_init() to decode_frame() Signed-off-by: Paul B Mahol Signed-off-by: Ronald S. Bultje --- libavcodec/anm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libavcodec/anm.c b/libavcodec/anm.c index 59de984301..46002f80fc 100644 --- a/libavcodec/anm.c +++ b/libavcodec/anm.c @@ -29,6 +29,7 @@ typedef struct AnmContext { AVFrame frame; + int palette[AVPALETTE_COUNT]; int x; ///< x coordinate position } AnmContext; @@ -44,14 +45,10 @@ static av_cold int decode_init(AVCodecContext *avctx) return -1; s->frame.reference = 1; - if (avctx->get_buffer(avctx, &s->frame) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return -1; - } buf = avctx->extradata + 16*8; for (i = 0; i < 256; i++) - ((uint32_t*)s->frame.data[1])[i] = bytestream_get_le32(&buf); + s->palette[i] = bytestream_get_le32(&buf); return 0; } @@ -172,6 +169,8 @@ static int decode_frame(AVCodecContext *avctx, } } while (buf + 1 < buf_end); + memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE); + *data_size = sizeof(AVFrame); *(AVFrame*)data = s->frame; return buf_size; From 29b0d94b43ac960cb442049a5d737a3386ff0337 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Tue, 13 Mar 2012 01:58:12 +0000 Subject: [PATCH 03/18] dfa: convert to bytestream2 API Protects from overreads. Signed-off-by: Paul B Mahol Signed-off-by: Ronald S. Bultje --- libavcodec/dfa.c | 163 +++++++++++++++++++++-------------------------- 1 file changed, 74 insertions(+), 89 deletions(-) diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c index 08bb2a4934..05bc92f1d8 100644 --- a/libavcodec/dfa.c +++ b/libavcodec/dfa.c @@ -21,7 +21,6 @@ */ #include "avcodec.h" -#include "libavutil/intreadwrite.h" #include "bytestream.h" #include "libavutil/lzo.h" // for av_memcpy_backptr @@ -45,19 +44,16 @@ static av_cold int dfa_decode_init(AVCodecContext *avctx) return 0; } -static int decode_copy(uint8_t *frame, int width, int height, - const uint8_t *src, const uint8_t *src_end) +static int decode_copy(GetByteContext *gb, uint8_t *frame, int width, int height) { const int size = width * height; - if (src_end - src < size) + if (bytestream2_get_buffer(gb, frame, size) != size) return -1; - bytestream_get_buffer(&src, frame, size); return 0; } -static int decode_tsw1(uint8_t *frame, int width, int height, - const uint8_t *src, const uint8_t *src_end) +static int decode_tsw1(GetByteContext *gb, uint8_t *frame, int width, int height) { const uint8_t *frame_start = frame; const uint8_t *frame_end = frame + width * height; @@ -65,22 +61,22 @@ static int decode_tsw1(uint8_t *frame, int width, int height, int v, count, segments; unsigned offset; - segments = bytestream_get_le32(&src); - offset = bytestream_get_le32(&src); + segments = bytestream2_get_le32(gb); + offset = bytestream2_get_le32(gb); if (frame_end - frame <= offset) return -1; frame += offset; while (segments--) { + if (bytestream2_get_bytes_left(gb) < 2) + return -1; if (mask == 0x10000) { - if (src >= src_end) - return -1; - bitbuf = bytestream_get_le16(&src); + bitbuf = bytestream2_get_le16u(gb); mask = 1; } - if (src_end - src < 2 || frame_end - frame < 2) + if (frame_end - frame < 2) return -1; if (bitbuf & mask) { - v = bytestream_get_le16(&src); + v = bytestream2_get_le16(gb); offset = (v & 0x1FFF) << 1; count = ((v >> 13) + 2) << 1; if (frame - frame_start < offset || frame_end - frame < count) @@ -88,8 +84,8 @@ static int decode_tsw1(uint8_t *frame, int width, int height, av_memcpy_backptr(frame, offset, count); frame += count; } else { - *frame++ = *src++; - *frame++ = *src++; + *frame++ = bytestream2_get_byte(gb); + *frame++ = bytestream2_get_byte(gb); } mask <<= 1; } @@ -97,26 +93,25 @@ static int decode_tsw1(uint8_t *frame, int width, int height, return 0; } -static int decode_dsw1(uint8_t *frame, int width, int height, - const uint8_t *src, const uint8_t *src_end) +static int decode_dsw1(GetByteContext *gb, uint8_t *frame, int width, int height) { const uint8_t *frame_start = frame; const uint8_t *frame_end = frame + width * height; int mask = 0x10000, bitbuf = 0; int v, offset, count, segments; - segments = bytestream_get_le16(&src); + segments = bytestream2_get_le16(gb); while (segments--) { + if (bytestream2_get_bytes_left(gb) < 2) + return -1; if (mask == 0x10000) { - if (src >= src_end) - return -1; - bitbuf = bytestream_get_le16(&src); + bitbuf = bytestream2_get_le16u(gb); mask = 1; } - if (src_end - src < 2 || frame_end - frame < 2) + if (frame_end - frame < 2) return -1; if (bitbuf & mask) { - v = bytestream_get_le16(&src); + v = bytestream2_get_le16(gb); offset = (v & 0x1FFF) << 1; count = ((v >> 13) + 2) << 1; if (frame - frame_start < offset || frame_end - frame < count) @@ -126,10 +121,10 @@ static int decode_dsw1(uint8_t *frame, int width, int height, frame[v] = frame[v - offset]; frame += count; } else if (bitbuf & (mask << 1)) { - frame += bytestream_get_le16(&src); + frame += bytestream2_get_le16(gb); } else { - *frame++ = *src++; - *frame++ = *src++; + *frame++ = bytestream2_get_byte(gb); + *frame++ = bytestream2_get_byte(gb); } mask <<= 2; } @@ -137,26 +132,25 @@ static int decode_dsw1(uint8_t *frame, int width, int height, return 0; } -static int decode_dds1(uint8_t *frame, int width, int height, - const uint8_t *src, const uint8_t *src_end) +static int decode_dds1(GetByteContext *gb, uint8_t *frame, int width, int height) { const uint8_t *frame_start = frame; const uint8_t *frame_end = frame + width * height; int mask = 0x10000, bitbuf = 0; int i, v, offset, count, segments; - segments = bytestream_get_le16(&src); + segments = bytestream2_get_le16(gb); while (segments--) { + if (bytestream2_get_bytes_left(gb) < 2) + return -1; if (mask == 0x10000) { - if (src >= src_end) - return -1; - bitbuf = bytestream_get_le16(&src); + bitbuf = bytestream2_get_le16u(gb); mask = 1; } - if (src_end - src < 2 || frame_end - frame < 2) + if (frame_end - frame < 2) return -1; if (bitbuf & mask) { - v = bytestream_get_le16(&src); + v = bytestream2_get_le16(gb); offset = (v & 0x1FFF) << 2; count = ((v >> 13) + 2) << 1; if (frame - frame_start < offset || frame_end - frame < count*2 + width) @@ -168,13 +162,13 @@ static int decode_dds1(uint8_t *frame, int width, int height, frame += 2; } } else if (bitbuf & (mask << 1)) { - frame += bytestream_get_le16(&src) * 2; + frame += bytestream2_get_le16(gb) * 2; } else { frame[0] = frame[1] = - frame[width] = frame[width + 1] = *src++; + frame[width] = frame[width + 1] = bytestream2_get_byte(gb); frame += 2; frame[0] = frame[1] = - frame[width] = frame[width + 1] = *src++; + frame[width] = frame[width + 1] = bytestream2_get_byte(gb); frame += 2; } mask <<= 2; @@ -183,40 +177,40 @@ static int decode_dds1(uint8_t *frame, int width, int height, return 0; } -static int decode_bdlt(uint8_t *frame, int width, int height, - const uint8_t *src, const uint8_t *src_end) +static int decode_bdlt(GetByteContext *gb, uint8_t *frame, int width, int height) { uint8_t *line_ptr; int count, lines, segments; - count = bytestream_get_le16(&src); + count = bytestream2_get_le16(gb); if (count >= height) return -1; frame += width * count; - lines = bytestream_get_le16(&src); - if (count + lines > height || src >= src_end) + lines = bytestream2_get_le16(gb); + if (count + lines > height) return -1; while (lines--) { + if (bytestream2_get_bytes_left(gb) < 1) + return -1; line_ptr = frame; frame += width; - segments = *src++; + segments = bytestream2_get_byteu(gb); while (segments--) { - if (src_end - src < 3) + if (frame - line_ptr <= bytestream2_peek_byte(gb)) return -1; - if (frame - line_ptr <= *src) - return -1; - line_ptr += *src++; - count = (int8_t)*src++; + line_ptr += bytestream2_get_byte(gb); + count = (int8_t)bytestream2_get_byte(gb); if (count >= 0) { - if (frame - line_ptr < count || src_end - src < count) + if (frame - line_ptr < count) + return -1; + if (bytestream2_get_buffer(gb, line_ptr, count) != count) return -1; - bytestream_get_buffer(&src, line_ptr, count); } else { count = -count; - if (frame - line_ptr < count || src >= src_end) + if (frame - line_ptr < count) return -1; - memset(line_ptr, *src++, count); + memset(line_ptr, bytestream2_get_byte(gb), count); } line_ptr += count; } @@ -225,49 +219,49 @@ static int decode_bdlt(uint8_t *frame, int width, int height, return 0; } -static int decode_wdlt(uint8_t *frame, int width, int height, - const uint8_t *src, const uint8_t *src_end) +static int decode_wdlt(GetByteContext *gb, uint8_t *frame, int width, int height) { const uint8_t *frame_end = frame + width * height; uint8_t *line_ptr; int count, i, v, lines, segments; - lines = bytestream_get_le16(&src); - if (lines > height || src >= src_end) + lines = bytestream2_get_le16(gb); + if (lines > height) return -1; while (lines--) { - segments = bytestream_get_le16(&src); + if (bytestream2_get_bytes_left(gb) < 2) + return -1; + segments = bytestream2_get_le16u(gb); while ((segments & 0xC000) == 0xC000) { unsigned delta = -((int16_t)segments * width); if (frame_end - frame <= delta) return -1; frame += delta; - segments = bytestream_get_le16(&src); + segments = bytestream2_get_le16(gb); } if (segments & 0x8000) { frame[width - 1] = segments & 0xFF; - segments = bytestream_get_le16(&src); + segments = bytestream2_get_le16(gb); } line_ptr = frame; frame += width; while (segments--) { - if (src_end - src < 2) + if (frame - line_ptr <= bytestream2_peek_byte(gb)) return -1; - if (frame - line_ptr <= *src) - return -1; - line_ptr += *src++; - count = (int8_t)*src++; + line_ptr += bytestream2_get_byte(gb); + count = (int8_t)bytestream2_get_byte(gb); if (count >= 0) { - if (frame - line_ptr < count*2 || src_end - src < count*2) + if (frame - line_ptr < count * 2) + return -1; + if (bytestream2_get_buffer(gb, line_ptr, count * 2) != count * 2) return -1; - bytestream_get_buffer(&src, line_ptr, count*2); line_ptr += count * 2; } else { count = -count; - if (frame - line_ptr < count*2 || src_end - src < 2) + if (frame - line_ptr < count * 2) return -1; - v = bytestream_get_le16(&src); + v = bytestream2_get_le16(gb); for (i = 0; i < count; i++) bytestream_put_le16(&line_ptr, v); } @@ -277,22 +271,19 @@ static int decode_wdlt(uint8_t *frame, int width, int height, return 0; } -static int decode_unk6(uint8_t *frame, int width, int height, - const uint8_t *src, const uint8_t *src_end) +static int decode_unk6(GetByteContext *gb, uint8_t *frame, int width, int height) { return -1; } -static int decode_blck(uint8_t *frame, int width, int height, - const uint8_t *src, const uint8_t *src_end) +static int decode_blck(GetByteContext *gb, uint8_t *frame, int width, int height) { memset(frame, 0, width * height); return 0; } -typedef int (*chunk_decoder)(uint8_t *frame, int width, int height, - const uint8_t *src, const uint8_t *src_end); +typedef int (*chunk_decoder)(GetByteContext *gb, uint8_t *frame, int width, int height); static const chunk_decoder decoder[8] = { decode_copy, decode_tsw1, decode_bdlt, decode_wdlt, @@ -308,9 +299,8 @@ static int dfa_decode_frame(AVCodecContext *avctx, AVPacket *avpkt) { DfaContext *s = avctx->priv_data; + GetByteContext gb; const uint8_t *buf = avpkt->data; - const uint8_t *buf_end = avpkt->data + avpkt->size; - const uint8_t *tmp_buf; uint32_t chunk_type, chunk_size; uint8_t *dst; int ret; @@ -324,27 +314,22 @@ static int dfa_decode_frame(AVCodecContext *avctx, return ret; } - while (buf < buf_end) { - chunk_size = AV_RL32(buf + 4); - chunk_type = AV_RL32(buf + 8); - buf += 12; - if (buf_end - buf < chunk_size) { - av_log(avctx, AV_LOG_ERROR, "Chunk size is too big (%d bytes)\n", chunk_size); - return -1; - } + bytestream2_init(&gb, avpkt->data, avpkt->size); + while (bytestream2_get_bytes_left(&gb) > 0) { + bytestream2_skip(&gb, 4); + chunk_size = bytestream2_get_le32(&gb); + chunk_type = bytestream2_get_le32(&gb); if (!chunk_type) break; if (chunk_type == 1) { pal_elems = FFMIN(chunk_size / 3, 256); - tmp_buf = buf; for (i = 0; i < pal_elems; i++) { - s->pal[i] = bytestream_get_be24(&tmp_buf) << 2; + s->pal[i] = bytestream2_get_be24(&gb) << 2; s->pal[i] |= (s->pal[i] >> 6) & 0x333; } s->pic.palette_has_changed = 1; } else if (chunk_type <= 9) { - if (decoder[chunk_type - 2](s->frame_buf, avctx->width, avctx->height, - buf, buf + chunk_size)) { + if (decoder[chunk_type - 2](&gb, s->frame_buf, avctx->width, avctx->height)) { av_log(avctx, AV_LOG_ERROR, "Error decoding %s chunk\n", chunk_name[chunk_type - 2]); return -1; From 6efe1807825f98caa041a74d486580e70742a02b Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Tue, 13 Mar 2012 03:09:25 +0000 Subject: [PATCH 04/18] FATE: add shorthand to wavpack test Signed-off-by: Paul B Mahol Signed-off-by: Ronald S. Bultje --- tests/fate/wavpack.mak | 55 ++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/tests/fate/wavpack.mak b/tests/fate/wavpack.mak index 2807b26e95..bf18954877 100644 --- a/tests/fate/wavpack.mak +++ b/tests/fate/wavpack.mak @@ -1,87 +1,90 @@ # Lossless -FATE_TESTS += fate-wavpack-lossless-float +FATE_WAVPACK += fate-wavpack-lossless-float fate-wavpack-lossless-float: CMD = md5 -i $(SAMPLES)/wavpack/lossless/32bit_float-partial.wv -f f32le -FATE_TESTS += fate-wavpack-lossless-8bit +FATE_WAVPACK += fate-wavpack-lossless-8bit fate-wavpack-lossless-8bit: CMD = md5 -i $(SAMPLES)/wavpack/lossless/8bit-partial.wv -f s8 -FATE_TESTS += fate-wavpack-lossless-12bit +FATE_WAVPACK += fate-wavpack-lossless-12bit fate-wavpack-lossless-12bit: CMD = md5 -i $(SAMPLES)/wavpack/lossless/12bit-partial.wv -f s16le -FATE_TESTS += fate-wavpack-lossless-16bit +FATE_WAVPACK += fate-wavpack-lossless-16bit fate-wavpack-lossless-16bit: CMD = md5 -i $(SAMPLES)/wavpack/lossless/16bit-partial.wv -f s16le -FATE_TESTS += fate-wavpack-lossless-24bit +FATE_WAVPACK += fate-wavpack-lossless-24bit fate-wavpack-lossless-24bit: CMD = md5 -i $(SAMPLES)/wavpack/lossless/24bit-partial.wv -f s24le -FATE_TESTS += fate-wavpack-lossless-32bit +FATE_WAVPACK += fate-wavpack-lossless-32bit fate-wavpack-lossless-32bit: CMD = md5 -i $(SAMPLES)/wavpack/lossless/32bit_int-partial.wv -f s32le # Lossy -FATE_TESTS += fate-wavpack-lossy-float +FATE_WAVPACK += fate-wavpack-lossy-float fate-wavpack-lossy-float: CMD = md5 -i $(SAMPLES)/wavpack/lossy/2.0_32-bit_float.wv -f f32le -FATE_TESTS += fate-wavpack-lossy-8bit +FATE_WAVPACK += fate-wavpack-lossy-8bit fate-wavpack-lossy-8bit: CMD = md5 -i $(SAMPLES)/wavpack/lossy/4.0_8-bit.wv -f s8 -FATE_TESTS += fate-wavpack-lossy-16bit +FATE_WAVPACK += fate-wavpack-lossy-16bit fate-wavpack-lossy-16bit: CMD = md5 -i $(SAMPLES)/wavpack/lossy/4.0_16-bit.wv -f s16le -FATE_TESTS += fate-wavpack-lossy-24bit +FATE_WAVPACK += fate-wavpack-lossy-24bit fate-wavpack-lossy-24bit: CMD = md5 -i $(SAMPLES)/wavpack/lossy/4.0_24-bit.wv -f s24le -FATE_TESTS += fate-wavpack-lossy-32bit +FATE_WAVPACK += fate-wavpack-lossy-32bit fate-wavpack-lossy-32bit: CMD = md5 -i $(SAMPLES)/wavpack/lossy/4.0_32-bit_int.wv -f s32le # Channel configurations -FATE_TESTS += fate-wavpack-channels-monofloat +FATE_WAVPACK += fate-wavpack-channels-monofloat fate-wavpack-channels-monofloat: CMD = md5 -i $(SAMPLES)/wavpack/num_channels/mono_float-partial.wv -f f32le -FATE_TESTS += fate-wavpack-channels-monoint +FATE_WAVPACK += fate-wavpack-channels-monoint fate-wavpack-channels-monoint: CMD = md5 -i $(SAMPLES)/wavpack/num_channels/mono_16bit_int.wv -f s16le -FATE_TESTS += fate-wavpack-channels-4.0 +FATE_WAVPACK += fate-wavpack-channels-4.0 fate-wavpack-channels-4.0: CMD = md5 -i $(SAMPLES)/wavpack/num_channels/edward_4.0_16bit-partial.wv -f s16le -FATE_TESTS += fate-wavpack-channels-5.1 +FATE_WAVPACK += fate-wavpack-channels-5.1 fate-wavpack-channels-5.1: CMD = md5 -i $(SAMPLES)/wavpack/num_channels/panslab_sample_5.1_16bit-partial.wv -f s16le -FATE_TESTS += fate-wavpack-channels-6.1 +FATE_WAVPACK += fate-wavpack-channels-6.1 fate-wavpack-channels-6.1: CMD = md5 -i $(SAMPLES)/wavpack/num_channels/eva_2.22_6.1_16bit-partial.wv -f s16le -FATE_TESTS += fate-wavpack-channels-7.1 +FATE_WAVPACK += fate-wavpack-channels-7.1 fate-wavpack-channels-7.1: CMD = md5 -i $(SAMPLES)/wavpack/num_channels/panslab_sample_7.1_16bit-partial.wv -f s16le # Speed modes -FATE_TESTS += fate-wavpack-speed-default +FATE_WAVPACK += fate-wavpack-speed-default fate-wavpack-speed-default: CMD = md5 -i $(SAMPLES)/wavpack/speed_modes/default-partial.wv -f s16le -FATE_TESTS += fate-wavpack-speed-fast +FATE_WAVPACK += fate-wavpack-speed-fast fate-wavpack-speed-fast: CMD = md5 -i $(SAMPLES)/wavpack/speed_modes/fast-partial.wv -f s16le -FATE_TESTS += fate-wavpack-speed-high +FATE_WAVPACK += fate-wavpack-speed-high fate-wavpack-speed-high: CMD = md5 -i $(SAMPLES)/wavpack/speed_modes/high-partial.wv -f s16le -FATE_TESTS += fate-wavpack-speed-vhigh +FATE_WAVPACK += fate-wavpack-speed-vhigh fate-wavpack-speed-vhigh: CMD = md5 -i $(SAMPLES)/wavpack/speed_modes/vhigh-partial.wv -f s16le # Special Cases -FATE_TESTS += fate-wavpack-cuesheet +FATE_WAVPACK += fate-wavpack-cuesheet fate-wavpack-cuesheet: CMD = md5 -i $(SAMPLES)/wavpack/special/cue_sheet.wv -f s16le -FATE_TESTS += fate-wavpack-zerolsbs +FATE_WAVPACK += fate-wavpack-zerolsbs fate-wavpack-zerolsbs: CMD = md5 -i $(SAMPLES)/wavpack/special/zero_lsbs.wv -f s16le -FATE_TESTS += fate-wavpack-clipping +FATE_WAVPACK += fate-wavpack-clipping fate-wavpack-clipping: CMD = md5 -i $(SAMPLES)/wavpack/special/clipping.wv -f s16le -FATE_TESTS += fate-wavpack-falsestereo +FATE_WAVPACK += fate-wavpack-falsestereo fate-wavpack-falsestereo: CMD = md5 -i $(SAMPLES)/wavpack/special/false_stereo.wv -f s16le -FATE_TESTS += fate-wavpack-matroskamode +FATE_WAVPACK += fate-wavpack-matroskamode fate-wavpack-matroskamode: CMD = md5 -i $(SAMPLES)/wavpack/special/matroska_mode.mka -f s16le + +FATE_TESTS += $(FATE_WAVPACK) +fate-wavpack: $(FATE_WAVPACK) From b2b0aa70ea09e7f8656a3cf7923982f9f886a44f Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Fri, 20 Jan 2012 15:19:24 +0100 Subject: [PATCH 05/18] dxva2_vc1: fix decoding of BI frames Signed-off-by: Anton Khirnov --- libavcodec/dxva2_vc1.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c index 64447ad87a..53c205e5d6 100644 --- a/libavcodec/dxva2_vc1.c +++ b/libavcodec/dxva2_vc1.c @@ -42,11 +42,11 @@ static void fill_picture_parameters(AVCodecContext *avctx, memset(pp, 0, sizeof(*pp)); pp->wDecodedPictureIndex = pp->wDeblockedPictureIndex = ff_dxva2_get_surface_index(ctx, current_picture); - if (s->pict_type != AV_PICTURE_TYPE_I) + if (s->pict_type != AV_PICTURE_TYPE_I && !v->bi_type) pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, &s->last_picture); else pp->wForwardRefPictureIndex = 0xffff; - if (s->pict_type == AV_PICTURE_TYPE_B) + if (s->pict_type == AV_PICTURE_TYPE_B && !v->bi_type) pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, &s->next_picture); else pp->wBackwardRefPictureIndex = 0xffff; @@ -69,8 +69,8 @@ static void fill_picture_parameters(AVCodecContext *avctx, if (s->picture_structure & PICT_BOTTOM_FIELD) pp->bPicStructure |= 0x02; pp->bSecondField = v->interlace && v->fcm != ILACE_FIELD && !s->first_field; - pp->bPicIntra = s->pict_type == AV_PICTURE_TYPE_I; - pp->bPicBackwardPrediction = s->pict_type == AV_PICTURE_TYPE_B; + pp->bPicIntra = s->pict_type == AV_PICTURE_TYPE_I || v->bi_type; + pp->bPicBackwardPrediction = s->pict_type == AV_PICTURE_TYPE_B && !v->bi_type; pp->bBidirectionalAveragingMode = (1 << 7) | ((ctx->cfg->ConfigIntraResidUnsigned != 0) << 6) | ((ctx->cfg->ConfigResidDiffAccelerator != 0) << 5) | From 7103c8350a1cb0c9fa574d9ccaa09ce5f53dbfe5 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Fri, 20 Jan 2012 15:19:44 +0100 Subject: [PATCH 06/18] dxva2_vc1: pass the overlap flag to the decoder Signed-off-by: Anton Khirnov --- libavcodec/dxva2_vc1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c index 53c205e5d6..2b0480baa9 100644 --- a/libavcodec/dxva2_vc1.c +++ b/libavcodec/dxva2_vc1.c @@ -101,7 +101,8 @@ static void fill_picture_parameters(AVCodecContext *avctx, (v->rangered << 3) | (s->max_b_frames ); pp->bPicExtrapolation = (!v->interlace || v->fcm == PROGRESSIVE) ? 1 : 2; - pp->bPicDeblocked = ((v->profile != PROFILE_ADVANCED && v->rangeredfrm) << 5) | + pp->bPicDeblocked = ((!pp->bPicBackwardPrediction && v->overlap) << 6) | + ((v->profile != PROFILE_ADVANCED && v->rangeredfrm) << 5) | (s->loop_filter << 1); pp->bPicDeblockConfined = (v->postprocflag << 7) | (v->broadcast << 6) | From 8a3360d18ab148fad6b32b4a8e710f84cd9a45d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 12 Mar 2012 13:59:36 +0200 Subject: [PATCH 07/18] httpauth: Parse the stale field in digest auth MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavformat/httpauth.c | 10 ++++++++++ libavformat/httpauth.h | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/libavformat/httpauth.c b/libavformat/httpauth.c index 4383585db1..c1cf019eda 100644 --- a/libavformat/httpauth.c +++ b/libavformat/httpauth.c @@ -57,6 +57,9 @@ static void handle_digest_params(HTTPAuthState *state, const char *key, } else if (!strncmp(key, "qop=", key_len)) { *dest = digest->qop; *dest_len = sizeof(digest->qop); + } else if (!strncmp(key, "stale=", key_len)) { + *dest = digest->stale; + *dest_len = sizeof(digest->stale); } } @@ -93,6 +96,7 @@ void ff_http_auth_handle_header(HTTPAuthState *state, const char *key, state->auth_type <= HTTP_AUTH_BASIC) { state->auth_type = HTTP_AUTH_BASIC; state->realm[0] = 0; + state->stale = 0; ff_parse_key_value(p, (ff_parse_key_val_cb) handle_basic_params, state); } else if (av_stristart(value, "Digest ", &p) && @@ -100,10 +104,13 @@ void ff_http_auth_handle_header(HTTPAuthState *state, const char *key, state->auth_type = HTTP_AUTH_DIGEST; memset(&state->digest_params, 0, sizeof(DigestParams)); state->realm[0] = 0; + state->stale = 0; ff_parse_key_value(p, (ff_parse_key_val_cb) handle_digest_params, state); choose_qop(state->digest_params.qop, sizeof(state->digest_params.qop)); + if (!av_strcasecmp(state->digest_params.stale, "true")) + state->stale = 1; } } else if (!strcmp(key, "Authentication-Info")) { ff_parse_key_value(value, (ff_parse_key_val_cb) handle_digest_update, @@ -237,6 +244,9 @@ char *ff_http_auth_create_response(HTTPAuthState *state, const char *auth, { char *authstr = NULL; + /* Clear the stale flag, we assume the auth is ok now. It is reset + * by the server headers if there's a new issue. */ + state->stale = 0; if (!auth || !strchr(auth, ':')) return NULL; diff --git a/libavformat/httpauth.h b/libavformat/httpauth.h index d2a4a55305..bd0644906a 100644 --- a/libavformat/httpauth.h +++ b/libavformat/httpauth.h @@ -41,6 +41,9 @@ typedef struct { char opaque[300]; /**< A server-specified string that should be * included in authentication responses, not * included in the actual digest calculation. */ + char stale[10]; /**< The server indicated that the auth was ok, + * but needs to be redone with a new, non-stale + * nonce. */ int nc; /**< Nonce count, the number of earlier replies * where this particular nonce has been used. */ } DigestParams; @@ -62,6 +65,10 @@ typedef struct { * The parameters specifiec to digest authentication. */ DigestParams digest_params; + /** + * Auth ok, but needs to be resent with a new nonce. + */ + int stale; } HTTPAuthState; void ff_http_auth_handle_header(HTTPAuthState *state, const char *key, From 2f96cc1fc41f2d3a349d55f9d2078694a6a87dc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 12 Mar 2012 13:59:53 +0200 Subject: [PATCH 08/18] rtsp: Retry authentication if failed due to being stale MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavformat/rtsp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 4290abbdc1..ecc1cbafef 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1122,7 +1122,7 @@ int ff_rtsp_send_cmd_with_content(AVFormatContext *s, { RTSPState *rt = s->priv_data; HTTPAuthType cur_auth_type; - int ret; + int ret, attempts = 0; retry: cur_auth_type = rt->auth_state.auth_type; @@ -1133,9 +1133,11 @@ retry: if ((ret = ff_rtsp_read_reply(s, reply, content_ptr, 0, method) ) < 0) return ret; + attempts++; - if (reply->status_code == 401 && cur_auth_type == HTTP_AUTH_NONE && - rt->auth_state.auth_type != HTTP_AUTH_NONE) + if (reply->status_code == 401 && + (cur_auth_type == HTTP_AUTH_NONE || rt->auth_state.stale) && + rt->auth_state.auth_type != HTTP_AUTH_NONE && attempts < 2) goto retry; if (reply->status_code > 400){ From cdf9108b6ae35f597f3a7932b70be7c8cf9bd743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 12 Mar 2012 16:11:22 +0200 Subject: [PATCH 09/18] rtsp: Resend new keepalive commands if they used stale auth MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These commands are sent asynchronously, not waiting for the reply. This reply is parsed later by ff_rtsp_tcp_read_packet or udp_read_packet. If the reply indicates that we used stale authentication and need to use a new nonce, resend a new keepalive command immediately. This is the only request sent asynchronously, so currently there's no other command that needs to be resent in the same way. Signed-off-by: Martin Storsjö --- libavformat/rtspdec.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index 80420aa42d..acae436c13 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -335,7 +335,8 @@ retry: rt->packets++; /* send dummy request to keep TCP connection alive */ - if ((av_gettime() - rt->last_cmd_time) / 1000000 >= rt->timeout / 2) { + if ((av_gettime() - rt->last_cmd_time) / 1000000 >= rt->timeout / 2 || + rt->auth_state.stale) { if (rt->server_type == RTSP_SERVER_WMS || (rt->server_type != RTSP_SERVER_REAL && rt->get_parameter_supported)) { @@ -343,6 +344,10 @@ retry: } else { ff_rtsp_send_cmd_async(s, "OPTIONS", "*", NULL); } + /* The stale flag should be reset when creating the auth response in + * ff_rtsp_send_cmd_async, but reset it here just in case we never + * called the auth code (if we didn't have any credentials set). */ + rt->auth_state.stale = 0; } return 0; From e75bbcf493aeb549d04c56f49406aeee3950d93b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 12 Mar 2012 14:00:16 +0200 Subject: [PATCH 10/18] http: Retry auth if it failed due to being stale MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow up to 4 retries for normal requests, where both the proxy and the target server might need to authenticate. Signed-off-by: Martin Storsjö --- libavformat/http.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/libavformat/http.c b/libavformat/http.c index eea8dedcbc..a768b19fd9 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -93,7 +93,7 @@ static int http_open_cnx(URLContext *h) char auth[1024], proxyauth[1024] = ""; char path1[1024]; char buf[1024], urlbuf[1024]; - int port, use_proxy, err, location_changed = 0, redirects = 0; + int port, use_proxy, err, location_changed = 0, redirects = 0, attempts = 0; HTTPAuthType cur_auth_type, cur_proxy_auth_type; HTTPContext *s = h->priv_data; URLContext *hd = NULL; @@ -145,16 +145,18 @@ static int http_open_cnx(URLContext *h) cur_proxy_auth_type = s->auth_state.auth_type; if (http_connect(h, path, local_path, hoststr, auth, proxyauth, &location_changed) < 0) goto fail; + attempts++; if (s->http_code == 401) { - if (cur_auth_type == HTTP_AUTH_NONE && s->auth_state.auth_type != HTTP_AUTH_NONE) { + if ((cur_auth_type == HTTP_AUTH_NONE || s->auth_state.stale) && + s->auth_state.auth_type != HTTP_AUTH_NONE && attempts < 4) { ffurl_close(hd); goto redo; } else goto fail; } if (s->http_code == 407) { - if (cur_proxy_auth_type == HTTP_AUTH_NONE && - s->proxy_auth_state.auth_type != HTTP_AUTH_NONE) { + if ((cur_proxy_auth_type == HTTP_AUTH_NONE || s->proxy_auth_state.stale) && + s->proxy_auth_state.auth_type != HTTP_AUTH_NONE && attempts < 4) { ffurl_close(hd); goto redo; } else @@ -166,6 +168,7 @@ static int http_open_cnx(URLContext *h) ffurl_close(hd); if (redirects++ >= MAX_REDIRECTS) return AVERROR(EIO); + attempts = 0; location_changed = 0; goto redo; } @@ -598,7 +601,7 @@ static int http_proxy_open(URLContext *h, const char *uri, int flags) char hostname[1024], hoststr[1024]; char auth[1024], pathbuf[1024], *path; char line[1024], lower_url[100]; - int port, ret = 0; + int port, ret = 0, attempts = 0; HTTPAuthType cur_auth_type; char *authstr; @@ -665,8 +668,10 @@ redo: break; s->line_count++; } - if (s->http_code == 407 && cur_auth_type == HTTP_AUTH_NONE && - s->proxy_auth_state.auth_type != HTTP_AUTH_NONE) { + attempts++; + if (s->http_code == 407 && + (cur_auth_type == HTTP_AUTH_NONE || s->proxy_auth_state.stale) && + s->proxy_auth_state.auth_type != HTTP_AUTH_NONE && attempts < 2) { ffurl_close(s->hd); s->hd = NULL; goto redo; From 499ad54d982307a31ef70f6256a9ffccff0057e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 12 Mar 2012 14:03:46 +0200 Subject: [PATCH 11/18] http: Clear the auth state on redirects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently we only try continuing with the same auth mechanism as the initial request. Signed-off-by: Martin Storsjö --- libavformat/http.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/http.c b/libavformat/http.c index a768b19fd9..c69e3f5055 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -168,6 +168,9 @@ static int http_open_cnx(URLContext *h) ffurl_close(hd); if (redirects++ >= MAX_REDIRECTS) return AVERROR(EIO); + /* Restart the authentication process with the new target, which + * might use a different auth mechanism. */ + memset(&s->auth_state, 0, sizeof(s->auth_state)); attempts = 0; location_changed = 0; goto redo; From 9d5c131ecec75fcfb1b4b56f74f2b2756bf0027a Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 12 Mar 2012 17:09:22 +0100 Subject: [PATCH 12/18] libx264: fix help text for slice-max-size option. CC: libav-stable@libav.org --- libavcodec/libx264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index abce6a858d..a3b22aea48 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -506,7 +506,7 @@ static const AVOption options[] = { { "spatial", NULL, 0, AV_OPT_TYPE_CONST, { X264_DIRECT_PRED_SPATIAL }, 0, 0, VE, "direct-pred" }, { "temporal", NULL, 0, AV_OPT_TYPE_CONST, { X264_DIRECT_PRED_TEMPORAL }, 0, 0, VE, "direct-pred" }, { "auto", NULL, 0, AV_OPT_TYPE_CONST, { X264_DIRECT_PRED_AUTO }, 0, 0, VE, "direct-pred" }, - { "slice-max-size","Constant quantization parameter rate control method",OFFSET(slice_max_size), AV_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE }, + { "slice-max-size","Limit the size of each slice in bytes", OFFSET(slice_max_size),AV_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE }, { NULL }, }; From d533e395e14d403948ca2424efbcee92429ef8e1 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 12 Mar 2012 17:20:20 +0100 Subject: [PATCH 13/18] libx264: add 'stats' private option for setting 2pass stats filename. x264 always opens the file itself with fopen, so we cannot use the standard lavc stats mechanism. CC: libav-stable@libav.org --- libavcodec/libx264.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index a3b22aea48..fdde630991 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -66,6 +66,7 @@ typedef struct X264Context { char *partitions; int direct_pred; int slice_max_size; + char *stats; } X264Context; static void X264_log(void *p, int level, const char *fmt, va_list args) @@ -325,6 +326,7 @@ static av_cold int X264_init(AVCodecContext *avctx) PARSE_X264_OPT("psy-rd", psy_rd); PARSE_X264_OPT("deblock", deblock); PARSE_X264_OPT("partitions", partitions); + PARSE_X264_OPT("stats", stats); if (x4->psy >= 0) x4->params.analyse.b_psy = x4->psy; if (x4->rc_lookahead >= 0) @@ -507,6 +509,7 @@ static const AVOption options[] = { { "temporal", NULL, 0, AV_OPT_TYPE_CONST, { X264_DIRECT_PRED_TEMPORAL }, 0, 0, VE, "direct-pred" }, { "auto", NULL, 0, AV_OPT_TYPE_CONST, { X264_DIRECT_PRED_AUTO }, 0, 0, VE, "direct-pred" }, { "slice-max-size","Limit the size of each slice in bytes", OFFSET(slice_max_size),AV_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE }, + { "stats", "Filename for 2 pass stats", OFFSET(stats), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, { NULL }, }; From 6e8be949f12734f38d360aad0f5c503a0f9606fa Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 12 Mar 2012 17:42:57 +0100 Subject: [PATCH 14/18] avconv: link '-passlogfile' option to libx264 'stats' AVOption. Fixes bug 204. CC: libav-stable@libav.org --- avconv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/avconv.c b/avconv.c index 53a7661640..518f8b8c8e 100644 --- a/avconv.c +++ b/avconv.c @@ -2497,6 +2497,9 @@ static int transcode_init(OutputFile *output_files, snprintf(logfilename, sizeof(logfilename), "%s-%d.log", pass_logfilename_prefix ? pass_logfilename_prefix : DEFAULT_PASS_LOGFILENAME_PREFIX, i); + if (!strcmp(ost->enc->name, "libx264")) { + av_dict_set(&ost->opts, "stats", logfilename, AV_DICT_DONT_OVERWRITE); + } else { if (codec->flags & CODEC_FLAG_PASS1) { f = fopen(logfilename, "wb"); if (!f) { @@ -2515,6 +2518,7 @@ static int transcode_init(OutputFile *output_files, } codec->stats_in = logbuffer; } + } } } } From 64334ddbbc7fce490c895c54106291d0b128e830 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 12 Mar 2012 17:43:48 +0100 Subject: [PATCH 15/18] avconv: reindent CC: libav-stable@libav.org --- avconv.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/avconv.c b/avconv.c index 518f8b8c8e..aebb510c41 100644 --- a/avconv.c +++ b/avconv.c @@ -2500,24 +2500,24 @@ static int transcode_init(OutputFile *output_files, if (!strcmp(ost->enc->name, "libx264")) { av_dict_set(&ost->opts, "stats", logfilename, AV_DICT_DONT_OVERWRITE); } else { - if (codec->flags & CODEC_FLAG_PASS1) { - f = fopen(logfilename, "wb"); - if (!f) { - av_log(NULL, AV_LOG_FATAL, "Cannot write log file '%s' for pass-1 encoding: %s\n", - logfilename, strerror(errno)); - exit_program(1); + if (codec->flags & CODEC_FLAG_PASS1) { + f = fopen(logfilename, "wb"); + if (!f) { + av_log(NULL, AV_LOG_FATAL, "Cannot write log file '%s' for pass-1 encoding: %s\n", + logfilename, strerror(errno)); + exit_program(1); + } + ost->logfile = f; + } else { + char *logbuffer; + size_t logbuffer_size; + if (cmdutils_read_file(logfilename, &logbuffer, &logbuffer_size) < 0) { + av_log(NULL, AV_LOG_FATAL, "Error reading log file '%s' for pass-2 encoding\n", + logfilename); + exit_program(1); + } + codec->stats_in = logbuffer; } - ost->logfile = f; - } else { - char *logbuffer; - size_t logbuffer_size; - if (cmdutils_read_file(logfilename, &logbuffer, &logbuffer_size) < 0) { - av_log(NULL, AV_LOG_FATAL, "Error reading log file '%s' for pass-2 encoding\n", - logfilename); - exit_program(1); - } - codec->stats_in = logbuffer; - } } } } From 758ec111538ccd487686e8677aa754ee4d82beaa Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 12 Mar 2012 18:26:50 -0700 Subject: [PATCH 16/18] h264: Fix invalid interlaced/progressive MB combinations for direct mode prediction. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org Signed-off-by: Ronald S. Bultje --- libavcodec/h264_direct.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavcodec/h264_direct.c b/libavcodec/h264_direct.c index 9010cacfd9..cc6e01861f 100644 --- a/libavcodec/h264_direct.c +++ b/libavcodec/h264_direct.c @@ -253,6 +253,10 @@ static void pred_spatial_direct_motion(H264Context * const h, int *mb_type){ mb_type_col[1] = h->ref_list[1][0].f.mb_type[mb_xy + s->mb_stride]; b8_stride = 2+4*s->mb_stride; b4_stride *= 6; + if (IS_INTERLACED(mb_type_col[0]) != IS_INTERLACED(mb_type_col[1])) { + mb_type_col[0] &= ~MB_TYPE_INTERLACED; + mb_type_col[1] &= ~MB_TYPE_INTERLACED; + } sub_mb_type |= MB_TYPE_16x16|MB_TYPE_DIRECT2; /* B_SUB_8x8 */ if( (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA) @@ -439,6 +443,10 @@ static void pred_temp_direct_motion(H264Context * const h, int *mb_type){ mb_type_col[1] = h->ref_list[1][0].f.mb_type[mb_xy + s->mb_stride]; b8_stride = 2+4*s->mb_stride; b4_stride *= 6; + if (IS_INTERLACED(mb_type_col[0]) != IS_INTERLACED(mb_type_col[1])) { + mb_type_col[0] &= ~MB_TYPE_INTERLACED; + mb_type_col[1] &= ~MB_TYPE_INTERLACED; + } sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */ From 29e4046e831e3a9dde3572752ba592e6d9ca9eac Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 13 Mar 2012 12:39:05 +0100 Subject: [PATCH 17/18] doc/general: add missing @tab to codecs table. --- doc/general.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/general.texi b/doc/general.texi index 9f3108129b..14db80285f 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -529,7 +529,7 @@ following image formats are supported: @item MPEG-1/2 video (VDPAU acceleration) @tab @tab X @item MPEG-2 video @tab X @tab X @item MPEG-4 part 2 @tab X @tab X - @ libxvidcore can be used alternatively for encoding. + @tab libxvidcore can be used alternatively for encoding. @item MPEG-4 part 2 Microsoft variant version 1 @tab @tab X @item MPEG-4 part 2 Microsoft variant version 2 @tab X @tab X @item MPEG-4 part 2 Microsoft variant version 3 @tab X @tab X From 972880f597d74673a04d3ea8540864ae715ce9a6 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 13 Mar 2012 12:43:47 +0100 Subject: [PATCH 18/18] doc/general: update supported devices table. Add libcdio and fbdev, remove v4l1. --- doc/general.texi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/general.texi b/doc/general.texi index 14db80285f..d3b31778f3 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -819,11 +819,12 @@ performance on systems without hardware floating point support). @item ALSA @tab X @tab X @item BKTR @tab X @tab @item DV1394 @tab X @tab +@item Linux framebuffer @tab X @tab @item JACK @tab X @tab +@item LIBCDIO @tab X @item LIBDC1394 @tab X @tab @item OSS @tab X @tab X @item Pulseaudio @tab X @tab -@item Video4Linux @tab X @tab @item Video4Linux2 @tab X @tab @item VfW capture @tab X @tab @item X11 grabbing @tab X @tab