History

Merge remote-tracking branch 'qatar/master'

* qatar/master: (22 commits) frwu: Employ more meaningful return values. fraps: Use av_fast_padded_malloc() instead of av_realloc() mjpegdec: use av_fast_padded_malloc() eatqi: use av_fast_padded_malloc() asv1: use av_fast_padded_malloc() avcodec: Add av_fast_padded_malloc(). swscale: enable dithering in MMX functions. swscale: make rgb24 function macros slightly smaller. avcodec.h: Remove some disabled cruft. swscale: remove obsolete comment. swscale-test: Drop unused argc and argv arguments from main(). zmbv: Employ more meaningful return values. zmbvenc: Employ more meaningful return values. vc1: prevent null pointer dereference on broken files zmbv: check av_realloc() return values and avoid memleaks on ENOMEM truespeech: align buffer ac3: Do not read past the end of ff_ac3_band_start_tab. dv: Fix small stack overread related to CVE-2011-3929 and CVE-2011-3936. dv: Fix null pointer dereference due to ach=0 dv: check stype ... Conflicts: doc/APIchanges libavcodec/asv1.c libavcodec/avcodec.h libavcodec/eatqi.c libavcodec/fraps.c libavcodec/frwu.c libavcodec/zmbv.c libavformat/dv.c libswscale/swscale.c

Michael Niedermayer committed 14 years ago

Commit 4c677df2 parents 5cd8afe 5ff880219 files · +122 −115Browse files

Unified · Split

19 files
  1. doc/APIchanges +5 −0
  2. libavcodec/ac3dsp.c +5 −3
  3. libavcodec/asv1.c +2 −1
  4. libavcodec/avcodec.h +3 −28
  5. libavcodec/eatqi.c +2 −1
  6. libavcodec/frwu.c +11 −9
  7. libavcodec/golomb-test.c +44 −16
  8. libavcodec/truespeech.c +1 −1
  9. libavcodec/utils.c +4 −4
  10. libavcodec/vc1dec.c +1 −1
  11. libavcodec/zmbv.c +22 −21
  12. libavcodec/zmbvenc.c +4 −4
  13. libavformat/dv.c +1 −2
  14. libavformat/swfdec.c +1 −4
  15. libswscale/swscale.c +0 −2
  16. libswscale/x86/input.asm +13 −16
  17. libswscale/x86/swscale_mmx.c +2 −0
  18. tests/fate/libavcodec.mak +1 −0
  19. tests/ref/fate/golomb +0 −2
