mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-01-21 13:31:12 +01:00
Compare commits
51 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41e8591515 | ||
|
|
a04bb8d6e7 | ||
|
|
1298aa8318 | ||
|
|
e5fcc16a1f | ||
|
|
fe461238d3 | ||
|
|
b52952c6e9 | ||
|
|
b65c290f7f | ||
|
|
09e3fe79fc | ||
|
|
e4b1cffade | ||
|
|
06f7e87e15 | ||
|
|
420f63984b | ||
|
|
91437631d7 | ||
|
|
0d6ed2f13f | ||
|
|
a88236f3d5 | ||
|
|
02018a359e | ||
|
|
451bc8ee2f | ||
|
|
ae7ea2eabf | ||
|
|
0bcf514198 | ||
|
|
1ee5e2ce3d | ||
|
|
6e83c26620 | ||
|
|
a4de70df20 | ||
|
|
eaf64192d8 | ||
|
|
c074feed29 | ||
|
|
53c3abc108 | ||
|
|
6333c6c17d | ||
|
|
5fa56e6e62 | ||
|
|
cf7f798984 | ||
|
|
244a58fff0 | ||
|
|
ecda9b90ec | ||
|
|
52254067b3 | ||
|
|
af9b62654d | ||
|
|
80c268eaae | ||
|
|
8cd67ddde4 | ||
|
|
c53effc41b | ||
|
|
ede7388800 | ||
|
|
36d8914f1b | ||
|
|
146b187113 | ||
|
|
43d6764327 | ||
|
|
5123541913 | ||
|
|
01f9540320 | ||
|
|
00915d3cd2 | ||
|
|
58d7b835e3 | ||
|
|
d16515ae5f | ||
|
|
3a6bc3e381 | ||
|
|
e8ff797206 | ||
|
|
3ecbd911ff | ||
|
|
5e8eaa26b2 | ||
|
|
21d3e0ac9e | ||
|
|
744e7eea5d | ||
|
|
d7dbc687e3 | ||
|
|
7997acee05 |
@@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 1.1.12
|
||||
PROJECT_NUMBER = 1.1.13
|
||||
|
||||
# With the PROJECT_LOGO tag one can specify an logo or icon that is included
|
||||
# in the documentation. The maximum height of the logo should not exceed 55
|
||||
|
||||
@@ -1825,7 +1825,8 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
|
||||
for (j = 0; j < nb_input_files; j++) {
|
||||
for (i = 0; i < input_files[j]->nb_streams; i++) {
|
||||
AVCodecContext *c = input_files[j]->ctx->streams[i]->codec;
|
||||
if (c->codec_type != AVMEDIA_TYPE_VIDEO)
|
||||
if (c->codec_type != AVMEDIA_TYPE_VIDEO ||
|
||||
!c->time_base.num)
|
||||
continue;
|
||||
fr = c->time_base.den * 1000 / c->time_base.num;
|
||||
if (fr == 25000) {
|
||||
|
||||
@@ -558,10 +558,11 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
put_bits(&pb, 7, status->step_index);
|
||||
if (avctx->trellis > 0) {
|
||||
uint8_t buf[64];
|
||||
adpcm_compress_trellis(avctx, &samples_p[ch][1], buf, status,
|
||||
adpcm_compress_trellis(avctx, &samples_p[ch][0], buf, status,
|
||||
64, 1);
|
||||
for (i = 0; i < 64; i++)
|
||||
put_bits(&pb, 4, buf[i ^ 1]);
|
||||
status->prev_sample = status->predictor;
|
||||
} else {
|
||||
for (i = 0; i < 64; i += 2) {
|
||||
int t1, t2;
|
||||
|
||||
@@ -269,7 +269,7 @@ static void cdg_scroll(CDGraphicsContext *cc, uint8_t *data,
|
||||
static int cdg_decode_frame(AVCodecContext *avctx,
|
||||
void *data, int *got_frame, AVPacket *avpkt)
|
||||
{
|
||||
const uint8_t *buf = avpkt->data;
|
||||
GetByteContext gb;
|
||||
int buf_size = avpkt->size;
|
||||
int ret;
|
||||
uint8_t command, inst;
|
||||
@@ -286,19 +286,19 @@ static int cdg_decode_frame(AVCodecContext *avctx,
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
bytestream2_init(&gb, avpkt->data, avpkt->size);
|
||||
|
||||
ret = avctx->reget_buffer(avctx, &cc->frame);
|
||||
if (ret) {
|
||||
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
command = bytestream_get_byte(&buf);
|
||||
inst = bytestream_get_byte(&buf);
|
||||
command = bytestream2_get_byte(&gb);
|
||||
inst = bytestream2_get_byte(&gb);
|
||||
inst &= CDG_MASK;
|
||||
buf += 2; /// skipping 2 unneeded bytes
|
||||
|
||||
if (buf_size > CDG_HEADER_SIZE)
|
||||
bytestream_get_buffer(&buf, cdg_data, buf_size - CDG_HEADER_SIZE);
|
||||
bytestream2_skip(&gb, 2);
|
||||
bytestream2_get_buffer(&gb, cdg_data, sizeof(cdg_data));
|
||||
|
||||
if ((command & CDG_MASK) == CDG_COMMAND) {
|
||||
switch (inst) {
|
||||
@@ -357,11 +357,10 @@ static int cdg_decode_frame(AVCodecContext *avctx,
|
||||
*got_frame = 1;
|
||||
} else {
|
||||
*got_frame = 0;
|
||||
buf_size = 0;
|
||||
}
|
||||
|
||||
*(AVFrame *) data = cc->frame;
|
||||
return buf_size;
|
||||
return avpkt->size;
|
||||
}
|
||||
|
||||
static av_cold int cdg_decode_end(AVCodecContext *avctx)
|
||||
|
||||
@@ -45,8 +45,11 @@ static int dvdsub_parse(AVCodecParserContext *s,
|
||||
DVDSubParseContext *pc = s->priv_data;
|
||||
|
||||
if (pc->packet_index == 0) {
|
||||
if (buf_size < 2)
|
||||
return 0;
|
||||
if (buf_size < 2 || AV_RB16(buf) && buf_size < 6) {
|
||||
if (buf_size)
|
||||
av_log(avctx, AV_LOG_DEBUG, "Parser input %d too small\n", buf_size);
|
||||
return buf_size;
|
||||
}
|
||||
pc->packet_len = AV_RB16(buf);
|
||||
if (pc->packet_len == 0) /* HD-DVD subpicture packet */
|
||||
pc->packet_len = AV_RB32(buf+2);
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
*/
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "bytestream.h"
|
||||
#include "get_bits.h"
|
||||
#include "dsputil.h"
|
||||
#include "aandcttab.h"
|
||||
@@ -232,32 +233,34 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
{
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
const uint8_t *buf_end = buf+buf_size;
|
||||
MadContext *s = avctx->priv_data;
|
||||
GetByteContext gb;
|
||||
int width, height, ret;
|
||||
int chunk_type;
|
||||
int inter;
|
||||
|
||||
if (buf_size < 26) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Input buffer too small\n");
|
||||
*got_frame = 0;
|
||||
bytestream2_init(&gb, buf, buf_size);
|
||||
|
||||
chunk_type = bytestream2_get_le32(&gb);
|
||||
inter = (chunk_type == MADm_TAG || chunk_type == MADe_TAG);
|
||||
bytestream2_skip(&gb, 10);
|
||||
|
||||
av_reduce(&avctx->time_base.num, &avctx->time_base.den,
|
||||
bytestream2_get_le16(&gb), 1000, 1<<30);
|
||||
|
||||
width = bytestream2_get_le16(&gb);
|
||||
height = bytestream2_get_le16(&gb);
|
||||
bytestream2_skip(&gb, 1);
|
||||
calc_quant_matrix(s, bytestream2_get_byte(&gb));
|
||||
bytestream2_skip(&gb, 2);
|
||||
|
||||
if (bytestream2_get_bytes_left(&gb) < 2) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Input data too small\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
chunk_type = AV_RL32(&buf[0]);
|
||||
inter = (chunk_type == MADm_TAG || chunk_type == MADe_TAG);
|
||||
buf += 8;
|
||||
|
||||
av_reduce(&avctx->time_base.num, &avctx->time_base.den,
|
||||
AV_RL16(&buf[6]), 1000, 1<<30);
|
||||
|
||||
width = AV_RL16(&buf[8]);
|
||||
height = AV_RL16(&buf[10]);
|
||||
calc_quant_matrix(s, buf[13]);
|
||||
buf += 16;
|
||||
|
||||
if (avctx->width != width || avctx->height != height) {
|
||||
if((width * height)/2048*7 > buf_end-buf)
|
||||
if((width * height)/2048*7 > bytestream2_get_bytes_left(&gb))
|
||||
return AVERROR_INVALIDDATA;
|
||||
if ((ret = av_image_check_size(width, height, 0, avctx)) < 0)
|
||||
return ret;
|
||||
@@ -292,13 +295,13 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
}
|
||||
|
||||
av_fast_padded_malloc(&s->bitstream_buf, &s->bitstream_buf_size,
|
||||
buf_end - buf);
|
||||
bytestream2_get_bytes_left(&gb));
|
||||
if (!s->bitstream_buf)
|
||||
return AVERROR(ENOMEM);
|
||||
s->dsp.bswap16_buf(s->bitstream_buf, (const uint16_t*)buf, (buf_end-buf)/2);
|
||||
memset((uint8_t*)s->bitstream_buf + (buf_end-buf), 0, FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
init_get_bits(&s->gb, s->bitstream_buf, 8*(buf_end-buf));
|
||||
|
||||
s->dsp.bswap16_buf(s->bitstream_buf, (const uint16_t *)(buf + bytestream2_tell(&gb)),
|
||||
bytestream2_get_bytes_left(&gb) / 2);
|
||||
memset((uint8_t*)s->bitstream_buf + bytestream2_get_bytes_left(&gb), 0, FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
init_get_bits(&s->gb, s->bitstream_buf, 8*(bytestream2_get_bytes_left(&gb)));
|
||||
for (s->mb_y=0; s->mb_y < (avctx->height+15)/16; s->mb_y++)
|
||||
for (s->mb_x=0; s->mb_x < (avctx->width +15)/16; s->mb_x++)
|
||||
if(decode_mb(s, inter) < 0)
|
||||
|
||||
@@ -924,8 +924,8 @@ void ff_er_frame_end(MpegEncContext *s)
|
||||
return;
|
||||
};
|
||||
|
||||
if ( s->picture_structure == PICT_FRAME
|
||||
&& s->current_picture.f.linesize[0] != s->current_picture_ptr->f.linesize[0]) {
|
||||
if (s->picture_structure == PICT_FRAME &&
|
||||
s->current_picture.f.linesize[0] != s->current_picture_ptr->f.linesize[0]) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Error concealment not possible, frame not fully initialized\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -112,6 +112,7 @@ static void fft_ref(FFTComplex *tabr, FFTComplex *tab, int nbits)
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_MDCT
|
||||
static void imdct_ref(FFTSample *out, FFTSample *in, int nbits)
|
||||
{
|
||||
int n = 1<<nbits;
|
||||
@@ -146,8 +147,10 @@ static void mdct_ref(FFTSample *output, FFTSample *input, int nbits)
|
||||
output[k] = REF_SCALE(s, nbits - 1);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_MDCT */
|
||||
|
||||
#if CONFIG_FFT_FLOAT
|
||||
#if CONFIG_DCT
|
||||
static void idct_ref(FFTSample *output, FFTSample *input, int nbits)
|
||||
{
|
||||
int n = 1<<nbits;
|
||||
@@ -180,6 +183,7 @@ static void dct_ref(FFTSample *output, FFTSample *input, int nbits)
|
||||
output[k] = s;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_DCT */
|
||||
#endif
|
||||
|
||||
|
||||
@@ -305,6 +309,7 @@ int main(int argc, char **argv)
|
||||
tab2 = av_malloc(fft_size * sizeof(FFTSample));
|
||||
|
||||
switch (transform) {
|
||||
#if CONFIG_MDCT
|
||||
case TRANSFORM_MDCT:
|
||||
av_log(NULL, AV_LOG_INFO,"Scale factor is set to %f\n", scale);
|
||||
if (do_inverse)
|
||||
@@ -313,6 +318,7 @@ int main(int argc, char **argv)
|
||||
av_log(NULL, AV_LOG_INFO,"MDCT");
|
||||
ff_mdct_init(m, fft_nbits, do_inverse, scale);
|
||||
break;
|
||||
#endif /* CONFIG_MDCT */
|
||||
case TRANSFORM_FFT:
|
||||
if (do_inverse)
|
||||
av_log(NULL, AV_LOG_INFO,"IFFT");
|
||||
@@ -322,6 +328,7 @@ int main(int argc, char **argv)
|
||||
fft_ref_init(fft_nbits, do_inverse);
|
||||
break;
|
||||
#if CONFIG_FFT_FLOAT
|
||||
#if CONFIG_RDFT
|
||||
case TRANSFORM_RDFT:
|
||||
if (do_inverse)
|
||||
av_log(NULL, AV_LOG_INFO,"IDFT_C2R");
|
||||
@@ -330,6 +337,8 @@ int main(int argc, char **argv)
|
||||
ff_rdft_init(r, fft_nbits, do_inverse ? IDFT_C2R : DFT_R2C);
|
||||
fft_ref_init(fft_nbits, do_inverse);
|
||||
break;
|
||||
#endif /* CONFIG_RDFT */
|
||||
#if CONFIG_DCT
|
||||
case TRANSFORM_DCT:
|
||||
if (do_inverse)
|
||||
av_log(NULL, AV_LOG_INFO,"DCT_III");
|
||||
@@ -337,6 +346,7 @@ int main(int argc, char **argv)
|
||||
av_log(NULL, AV_LOG_INFO,"DCT_II");
|
||||
ff_dct_init(d, fft_nbits, do_inverse ? DCT_III : DCT_II);
|
||||
break;
|
||||
#endif /* CONFIG_DCT */
|
||||
#endif
|
||||
default:
|
||||
av_log(NULL, AV_LOG_ERROR, "Requested transform not supported\n");
|
||||
@@ -355,6 +365,7 @@ int main(int argc, char **argv)
|
||||
av_log(NULL, AV_LOG_INFO,"Checking...\n");
|
||||
|
||||
switch (transform) {
|
||||
#if CONFIG_MDCT
|
||||
case TRANSFORM_MDCT:
|
||||
if (do_inverse) {
|
||||
imdct_ref((FFTSample *)tab_ref, (FFTSample *)tab1, fft_nbits);
|
||||
@@ -368,6 +379,7 @@ int main(int argc, char **argv)
|
||||
err = check_diff((FFTSample *)tab_ref, tab2, fft_size / 2, scale);
|
||||
}
|
||||
break;
|
||||
#endif /* CONFIG_MDCT */
|
||||
case TRANSFORM_FFT:
|
||||
memcpy(tab, tab1, fft_size * sizeof(FFTComplex));
|
||||
s->fft_permute(s, tab);
|
||||
@@ -377,6 +389,7 @@ int main(int argc, char **argv)
|
||||
err = check_diff((FFTSample *)tab_ref, (FFTSample *)tab, fft_size * 2, 1.0);
|
||||
break;
|
||||
#if CONFIG_FFT_FLOAT
|
||||
#if CONFIG_RDFT
|
||||
case TRANSFORM_RDFT:
|
||||
fft_size_2 = fft_size >> 1;
|
||||
if (do_inverse) {
|
||||
@@ -408,6 +421,8 @@ int main(int argc, char **argv)
|
||||
err = check_diff((float *)tab_ref, (float *)tab2, fft_size, 1.0);
|
||||
}
|
||||
break;
|
||||
#endif /* CONFIG_RDFT */
|
||||
#if CONFIG_DCT
|
||||
case TRANSFORM_DCT:
|
||||
memcpy(tab, tab1, fft_size * sizeof(FFTComplex));
|
||||
d->dct_calc(d, (FFTSample *)tab);
|
||||
@@ -418,6 +433,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
err = check_diff((float *)tab_ref, (float *)tab, fft_size, 1.0);
|
||||
break;
|
||||
#endif /* CONFIG_DCT */
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -469,19 +485,25 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
switch (transform) {
|
||||
#if CONFIG_MDCT
|
||||
case TRANSFORM_MDCT:
|
||||
ff_mdct_end(m);
|
||||
break;
|
||||
#endif /* CONFIG_MDCT */
|
||||
case TRANSFORM_FFT:
|
||||
ff_fft_end(s);
|
||||
break;
|
||||
#if CONFIG_FFT_FLOAT
|
||||
#if CONFIG_RDFT
|
||||
case TRANSFORM_RDFT:
|
||||
ff_rdft_end(r);
|
||||
break;
|
||||
#endif /* CONFIG_RDFT */
|
||||
#if CONFIG_DCT
|
||||
case TRANSFORM_DCT:
|
||||
ff_dct_end(d);
|
||||
break;
|
||||
#endif /* CONFIG_DCT */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -223,6 +223,12 @@ int ff_h264_decode_sei(H264Context *h){
|
||||
if(s->avctx->debug&FF_DEBUG_STARTCODE)
|
||||
av_log(h->s.avctx, AV_LOG_DEBUG, "SEI %d len:%d\n", type, size);
|
||||
|
||||
if (size > get_bits_left(&s->gb) / 8) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "SEI type %d truncated at %d\n",
|
||||
type, get_bits_left(&s->gb));
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
switch(type){
|
||||
case SEI_TYPE_PIC_TIMING: // Picture timing SEI
|
||||
if(decode_picture_timing(h) < 0)
|
||||
|
||||
@@ -107,11 +107,13 @@ static int read_len_table(uint8_t *dst, GetBitContext *gb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void generate_joint_tables(HYuvContext *s)
|
||||
static int generate_joint_tables(HYuvContext *s)
|
||||
{
|
||||
uint16_t symbols[1 << VLC_BITS];
|
||||
uint16_t bits[1 << VLC_BITS];
|
||||
uint8_t len[1 << VLC_BITS];
|
||||
int ret;
|
||||
|
||||
if (s->bitstream_bpp < 24) {
|
||||
int p, i, y, u;
|
||||
for (p = 0; p < 3; p++) {
|
||||
@@ -133,8 +135,9 @@ static void generate_joint_tables(HYuvContext *s)
|
||||
}
|
||||
}
|
||||
ff_free_vlc(&s->vlc[3 + p]);
|
||||
ff_init_vlc_sparse(&s->vlc[3 + p], VLC_BITS, i, len, 1, 1,
|
||||
bits, 2, 2, symbols, 2, 2, 0);
|
||||
if ((ret = ff_init_vlc_sparse(&s->vlc[3 + p], VLC_BITS, i, len, 1, 1,
|
||||
bits, 2, 2, symbols, 2, 2, 0)) < 0)
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
uint8_t (*map)[4] = (uint8_t(*)[4])s->pix_bgr_map;
|
||||
@@ -176,31 +179,34 @@ static void generate_joint_tables(HYuvContext *s)
|
||||
}
|
||||
}
|
||||
ff_free_vlc(&s->vlc[3]);
|
||||
init_vlc(&s->vlc[3], VLC_BITS, i, len, 1, 1, bits, 2, 2, 0);
|
||||
if ((ret = init_vlc(&s->vlc[3], VLC_BITS, i, len, 1, 1,
|
||||
bits, 2, 2, 0)) < 0)
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length)
|
||||
{
|
||||
GetBitContext gb;
|
||||
int i;
|
||||
int ret;
|
||||
int i, ret;
|
||||
|
||||
init_get_bits(&gb, src, length * 8);
|
||||
if ((ret = init_get_bits(&gb, src, length * 8)) < 0)
|
||||
return ret;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (read_len_table(s->len[i], &gb) < 0)
|
||||
return -1;
|
||||
if (ff_huffyuv_generate_bits_table(s->bits[i], s->len[i]) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if ((ret = read_len_table(s->len[i], &gb)) < 0)
|
||||
return ret;
|
||||
if ((ret = ff_huffyuv_generate_bits_table(s->bits[i], s->len[i])) < 0)
|
||||
return ret;
|
||||
ff_free_vlc(&s->vlc[i]);
|
||||
if ((ret = init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1,
|
||||
s->bits[i], 4, 4, 0)) < 0)
|
||||
s->bits[i], 4, 4, 0)) < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
generate_joint_tables(s);
|
||||
if ((ret = generate_joint_tables(s)) < 0)
|
||||
return ret;
|
||||
|
||||
return (get_bits_count(&gb) + 7) / 8;
|
||||
}
|
||||
@@ -208,18 +214,19 @@ static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length)
|
||||
static int read_old_huffman_tables(HYuvContext *s)
|
||||
{
|
||||
GetBitContext gb;
|
||||
int i;
|
||||
int ret;
|
||||
int i, ret;
|
||||
|
||||
init_get_bits(&gb, classic_shift_luma,
|
||||
classic_shift_luma_table_size * 8);
|
||||
if (read_len_table(s->len[0], &gb) < 0)
|
||||
return -1;
|
||||
if ((ret = init_get_bits(&gb, classic_shift_luma,
|
||||
classic_shift_luma_table_size * 8)) < 0)
|
||||
return ret;
|
||||
if ((ret = read_len_table(s->len[0], &gb)) < 0)
|
||||
return ret;
|
||||
|
||||
init_get_bits(&gb, classic_shift_chroma,
|
||||
classic_shift_chroma_table_size * 8);
|
||||
if (read_len_table(s->len[1], &gb) < 0)
|
||||
return -1;
|
||||
if ((ret = init_get_bits(&gb, classic_shift_chroma,
|
||||
classic_shift_chroma_table_size * 8)) < 0)
|
||||
return ret;
|
||||
if ((ret = read_len_table(s->len[1], &gb)) < 0)
|
||||
return ret;
|
||||
|
||||
for(i=0; i<256; i++) s->bits[0][i] = classic_add_luma [i];
|
||||
for(i=0; i<256; i++) s->bits[1][i] = classic_add_chroma[i];
|
||||
@@ -238,7 +245,8 @@ static int read_old_huffman_tables(HYuvContext *s)
|
||||
return ret;
|
||||
}
|
||||
|
||||
generate_joint_tables(s);
|
||||
if ((ret = generate_joint_tables(s)) < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -246,6 +254,7 @@ static int read_old_huffman_tables(HYuvContext *s)
|
||||
static av_cold int decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
HYuvContext *s = avctx->priv_data;
|
||||
int ret;
|
||||
|
||||
ff_huffyuv_common_init(avctx);
|
||||
memset(s->vlc, 0, 3 * sizeof(VLC));
|
||||
@@ -281,9 +290,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
s->interlaced = (interlace == 1) ? 1 : (interlace == 2) ? 0 : s->interlaced;
|
||||
s->context = ((uint8_t*)avctx->extradata)[2] & 0x40 ? 1 : 0;
|
||||
|
||||
if ( read_huffman_tables(s, ((uint8_t*)avctx->extradata) + 4,
|
||||
avctx->extradata_size - 4) < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if ((ret = read_huffman_tables(s, ((uint8_t*)avctx->extradata) + 4,
|
||||
avctx->extradata_size - 4)) < 0)
|
||||
return ret;
|
||||
}else{
|
||||
switch (avctx->bits_per_coded_sample & 7) {
|
||||
case 1:
|
||||
@@ -310,8 +319,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
s->bitstream_bpp = avctx->bits_per_coded_sample & ~7;
|
||||
s->context = 0;
|
||||
|
||||
if (read_old_huffman_tables(s) < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if ((ret = read_old_huffman_tables(s)) < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
switch (s->bitstream_bpp) {
|
||||
@@ -341,13 +350,16 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
av_log(avctx, AV_LOG_ERROR, "width must be even for this colorspace\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (s->predictor == MEDIAN && avctx->pix_fmt == AV_PIX_FMT_YUV422P && avctx->width%4) {
|
||||
av_log(avctx, AV_LOG_ERROR, "width must be a multiple of 4 this colorspace and predictor\n");
|
||||
if (s->predictor == MEDIAN && avctx->pix_fmt == AV_PIX_FMT_YUV422P &&
|
||||
avctx->width % 4) {
|
||||
av_log(avctx, AV_LOG_ERROR, "width must be a multiple of 4 "
|
||||
"for this combination of colorspace and predictor type.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (ff_huffyuv_alloc_temp(s)) {
|
||||
|
||||
if ((ret = ff_huffyuv_alloc_temp(s)) < 0) {
|
||||
ff_huffyuv_common_end(s);
|
||||
return AVERROR(ENOMEM);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -356,24 +368,24 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
|
||||
{
|
||||
HYuvContext *s = avctx->priv_data;
|
||||
int i;
|
||||
int i, ret;
|
||||
|
||||
avctx->coded_frame= &s->picture;
|
||||
if (ff_huffyuv_alloc_temp(s)) {
|
||||
if ((ret = ff_huffyuv_alloc_temp(s)) < 0) {
|
||||
ff_huffyuv_common_end(s);
|
||||
return AVERROR(ENOMEM);
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
s->vlc[i].table = NULL;
|
||||
|
||||
if (s->version == 2) {
|
||||
if (read_huffman_tables(s, ((uint8_t*)avctx->extradata) + 4,
|
||||
avctx->extradata_size) < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if ((ret = read_huffman_tables(s, ((uint8_t*)avctx->extradata) + 4,
|
||||
avctx->extradata_size)) < 0)
|
||||
return ret;
|
||||
} else {
|
||||
if (read_old_huffman_tables(s) < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if ((ret = read_old_huffman_tables(s)) < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -532,14 +544,15 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
if (s->context) {
|
||||
table_size = read_huffman_tables(s, s->bitstream_buffer, buf_size);
|
||||
if (table_size < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
return table_size;
|
||||
}
|
||||
|
||||
if ((unsigned)(buf_size-table_size) >= INT_MAX / 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
init_get_bits(&s->gb, s->bitstream_buffer+table_size,
|
||||
(buf_size-table_size) * 8);
|
||||
if ((ret = init_get_bits(&s->gb, s->bitstream_buffer + table_size,
|
||||
(buf_size - table_size) * 8)) < 0)
|
||||
return ret;
|
||||
|
||||
fake_ystride = s->interlaced ? p->linesize[0] * 2 : p->linesize[0];
|
||||
fake_ustride = s->interlaced ? p->linesize[1] * 2 : p->linesize[1];
|
||||
|
||||
@@ -191,6 +191,7 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
MPADecodeHeader hdr;
|
||||
int len, ret, ch;
|
||||
int lame_result;
|
||||
uint32_t h;
|
||||
|
||||
if (frame) {
|
||||
switch (avctx->sample_fmt) {
|
||||
@@ -246,7 +247,12 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
determine the frame size. */
|
||||
if (s->buffer_index < 4)
|
||||
return 0;
|
||||
if (avpriv_mpegaudio_decode_header(&hdr, AV_RB32(s->buffer))) {
|
||||
h = AV_RB32(s->buffer);
|
||||
if (ff_mpa_check_header(h) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid mp3 header at start of buffer\n");
|
||||
return AVERROR_BUG;
|
||||
}
|
||||
if (avpriv_mpegaudio_decode_header(&hdr, h)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "free format output not supported\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
*/
|
||||
|
||||
//#define DEBUG
|
||||
#include "libavutil/common.h"
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "mpegaudio.h"
|
||||
#include "mpegaudiodata.h"
|
||||
@@ -46,6 +48,8 @@ int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header)
|
||||
s->layer = 4 - ((header >> 17) & 3);
|
||||
/* extract frequency */
|
||||
sample_rate_index = (header >> 10) & 3;
|
||||
if (sample_rate_index >= FF_ARRAY_ELEMS(avpriv_mpa_freq_tab))
|
||||
sample_rate_index = 0;
|
||||
sample_rate = avpriv_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25);
|
||||
sample_rate_index += 3 * (s->lsf + mpeg25);
|
||||
s->sample_rate_index = sample_rate_index;
|
||||
|
||||
@@ -212,6 +212,13 @@ static int parse_picture_segment(AVCodecContext *avctx,
|
||||
/* Decode rle bitmap length, stored size includes width/height data */
|
||||
rle_bitmap_len = bytestream_get_be24(&buf) - 2*2;
|
||||
|
||||
if (buf_size > rle_bitmap_len) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Buffer dimension %d larger than the expected RLE data %d\n",
|
||||
buf_size, rle_bitmap_len);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/* Get bitmap dimensions from data */
|
||||
width = bytestream_get_be16(&buf);
|
||||
height = bytestream_get_be16(&buf);
|
||||
@@ -222,11 +229,6 @@ static int parse_picture_segment(AVCodecContext *avctx,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf_size > rle_bitmap_len) {
|
||||
av_log(avctx, AV_LOG_ERROR, "too much RLE data\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
ctx->pictures[picture_id].w = width;
|
||||
ctx->pictures[picture_id].h = height;
|
||||
|
||||
|
||||
@@ -61,6 +61,10 @@ typedef struct SVQ1Context {
|
||||
DSPContext dsp;
|
||||
GetBitContext gb;
|
||||
AVFrame *cur, *prev;
|
||||
|
||||
uint8_t *pkt_swapped;
|
||||
int pkt_swapped_allocated;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
int frame_code;
|
||||
@@ -628,7 +632,24 @@ static int svq1_decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
/* swap some header bytes (why?) */
|
||||
if (s->frame_code != 0x20) {
|
||||
uint32_t *src = (uint32_t *)(buf + 4);
|
||||
uint32_t *src;
|
||||
|
||||
if (buf_size < 9 * 4) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Input packet too small\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
av_fast_padded_malloc(&s->pkt_swapped, &s->pkt_swapped_allocated,
|
||||
buf_size);
|
||||
if (!s->pkt_swapped)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
memcpy(s->pkt_swapped, buf, buf_size);
|
||||
buf = s->pkt_swapped;
|
||||
init_get_bits(&s->gb, buf, buf_size * 8);
|
||||
skip_bits(&s->gb, 22);
|
||||
|
||||
src = (uint32_t *)(s->pkt_swapped + 4);
|
||||
|
||||
if (buf_size < 36)
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -804,6 +825,8 @@ static av_cold int svq1_decode_end(AVCodecContext *avctx)
|
||||
avctx->release_buffer(avctx, s->prev);
|
||||
avcodec_free_frame(&s->cur);
|
||||
avcodec_free_frame(&s->prev);
|
||||
av_freep(&s->pkt_swapped);
|
||||
s->pkt_swapped_allocated = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -540,6 +540,11 @@ void ff_init_buffer_info(AVCodecContext *s, AVFrame *frame)
|
||||
|
||||
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
|
||||
{
|
||||
if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) {
|
||||
if (av_image_check_size(avctx->width, avctx->height, 0, avctx))
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
ff_init_buffer_info(avctx, frame);
|
||||
|
||||
return avctx->get_buffer(avctx, frame);
|
||||
|
||||
@@ -298,13 +298,6 @@ static int select_frame(AVFilterContext *ctx, AVFilterBufferRef *ref)
|
||||
}
|
||||
|
||||
res = av_expr_eval(select->expr, select->var_values, NULL);
|
||||
av_log(inlink->dst, AV_LOG_DEBUG,
|
||||
"n:%d pts:%d t:%f pos:%d key:%d",
|
||||
(int)select->var_values[VAR_N],
|
||||
(int)select->var_values[VAR_PTS],
|
||||
select->var_values[VAR_T],
|
||||
(int)select->var_values[VAR_POS],
|
||||
(int)select->var_values[VAR_KEY]);
|
||||
|
||||
switch (inlink->type) {
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
|
||||
@@ -265,19 +265,19 @@ static int mp3_write_audio_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
if (pkt->data && pkt->size >= 4) {
|
||||
MPADecodeHeader mpah;
|
||||
int av_unused base;
|
||||
uint32_t head = AV_RB32(pkt->data);
|
||||
uint32_t h;
|
||||
|
||||
if (ff_mpa_check_header(head) < 0) {
|
||||
h = AV_RB32(pkt->data);
|
||||
if (ff_mpa_check_header(h) == 0) {
|
||||
avpriv_mpegaudio_decode_header(&mpah, h);
|
||||
if (!mp3->initial_bitrate)
|
||||
mp3->initial_bitrate = mpah.bit_rate;
|
||||
if ((mpah.bit_rate == 0) || (mp3->initial_bitrate != mpah.bit_rate))
|
||||
mp3->has_variable_bitrate = 1;
|
||||
} else {
|
||||
av_log(s, AV_LOG_WARNING, "Audio packet of size %d (starting with %08X...) "
|
||||
"is invalid, writing it anyway.\n", pkt->size, head);
|
||||
return ff_raw_write_packet(s, pkt);
|
||||
"is invalid, writing it anyway.\n", pkt->size, h);
|
||||
}
|
||||
avpriv_mpegaudio_decode_header(&mpah, head);
|
||||
|
||||
if (!mp3->initial_bitrate)
|
||||
mp3->initial_bitrate = mpah.bit_rate;
|
||||
if ((mpah.bit_rate == 0) || (mp3->initial_bitrate != mpah.bit_rate))
|
||||
mp3->has_variable_bitrate = 1;
|
||||
|
||||
#ifdef FILTER_VBR_HEADERS
|
||||
/* filter out XING and INFO headers. */
|
||||
|
||||
@@ -1532,7 +1532,8 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
|
||||
}
|
||||
|
||||
/* read packet from packet buffer, if there is data */
|
||||
if (!(next_pkt->pts == AV_NOPTS_VALUE &&
|
||||
st = s->streams[next_pkt->stream_index];
|
||||
if (!(next_pkt->pts == AV_NOPTS_VALUE && st->discard < AVDISCARD_ALL &&
|
||||
next_pkt->dts != AV_NOPTS_VALUE && !eof)) {
|
||||
ret = read_from_packet_buffer(&s->packet_buffer,
|
||||
&s->packet_buffer_end, pkt);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
define DEF_FFT
|
||||
FATE_FFT += fate-fft-$(1) fate-ifft-$(1) \
|
||||
fate-mdct-$(1) fate-imdct-$(1) \
|
||||
fate-rdft-$(1) fate-irdft-$(1) \
|
||||
fate-dct1d-$(1) fate-idct1d-$(1)
|
||||
FATE_FFT-$(CONFIG_DCT) += fate-dct1d-$(1) fate-idct1d-$(1)
|
||||
FATE_FFT-$(CONFIG_FFT) += fate-fft-$(1) fate-ifft-$(1)
|
||||
FATE_FFT-$(CONFIG_MDCT) += fate-mdct-$(1) fate-imdct-$(1)
|
||||
FATE_FFT-$(CONFIG_RDFT) += fate-rdft-$(1) fate-irdft-$(1)
|
||||
|
||||
fate-fft-$(N): ARGS = -n$(1)
|
||||
fate-ifft-$(N): ARGS = -n$(1) -i
|
||||
@@ -16,14 +16,14 @@ endef
|
||||
|
||||
$(foreach N, 4 5 6 7 8 9 10 11 12, $(eval $(call DEF_FFT,$(N))))
|
||||
|
||||
fate-fft-test: $(FATE_FFT)
|
||||
$(FATE_FFT): libavcodec/fft-test$(EXESUF)
|
||||
$(FATE_FFT): CMD = run libavcodec/fft-test $(CPUFLAGS:%=-c%) $(ARGS)
|
||||
$(FATE_FFT): REF = /dev/null
|
||||
fate-fft-float: $(FATE_FFT-yes)
|
||||
$(FATE_FFT-yes): libavcodec/fft-test$(EXESUF)
|
||||
$(FATE_FFT-yes): CMD = run libavcodec/fft-test $(CPUFLAGS:%=-c%) $(ARGS)
|
||||
$(FATE_FFT-yes): REF = /dev/null
|
||||
|
||||
define DEF_FFT_FIXED
|
||||
FATE_FFT_FIXED += fate-fft-fixed-$(1) fate-ifft-fixed-$(1) \
|
||||
fate-mdct-fixed-$(1) fate-imdct-fixed-$(1)
|
||||
FATE_FFT_FIXED-$(CONFIG_FFT) += fate-fft-fixed-$(1) fate-ifft-fixed-$(1)
|
||||
FATE_FFT_FIXED-$(CONFIG_MDCT) += fate-mdct-fixed-$(1) fate-imdct-fixed-$(1)
|
||||
|
||||
fate-fft-fixed-$(1): ARGS = -n$(1)
|
||||
fate-ifft-fixed-$(1): ARGS = -n$(1) -i
|
||||
@@ -33,10 +33,10 @@ endef
|
||||
|
||||
$(foreach N, 4 5 6 7 8 9 10 11 12, $(eval $(call DEF_FFT_FIXED,$(N))))
|
||||
|
||||
fate-fft-fixed-test: $(FATE_FFT_FIXED)
|
||||
$(FATE_FFT_FIXED): libavcodec/fft-fixed-test$(EXESUF)
|
||||
$(FATE_FFT_FIXED): CMD = run libavcodec/fft-fixed-test $(CPUFLAGS:%=-c%) $(ARGS)
|
||||
$(FATE_FFT_FIXED): REF = /dev/null
|
||||
fate-fft-fixed: $(FATE_FFT_FIXED-yes)
|
||||
$(FATE_FFT_FIXED-yes): libavcodec/fft-fixed-test$(EXESUF)
|
||||
$(FATE_FFT_FIXED-yes): CMD = run libavcodec/fft-fixed-test $(CPUFLAGS:%=-c%) $(ARGS)
|
||||
$(FATE_FFT_FIXED-yes): REF = /dev/null
|
||||
|
||||
FATE-$(call ALLYES, AVCODEC FFT) += $(FATE_FFT) $(FATE_FFT_FIXED)
|
||||
fate-fft: $(FATE_FFT) $(FATE_FFT_FIXED)
|
||||
FATE-$(CONFIG_AVCODEC) += $(FATE_FFT-yes) $(FATE_FFT_FIXED-yes)
|
||||
fate-fft: $(FATE_FFT-yes) $(FATE_FFT_FIXED-yes)
|
||||
|
||||
Reference in New Issue
Block a user