doc/APIchanges+5−0
@@ -16,6 +16,11 @@ API changes, most recent first: · 15 unmodified lines
162012-01-24 - xxxxxxx - lavfi 2.60.100162012-01-24 - xxxxxxx - lavfi 2.60.100
17 Add avfilter_graph_dump.17 Add avfilter_graph_dump.
18 18
192012-02-01 - xxxxxxx - lavc 54.01.0
20 Add av_fast_padded_malloc() as alternative for av_realloc() when aligned
21 memory is required. The buffer will always have FF_INPUT_BUFFER_PADDING_SIZE
22 zero-padded bytes at the end.
23
192012-01-31 - xxxxxxx - lavf 54.01.0242012-01-31 - xxxxxxx - lavf 54.01.0
20 Add avformat_get_riff_video_tags() and avformat_get_riff_audio_tags().25 Add avformat_get_riff_video_tags() and avformat_get_riff_audio_tags().
21 26
libavcodec/ac3dsp.c+5−3
@@ -109,7 +109,7 @@ static void ac3_bit_alloc_calc_bap_c(int16_t *mask, int16_t *psd, · 108 unmodified lines
109 int snr_offset, int floor,109 int snr_offset, int floor,
110 const uint8_t *bap_tab, uint8_t *bap)110 const uint8_t *bap_tab, uint8_t *bap)
111{111{
112 int bin, band;112 int bin, band, band_end;
113 113
114 /* special case, if snr offset is -960, set all bap's to zero */114 /* special case, if snr offset is -960, set all bap's to zero */
115 if (snr_offset == -960) {115 if (snr_offset == -960) {
@@ -121,12 +121,14 @@ static void ac3_bit_alloc_calc_bap_c(int16_t *mask, int16_t *psd, · 5 unmodified lines
121 band = ff_ac3_bin_to_band_tab[start];121 band = ff_ac3_bin_to_band_tab[start];
122 do {122 do {
123 int m = (FFMAX(mask[band] - snr_offset - floor, 0) & 0x1FE0) + floor;123 int m = (FFMAX(mask[band] - snr_offset - floor, 0) & 0x1FE0) + floor;
124 int band_end = FFMIN(ff_ac3_band_start_tab[band+1], end);124 band_end = ff_ac3_band_start_tab[++band];
125 band_end = FFMIN(band_end, end);
126
125 for (; bin < band_end; bin++) {127 for (; bin < band_end; bin++) {
126 int address = av_clip((psd[bin] - m) >> 5, 0, 63);128 int address = av_clip((psd[bin] - m) >> 5, 0, 63);
127 bap[bin] = bap_tab[address];129 bap[bin] = bap_tab[address];
128 }130 }
129 } while (end > ff_ac3_band_start_tab[band++]);131 } while (end > band_end);
130}132}
131 133
132static void ac3_update_bap_counts_c(uint16_t mant_cnt[16], uint8_t *bap,134static void ac3_update_bap_counts_c(uint16_t mant_cnt[16], uint8_t *bap,
libavcodec/asv1.c+2−1
@@ -408,7 +408,8 @@ static int decode_frame(AVCodecContext *avctx, · 407 unmodified lines
408 p->pict_type= AV_PICTURE_TYPE_I;408 p->pict_type= AV_PICTURE_TYPE_I;
409 p->key_frame= 1;409 p->key_frame= 1;
410 410
411 av_fast_padded_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size, buf_size);411 av_fast_padded_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size,
412 buf_size);
412 if (!a->bitstream_buffer)413 if (!a->bitstream_buffer)
413 return AVERROR(ENOMEM);414 return AVERROR(ENOMEM);
414 415
libavcodec/avcodec.h+3−28
@@ -185,9 +185,6 @@ enum CodecID { · 184 unmodified lines
185 CODEC_ID_TIERTEXSEQVIDEO,185 CODEC_ID_TIERTEXSEQVIDEO,
186 CODEC_ID_TIFF,186 CODEC_ID_TIFF,
187 CODEC_ID_GIF,187 CODEC_ID_GIF,
188#if LIBAVCODEC_VERSION_MAJOR == 53
189 CODEC_ID_FFH264,
190#endif
191 CODEC_ID_DXA,188 CODEC_ID_DXA,
192 CODEC_ID_DNXHD,189 CODEC_ID_DNXHD,
193 CODEC_ID_THP,190 CODEC_ID_THP,
@@ -205,10 +202,6 @@ enum CodecID { · 11 unmodified lines
205 CODEC_ID_INDEO5,202 CODEC_ID_INDEO5,
206 CODEC_ID_MIMIC,203 CODEC_ID_MIMIC,
207 CODEC_ID_RL2,204 CODEC_ID_RL2,
208#if LIBAVCODEC_VERSION_MAJOR == 53
209 CODEC_ID_8SVX_EXP,
210 CODEC_ID_8SVX_FIB,
211#endif
212 CODEC_ID_ESCAPE124,205 CODEC_ID_ESCAPE124,
213 CODEC_ID_DIRAC,206 CODEC_ID_DIRAC,
214 CODEC_ID_BFI,207 CODEC_ID_BFI,
@@ -247,18 +240,13 @@ enum CodecID { · 32 unmodified lines
247 CODEC_ID_DFA,240 CODEC_ID_DFA,
248 CODEC_ID_WMV3IMAGE,241 CODEC_ID_WMV3IMAGE,
249 CODEC_ID_VC1IMAGE,242 CODEC_ID_VC1IMAGE,
250#if LIBAVCODEC_VERSION_MAJOR == 53243 CODEC_ID_UTVIDEO,
251 CODEC_ID_G723_1_DEPRECATED,
252 CODEC_ID_G729_DEPRECATED,
253#endif
254 CODEC_ID_UTVIDEO_DEPRECATED,
255 CODEC_ID_BMV_VIDEO,244 CODEC_ID_BMV_VIDEO,
256 CODEC_ID_VBLE,245 CODEC_ID_VBLE,
257 CODEC_ID_DXTORY,246 CODEC_ID_DXTORY,
258 CODEC_ID_V410,247 CODEC_ID_V410,
259 CODEC_ID_XWD,248 CODEC_ID_XWD,
260 CODEC_ID_Y41P = MKBETAG('Y','4','1','P'),249 CODEC_ID_Y41P = MKBETAG('Y','4','1','P'),
261 CODEC_ID_UTVIDEO = 0x800,
262 CODEC_ID_ESCAPE130 = MKBETAG('E','1','3','0'),250 CODEC_ID_ESCAPE130 = MKBETAG('E','1','3','0'),
263 CODEC_ID_AVRP = MKBETAG('A','V','R','P'),251 CODEC_ID_AVRP = MKBETAG('A','V','R','P'),
264 252
@@ -397,15 +385,11 @@ enum CodecID { · 132 unmodified lines
397 CODEC_ID_AAC_LATM,385 CODEC_ID_AAC_LATM,
398 CODEC_ID_QDMC,386 CODEC_ID_QDMC,
399 CODEC_ID_CELT,387 CODEC_ID_CELT,
400#if LIBAVCODEC_VERSION_MAJOR > 53388 CODEC_ID_G723_1,
401 CODEC_ID_G723_1_DEPRECATED,389 CODEC_ID_G729,
402 CODEC_ID_G729_DEPRECATED,
403 CODEC_ID_8SVX_EXP,390 CODEC_ID_8SVX_EXP,
404 CODEC_ID_8SVX_FIB,391 CODEC_ID_8SVX_FIB,
405#endif
406 CODEC_ID_BMV_AUDIO,392 CODEC_ID_BMV_AUDIO,
407 CODEC_ID_G729 = 0x15800,
408 CODEC_ID_G723_1= 0x15801,
409 CODEC_ID_FFWAVESYNTH = MKBETAG('F','F','W','S'),393 CODEC_ID_FFWAVESYNTH = MKBETAG('F','F','W','S'),
410 CODEC_ID_8SVX_RAW = MKBETAG('8','S','V','X'),394 CODEC_ID_8SVX_RAW = MKBETAG('8','S','V','X'),
411 CODEC_ID_SONIC = MKBETAG('S','O','N','C'),395 CODEC_ID_SONIC = MKBETAG('S','O','N','C'),
@@ -1523,7 +1507,6 @@ typedef struct AVCodecContext { · 1111 unmodified lines
1523#define FF_BUG_DC_CLIP 40961507#define FF_BUG_DC_CLIP 4096
1524#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders.1508#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders.
1525#define FF_BUG_TRUNCATED 163841509#define FF_BUG_TRUNCATED 16384
1526//#define FF_BUG_FAKE_SCALABILITY 16 //Autodetection should work 100%.
1527 1510
1528 /**1511 /**
1529 * luma single coefficient elimination threshold1512 * luma single coefficient elimination threshold
@@ -2096,14 +2079,6 @@ typedef struct AVCodecContext { · 566 unmodified lines
2096 * - decoding: unused2079 * - decoding: unused
2097 */2080 */
2098 int context_model;2081 int context_model;
2099#if 0
2100 /**
2101 *
2102 * - encoding: unused
2103 * - decoding: Set by user.
2104 */
2105 uint8_t * (*realloc)(struct AVCodecContext *s, uint8_t *buf, int buf_size);
2106#endif
2107 2082
2108 /**2083 /**
2109 * slice flags2084 * slice flags
libavcodec/eatqi.c+2−1
@@ -127,7 +127,8 @@ static int tqi_decode_frame(AVCodecContext *avctx, · 126 unmodified lines
127 return -1;127 return -1;
128 }128 }
129 129
130 av_fast_padded_malloc(&t->bitstream_buf, &t->bitstream_buf_size, buf_end-buf);130 av_fast_padded_malloc(&t->bitstream_buf, &t->bitstream_buf_size,
131 buf_end - buf);
131 if (!t->bitstream_buf)132 if (!t->bitstream_buf)
132 return AVERROR(ENOMEM);133 return AVERROR(ENOMEM);
133 s->dsp.bswap_buf(t->bitstream_buf, (const uint32_t*)buf, (buf_end-buf)/4);134 s->dsp.bswap_buf(t->bitstream_buf, (const uint32_t*)buf, (buf_end-buf)/4);
libavcodec/frwu.c+11−9
@@ -28,7 +28,7 @@ static av_cold int decode_init(AVCodecContext *avctx) · 27 unmodified lines
28{28{
29 if (avctx->width & 1) {29 if (avctx->width & 1) {
30 av_log(avctx, AV_LOG_ERROR, "frwu needs even width\n");30 av_log(avctx, AV_LOG_ERROR, "frwu needs even width\n");
31 return -1;31 return AVERROR(EINVAL);
32 }32 }
33 avctx->pix_fmt = PIX_FMT_UYVY422;33 avctx->pix_fmt = PIX_FMT_UYVY422;
34 34
@@ -42,7 +42,7 @@ static av_cold int decode_init(AVCodecContext *avctx) · 7 unmodified lines
42static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,42static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
43 AVPacket *avpkt)43 AVPacket *avpkt)
44{44{
45 int field;45 int field, ret;
46 AVFrame *pic = avctx->coded_frame;46 AVFrame *pic = avctx->coded_frame;
47 const uint8_t *buf = avpkt->data;47 const uint8_t *buf = avpkt->data;
48 const uint8_t *buf_end = buf + avpkt->size;48 const uint8_t *buf_end = buf + avpkt->size;
@@ -52,16 +52,18 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, · 3 unmodified lines
52 52
53 if (avpkt->size < avctx->width * 2 * avctx->height + 4 + 2*8) {53 if (avpkt->size < avctx->width * 2 * avctx->height + 4 + 2*8) {
54 av_log(avctx, AV_LOG_ERROR, "Packet is too small.\n");54 av_log(avctx, AV_LOG_ERROR, "Packet is too small.\n");
55 return -1;55 return AVERROR_INVALIDDATA;
56 }56 }
57 if (bytestream_get_le32(&buf) != AV_RL32("FRW1")) {57 if (bytestream_get_le32(&buf) != AV_RL32("FRW1")) {
58 av_log(avctx, AV_LOG_ERROR, "incorrect marker\n");58 av_log(avctx, AV_LOG_ERROR, "incorrect marker\n");
59 return -1;59 return AVERROR_INVALIDDATA;
60 }60 }
61 61
62 pic->reference = 0;62 pic->reference = 0;
63 if (avctx->get_buffer(avctx, pic) < 0)63 if ((ret = avctx->get_buffer(avctx, pic)) < 0) {
64 return -1;64 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
65 return ret;
66 }
65 67
66 pic->pict_type = AV_PICTURE_TYPE_I;68 pic->pict_type = AV_PICTURE_TYPE_I;
67 pic->key_frame = 1;69 pic->key_frame = 1;
@@ -74,16 +76,16 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, · 6 unmodified lines
74 int field_size, min_field_size = avctx->width * 2 * field_h;76 int field_size, min_field_size = avctx->width * 2 * field_h;
75 uint8_t *dst = pic->data[0];77 uint8_t *dst = pic->data[0];
76 if (buf_end - buf < 8)78 if (buf_end - buf < 8)
77 return -1;79 return AVERROR_INVALIDDATA;
78 buf += 4; // flags? 0x80 == bottom field maybe?80 buf += 4; // flags? 0x80 == bottom field maybe?
79 field_size = bytestream_get_le32(&buf);81 field_size = bytestream_get_le32(&buf);
80 if (field_size < min_field_size) {82 if (field_size < min_field_size) {
81 av_log(avctx, AV_LOG_ERROR, "Field size %i is too small (required %i)\n", field_size, min_field_size);83 av_log(avctx, AV_LOG_ERROR, "Field size %i is too small (required %i)\n", field_size, min_field_size);
82 return -1;84 return AVERROR_INVALIDDATA;
83 }85 }
84 if (buf_end - buf < field_size) {86 if (buf_end - buf < field_size) {
85 av_log(avctx, AV_LOG_ERROR, "Packet is too small, need %i, have %i\n", field_size, (int)(buf_end - buf));87 av_log(avctx, AV_LOG_ERROR, "Packet is too small, need %i, have %i\n", field_size, (int)(buf_end - buf));
86 return -1;88 return AVERROR_INVALIDDATA;
87 }89 }
88 if (field)90 if (field)
89 dst += pic->linesize[0];91 dst += pic->linesize[0];
libavcodec/golomb-test.c+44−16
@@ -21,52 +21,80 @@ · 20 unmodified lines
21#include <stdint.h>21#include <stdint.h>
22#include <stdio.h>22#include <stdio.h>
23 23
24#include "avcodec.h"24#include "libavutil/mem.h"
25#include "dsputil.h"25
26#include "get_bits.h"26#include "get_bits.h"
27#include "golomb.h"27#include "golomb.h"
28#include "put_bits.h"28#include "put_bits.h"
29 29
30#undef printf30#undef fprintf
31#define COUNT 800031#define COUNT 8191
32#define SIZE (COUNT * 40)32#define SIZE (COUNT * 4)
33 33
34int main(void)34int main(void)
35{35{
36 int i;36 int i, ret = 0;
37 uint8_t temp[SIZE];37 uint8_t *temp;
38 PutBitContext pb;38 PutBitContext pb;
39 GetBitContext gb;39 GetBitContext gb;
40 40
41 temp = av_malloc(SIZE);
42 if (!temp)
43 return 2;
44
41 init_put_bits(&pb, temp, SIZE);45 init_put_bits(&pb, temp, SIZE);
42 printf("testing unsigned exp golomb\n");
43 for (i = 0; i < COUNT; i++)46 for (i = 0; i < COUNT; i++)
44 set_ue_golomb(&pb, i);47 set_ue_golomb(&pb, i);
45 flush_put_bits(&pb);48 flush_put_bits(&pb);
46 49
47 init_get_bits(&gb, temp, 8 * SIZE);50 init_get_bits(&gb, temp, 8 * SIZE);
48 for (i = 0; i < COUNT; i++) {51 for (i = 0; i < COUNT; i++) {
49 int j, s = show_bits(&gb, 24);52 int j, s = show_bits(&gb, 25);
50 53
51 j = get_ue_golomb(&gb);54 j = get_ue_golomb(&gb);
52 if (j != i)55 if (j != i) {
53 printf("mismatch at %d (%d should be %d) bits: %6X\n", i, j, i, s);56 fprintf(stderr, "get_ue_golomb: expected %d, got %d. bits: %7x\n",
57 i, j, s);
58 ret = 1;
59 }
60 }
61
62#define EXTEND(i) (i << 3 | i & 7)
63 init_put_bits(&pb, temp, SIZE);
64 for (i = 0; i < COUNT; i++)
65 set_ue_golomb(&pb, EXTEND(i));
66 flush_put_bits(&pb);
67
68 init_get_bits(&gb, temp, 8 * SIZE);
69 for (i = 0; i < COUNT; i++) {
70 int j, s = show_bits_long(&gb, 32);
71
72 j = get_ue_golomb_long(&gb);
73 if (j != EXTEND(i)) {
74 fprintf(stderr, "get_ue_golomb_long: expected %d, got %d. "
75 "bits: %8x\n", EXTEND(i), j, s);
76 ret = 1;
77 }
54 }78 }
55 79
56 init_put_bits(&pb, temp, SIZE);80 init_put_bits(&pb, temp, SIZE);
57 printf("testing signed exp golomb\n");
58 for (i = 0; i < COUNT; i++)81 for (i = 0; i < COUNT; i++)
59 set_se_golomb(&pb, i - COUNT / 2);82 set_se_golomb(&pb, i - COUNT / 2);
60 flush_put_bits(&pb);83 flush_put_bits(&pb);
61 84
62 init_get_bits(&gb, temp, 8 * SIZE);85 init_get_bits(&gb, temp, 8 * SIZE);
63 for (i = 0; i < COUNT; i++) {86 for (i = 0; i < COUNT; i++) {
64 int j, s = show_bits(&gb, 24);87 int j, s = show_bits(&gb, 25);
65 88
66 j = get_se_golomb(&gb);89 j = get_se_golomb(&gb);
67 if (j != i - COUNT / 2)90 if (j != i - COUNT / 2) {
68 printf("mismatch at %d (%d should be %d) bits: %6X\n", i, j, i, s);91 fprintf(stderr, "get_se_golomb: expected %d, got %d. bits: %7x\n",
92 i - COUNT / 2, j, s);
93 ret = 1;
94 }
69 }95 }
70 96
71 return 0;97 av_free(temp);
98
99 return ret;
72}100}
libavcodec/truespeech.c+1−1
@@ -37,7 +37,7 @@ typedef struct { · 36 unmodified lines
37 AVFrame frame;37 AVFrame frame;
38 DSPContext dsp;38 DSPContext dsp;
39 /* input data */39 /* input data */
40 uint8_t buffer[32];40 DECLARE_ALIGNED(16, uint8_t, buffer)[32];
41 int16_t vector[8]; ///< input vector: 5/5/4/4/4/3/3/341 int16_t vector[8]; ///< input vector: 5/5/4/4/4/3/3/3
42 int offset1[2]; ///< 8-bit value, used in one copying offset42 int offset1[2]; ///< 8-bit value, used in one copying offset
43 int offset2[4]; ///< 7-bit value, encodes offsets for copying and for two-point filter43 int offset2[4]; ///< 7-bit value, encodes offsets for copying and for two-point filter
libavcodec/utils.c+4−4
@@ -91,7 +91,7 @@ void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size) · 90 unmodified lines
91{91{
92 uint8_t **p = ptr;92 uint8_t **p = ptr;
93 if (min_size > SIZE_MAX - FF_INPUT_BUFFER_PADDING_SIZE) {93 if (min_size > SIZE_MAX - FF_INPUT_BUFFER_PADDING_SIZE) {
94 *p = NULL;94 av_freep(p);
95 *size = 0;95 *size = 0;
96 return;96 return;
97 }97 }
@@ -1448,9 +1448,9 @@ av_cold int avcodec_close(AVCodecContext *avctx) · 1350 unmodified lines
1448static enum CodecID remap_deprecated_codec_id(enum CodecID id)1448static enum CodecID remap_deprecated_codec_id(enum CodecID id)
1449{1449{
1450 switch(id){1450 switch(id){
1451 case CODEC_ID_G723_1_DEPRECATED : return CODEC_ID_G723_1;1451 //This is for future deprecatec codec ids, its empty since
1452 case CODEC_ID_G729_DEPRECATED : return CODEC_ID_G729;1452 //last major bump but will fill up again over time, please dont remove it
1453 case CODEC_ID_UTVIDEO_DEPRECATED: return CODEC_ID_UTVIDEO;1453// case CODEC_ID_UTVIDEO_DEPRECATED: return CODEC_ID_UTVIDEO;
1454 default : return id;1454 default : return id;
1455 }1455 }
1456}1456}
libavcodec/vc1dec.c+1−1
@@ -5712,7 +5712,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, · 5711 unmodified lines
5712 if (!v->field_mode || v->second_field)5712 if (!v->field_mode || v->second_field)
5713 s->end_mb_y = (i == n_slices ) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height);5713 s->end_mb_y = (i == n_slices ) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height);
5714 else5714 else
5715 s->end_mb_y = (i == n_slices1 + 1) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height);5715 s->end_mb_y = (i <= n_slices1 + 1) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height);
5716 vc1_decode_blocks(v);5716 vc1_decode_blocks(v);
5717 if (i != n_slices)5717 if (i != n_slices)
5718 s->gb = slices[i].gb;5718 s->gb = slices[i].gb;
libavcodec/zmbv.c+22−21
@@ -403,16 +403,17 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac · 402 unmodified lines
403 ZmbvContext * const c = avctx->priv_data;403 ZmbvContext * const c = avctx->priv_data;
404 int zret = Z_OK; // Zlib return code404 int zret = Z_OK; // Zlib return code
405 int len = buf_size;405 int len = buf_size;
406 int hi_ver, lo_ver;406 int hi_ver, lo_ver, ret;
407 uint8_t *tmp;
407 408
408 if (c->pic.data[0])409 if (c->pic.data[0])
409 avctx->release_buffer(avctx, &c->pic);410 avctx->release_buffer(avctx, &c->pic);
410 411
411 c->pic.reference = 3;412 c->pic.reference = 3;
412 c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;413 c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
413 if (avctx->get_buffer(avctx, &c->pic) < 0) {414 if ((ret = avctx->get_buffer(avctx, &c->pic)) < 0) {
414 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");415 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
415 return -1;416 return ret;
416 }417 }
417 418
418 /* parse header */419 /* parse header */
@@ -434,19 +435,19 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac · 15 unmodified lines
434 "Flags=%X ver=%i.%i comp=%i fmt=%i blk=%ix%i\n",435 "Flags=%X ver=%i.%i comp=%i fmt=%i blk=%ix%i\n",
435 c->flags,hi_ver,lo_ver,c->comp,c->fmt,c->bw,c->bh);436 c->flags,hi_ver,lo_ver,c->comp,c->fmt,c->bw,c->bh);
436 if (hi_ver != 0 || lo_ver != 1) {437 if (hi_ver != 0 || lo_ver != 1) {
437 av_log(avctx, AV_LOG_ERROR, "Unsupported version %i.%i\n",438 av_log_ask_for_sample(avctx, "Unsupported version %i.%i\n",
438 hi_ver, lo_ver);439 hi_ver, lo_ver);
439 return -1;440 return AVERROR_PATCHWELCOME;
440 }441 }
441 if (c->bw == 0 || c->bh == 0) {442 if (c->bw == 0 || c->bh == 0) {
442 av_log(avctx, AV_LOG_ERROR, "Unsupported block size %ix%i\n",443 av_log_ask_for_sample(avctx, "Unsupported block size %ix%i\n",
443 c->bw, c->bh);444 c->bw, c->bh);
444 return -1;445 return AVERROR_PATCHWELCOME;
445 }446 }
446 if (c->comp != 0 && c->comp != 1) {447 if (c->comp != 0 && c->comp != 1) {
447 av_log(avctx, AV_LOG_ERROR, "Unsupported compression type %i\n",448 av_log_ask_for_sample(avctx, "Unsupported compression type %i\n",
448 c->comp);449 c->comp);
449 return -1;450 return AVERROR_PATCHWELCOME;
450 }451 }
451 452
452 switch (c->fmt) {453 switch (c->fmt) {
@@ -475,9 +476,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac · 22 unmodified lines
475 break;476 break;
476 default:477 default:
477 c->decode_xor = NULL;478 c->decode_xor = NULL;
478 av_log(avctx, AV_LOG_ERROR,479 av_log_ask_for_sample(avctx, "Unsupported (for now) format %i\n",
479 "Unsupported (for now) format %i\n", c->fmt);480 c->fmt);
480 return -1;481 return AVERROR_PATCHWELCOME;
481 }482 }
482 483
483 zret = inflateReset(&c->zstream);484 zret = inflateReset(&c->zstream);
@@ -495,10 +496,10 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac · 11 unmodified lines
495 c->decode_intra= decode_intra;496 c->decode_intra= decode_intra;
496 }497 }
497 498
498 if (c->decode_intra == NULL) {499 if (c->decode_intra == NULL) {
499 av_log(avctx, AV_LOG_ERROR, "Error! Got no format or no keyframe!\n");500 av_log(avctx, AV_LOG_ERROR, "Error! Got no format or no keyframe!\n");
500 return -1;501 return AVERROR_INVALIDDATA;
501 }502 }
502 503
503 if (c->comp == 0) { //Uncompressed data504 if (c->comp == 0) { //Uncompressed data
504 memcpy(c->decomp_buf, buf, len);505 memcpy(c->decomp_buf, buf, len);
@@ -628,7 +629,7 @@ static av_cold int decode_init(AVCodecContext *avctx) · 123 unmodified lines
628 if ((c->decomp_buf = av_malloc(c->decomp_size)) == NULL) {629 if ((c->decomp_buf = av_malloc(c->decomp_size)) == NULL) {
629 av_log(avctx, AV_LOG_ERROR,630 av_log(avctx, AV_LOG_ERROR,
630 "Can't allocate decompression buffer.\n");631 "Can't allocate decompression buffer.\n");
631 return 1;632 return AVERROR(ENOMEM);
632 }633 }
633 }634 }
634 635
@@ -638,7 +639,7 @@ static av_cold int decode_init(AVCodecContext *avctx) · 3 unmodified lines
638 zret = inflateInit(&c->zstream);639 zret = inflateInit(&c->zstream);
639 if (zret != Z_OK) {640 if (zret != Z_OK) {
640 av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);641 av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
641 return 1;642 return -1;
642 }643 }
643 644
644 return 0;645 return 0;
libavcodec/zmbvenc.c+4−4
@@ -265,7 +265,7 @@ static av_cold int encode_init(AVCodecContext *avctx) · 264 unmodified lines
265 lvl = avctx->compression_level;265 lvl = avctx->compression_level;
266 if(lvl < 0 || lvl > 9){266 if(lvl < 0 || lvl > 9){
267 av_log(avctx, AV_LOG_ERROR, "Compression level should be 0-9, not %i\n", lvl);267 av_log(avctx, AV_LOG_ERROR, "Compression level should be 0-9, not %i\n", lvl);
268 return -1;268 return AVERROR(EINVAL);
269 }269 }
270 270
271 // Needed if zlib unused or init aborted before deflateInit271 // Needed if zlib unused or init aborted before deflateInit
@@ -274,7 +274,7 @@ static av_cold int encode_init(AVCodecContext *avctx) · 2 unmodified lines
274 ((avctx->width + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * ((avctx->height + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * 2 + 4;274 ((avctx->width + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * ((avctx->height + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * 2 + 4;
275 if ((c->work_buf = av_malloc(c->comp_size)) == NULL) {275 if ((c->work_buf = av_malloc(c->comp_size)) == NULL) {
276 av_log(avctx, AV_LOG_ERROR, "Can't allocate work buffer.\n");276 av_log(avctx, AV_LOG_ERROR, "Can't allocate work buffer.\n");
277 return -1;277 return AVERROR(ENOMEM);
278 }278 }
279 /* Conservative upper bound taken from zlib v1.2.1 source via lcl.c */279 /* Conservative upper bound taken from zlib v1.2.1 source via lcl.c */
280 c->comp_size = c->comp_size + ((c->comp_size + 7) >> 3) +280 c->comp_size = c->comp_size + ((c->comp_size + 7) >> 3) +
@@ -283,12 +283,12 @@ static av_cold int encode_init(AVCodecContext *avctx) · 2 unmodified lines
283 /* Allocate compression buffer */283 /* Allocate compression buffer */
284 if ((c->comp_buf = av_malloc(c->comp_size)) == NULL) {284 if ((c->comp_buf = av_malloc(c->comp_size)) == NULL) {
285 av_log(avctx, AV_LOG_ERROR, "Can't allocate compression buffer.\n");285 av_log(avctx, AV_LOG_ERROR, "Can't allocate compression buffer.\n");
286 return -1;286 return AVERROR(ENOMEM);
287 }287 }
288 c->pstride = FFALIGN(avctx->width, 16);288 c->pstride = FFALIGN(avctx->width, 16);
289 if ((c->prev = av_malloc(c->pstride * avctx->height)) == NULL) {289 if ((c->prev = av_malloc(c->pstride * avctx->height)) == NULL) {
290 av_log(avctx, AV_LOG_ERROR, "Can't allocate picture.\n");290 av_log(avctx, AV_LOG_ERROR, "Can't allocate picture.\n");
291 return -1;291 return AVERROR(ENOMEM);
292 }292 }
293 293
294 c->zstream.zalloc = Z_NULL;294 c->zstream.zalloc = Z_NULL;
libavformat/dv.c+1−2
@@ -138,6 +138,7 @@ static int dv_extract_audio(uint8_t* frame, uint8_t* ppcm[4], · 137 unmodified lines
138 pcm = ppcm[ipcm++];138 pcm = ppcm[ipcm++];
139 if (!pcm)139 if (!pcm)
140 break;140 break;
141
141 /* for each DIF segment */142 /* for each DIF segment */
142 for (i = 0; i < sys->difseg_size; i++) {143 for (i = 0; i < sys->difseg_size; i++) {
143 frame += 6 * 80; /* skip DIF segment header */144 frame += 6 * 80; /* skip DIF segment header */
@@ -186,8 +187,6 @@ static int dv_extract_audio(uint8_t* frame, uint8_t* ppcm[4], · 42 unmodified lines
186 frame += 16 * 80; /* 15 Video DIFs + 1 Audio DIF */187 frame += 16 * 80; /* 15 Video DIFs + 1 Audio DIF */
187 }188 }
188 }189 }
189
190 /* next stereo channel (50Mbps and 100Mbps only) */
191 }190 }
192 191
193 return size;192 return size;
libavformat/swfdec.c+1−4
@@ -137,10 +137,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) · 136 unmodified lines
137 ast->codec->codec_id = ff_codec_get_id(swf_audio_codec_tags, (v>>4) & 15);137 ast->codec->codec_id = ff_codec_get_id(swf_audio_codec_tags, (v>>4) & 15);
138 ast->need_parsing = AVSTREAM_PARSE_FULL;138 ast->need_parsing = AVSTREAM_PARSE_FULL;
139 sample_rate_code= (v>>2) & 3;139 sample_rate_code= (v>>2) & 3;
140 if (!sample_rate_code)140 ast->codec->sample_rate = 44100 >> (3 - sample_rate_code);
141 ast->codec->sample_rate = 5512;
142 else
143 ast->codec->sample_rate = 11025 << (sample_rate_code-1);
144 avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate);141 avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
145 len -= 4;142 len -= 4;
146 } else if (tag == TAG_VIDEOFRAME) {143 } else if (tag == TAG_VIDEOFRAME) {
libswscale/swscale.c+0−2
@@ -1736,8 +1736,6 @@ static void monoblack2Y_c(int16_t *dst, const uint8_t *src, const uint8_t *unuse · 1735 unmodified lines
1736 }1736 }
1737}1737}
1738 1738
1739//FIXME yuy2* can read up to 7 samples too much
1740
1741static void yuy2ToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,1739static void yuy2ToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
1742 uint32_t *unused)1740 uint32_t *unused)
1743{1741{
libswscale/x86/input.asm+13−16
@@ -271,31 +271,28 @@ cglobal %2 %+ 24ToUV, 7, 7, %1, dstU, dstV, u1, src, u2, w, u3 · 270 unmodified lines
271%endif ; ARCH_X86_64 && %0 == 3271%endif ; ARCH_X86_64 && %0 == 3
272%endmacro272%endmacro
273 273
274; %1 = nr. of XMM registers for rgb-to-Y func
275; %2 = nr. of XMM registers for rgb-to-UV func
276%macro RGB24_FUNCS 2
277RGB24_TO_Y_FN %1, rgb
278RGB24_TO_Y_FN %1, bgr, rgb
279RGB24_TO_UV_FN %2, rgb
280RGB24_TO_UV_FN %2, bgr, rgb
281%endmacro
282
274%if ARCH_X86_32283%if ARCH_X86_32
275INIT_MMX mmx284INIT_MMX mmx
276RGB24_TO_Y_FN 0, rgb285RGB24_FUNCS 0, 0
277RGB24_TO_Y_FN 0, bgr, rgb
278RGB24_TO_UV_FN 0, rgb
279RGB24_TO_UV_FN 0, bgr, rgb
280%endif286%endif
281 287
282INIT_XMM sse2288INIT_XMM sse2
283RGB24_TO_Y_FN 10, rgb289RGB24_FUNCS 10, 12
284RGB24_TO_Y_FN 10, bgr, rgb
285RGB24_TO_UV_FN 12, rgb
286RGB24_TO_UV_FN 12, bgr, rgb
287 290
288INIT_XMM ssse3291INIT_XMM ssse3
289RGB24_TO_Y_FN 11, rgb292RGB24_FUNCS 11, 13
290RGB24_TO_Y_FN 11, bgr, rgb
291RGB24_TO_UV_FN 13, rgb
292RGB24_TO_UV_FN 13, bgr, rgb
293 293
294INIT_XMM avx294INIT_XMM avx
295RGB24_TO_Y_FN 11, rgb295RGB24_FUNCS 11, 13
296RGB24_TO_Y_FN 11, bgr, rgb
297RGB24_TO_UV_FN 13, rgb
298RGB24_TO_UV_FN 13, bgr, rgb
299 296
300;-----------------------------------------------------------------------------297;-----------------------------------------------------------------------------
301; YUYV/UYVY/NV12/NV21 packed pixel shuffling.298; YUYV/UYVY/NV12/NV21 packed pixel shuffling.
libswscale/x86/swscale_mmx.c+2−0
@@ -27,6 +27,8 @@ · 26 unmodified lines
27#include "libavutil/cpu.h"27#include "libavutil/cpu.h"
28#include "libavutil/pixdesc.h"28#include "libavutil/pixdesc.h"
29 29
30#define DITHER1XBPP
31
30DECLARE_ASM_CONST(8, uint64_t, bF8)= 0xF8F8F8F8F8F8F8F8LL;32DECLARE_ASM_CONST(8, uint64_t, bF8)= 0xF8F8F8F8F8F8F8F8LL;
31DECLARE_ASM_CONST(8, uint64_t, bFC)= 0xFCFCFCFCFCFCFCFCLL;33DECLARE_ASM_CONST(8, uint64_t, bFC)= 0xFCFCFCFCFCFCFCFCLL;
32DECLARE_ASM_CONST(8, uint64_t, w10)= 0x0010001000100010LL;34DECLARE_ASM_CONST(8, uint64_t, w10)= 0x0010001000100010LL;
tests/fate/libavcodec.mak+1−0
@@ -1,6 +1,7 @@
1FATE_TESTS += fate-golomb1FATE_TESTS += fate-golomb
2fate-golomb: libavcodec/golomb-test$(EXESUF)2fate-golomb: libavcodec/golomb-test$(EXESUF)
3fate-golomb: CMD = run libavcodec/golomb-test3fate-golomb: CMD = run libavcodec/golomb-test
4fate-golomb: REF = /dev/null
4 5
5FATE_TESTS += fate-iirfilter6FATE_TESTS += fate-iirfilter
6fate-iirfilter: libavcodec/iirfilter-test$(EXESUF)7fate-iirfilter: libavcodec/iirfilter-test$(EXESUF)
tests/ref/fate/golomb+0−2
@@ -1,2 +0,0 @@
1testing unsigned exp golomb
2testing signed exp golomb

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t