Compare commits
77 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
49fa398858 | ||
![]() |
1ad1723c24 | ||
![]() |
7740b111dd | ||
![]() |
c0ad5f9333 | ||
![]() |
bb7f236c7f | ||
![]() |
0397d43405 | ||
![]() |
ffc66ac0d6 | ||
![]() |
588e7226ed | ||
![]() |
0dc5868f14 | ||
![]() |
723512ac71 | ||
![]() |
963514ea1a | ||
![]() |
c11b3010c2 | ||
![]() |
3301b248b0 | ||
![]() |
7b67ce9ade | ||
![]() |
90a1c5e95c | ||
![]() |
45a529d805 | ||
![]() |
97cbad3d2c | ||
![]() |
6419569a9d | ||
![]() |
67134ad31f | ||
![]() |
d513c6a0ee | ||
![]() |
18f48e05a2 | ||
![]() |
5bf5a35fb5 | ||
![]() |
6598aaea1a | ||
![]() |
a5992a274f | ||
![]() |
1b99667005 | ||
![]() |
1f4d779e87 | ||
![]() |
f543d32455 | ||
![]() |
2cbdbc3670 | ||
![]() |
aa943bd31f | ||
![]() |
bea14966e2 | ||
![]() |
6be5a3c045 | ||
![]() |
119131fcbf | ||
![]() |
c13e38bac7 | ||
![]() |
01c4fe7ee7 | ||
![]() |
ad13a5c8fa | ||
![]() |
ce248bf7ee | ||
![]() |
8eaefbe1be | ||
![]() |
81d8bad786 | ||
![]() |
0aee436728 | ||
![]() |
cdaf9fb2a0 | ||
![]() |
cf41ff4889 | ||
![]() |
6120ad315b | ||
![]() |
2105f046f5 | ||
![]() |
815d3225e3 | ||
![]() |
51dd23c448 | ||
![]() |
a4e1532ee7 | ||
![]() |
f7b147548e | ||
![]() |
f99b17bd32 | ||
![]() |
21f6b07a97 | ||
![]() |
c9f1456a41 | ||
![]() |
77b789b406 | ||
![]() |
9ed1aa0465 | ||
![]() |
188ce941ec | ||
![]() |
7fc9c7c35b | ||
![]() |
07015d9f91 | ||
![]() |
744b406ff3 | ||
![]() |
2273e5ed99 | ||
![]() |
a1f7844a11 | ||
![]() |
3ef8b4322c | ||
![]() |
9dc112e277 | ||
![]() |
75ff0e8c50 | ||
![]() |
f02221d651 | ||
![]() |
92c4973752 | ||
![]() |
f4e0869560 | ||
![]() |
6135baa85b | ||
![]() |
3573256037 | ||
![]() |
d396987c30 | ||
![]() |
b20a8ad619 | ||
![]() |
01a550bda2 | ||
![]() |
f6b3dce952 | ||
![]() |
b8e57113ec | ||
![]() |
407912d178 | ||
![]() |
12bbd819cb | ||
![]() |
f9204ec56a | ||
![]() |
4ddac7199b | ||
![]() |
3e78f86891 | ||
![]() |
68fd80ee1c |
17
Changelog
17
Changelog
@@ -1,6 +1,23 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 2.2.7
|
||||
- snow: fix null pointer dereference
|
||||
- iff: fix out of array access
|
||||
- svq1dec: fix input data corruption
|
||||
- proresenc_ks: check buffer size
|
||||
|
||||
|
||||
version 2.2.6
|
||||
- fix infinite loop in dvbsub parser
|
||||
- fix some interlaced MPEG-2 videos
|
||||
- fix decoding issues in dv (Ticket2340, 2341)
|
||||
- fix v4l2 and v4l2enc crashes
|
||||
- fix theoretical librtmp crash
|
||||
- fix theoretical eamad crash
|
||||
- support dimension change in g2meet
|
||||
|
||||
|
||||
version 2.2:
|
||||
- HNM version 4 demuxer and video decoder
|
||||
- Live HDS muxer
|
||||
|
@@ -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 = 2.2.5
|
||||
PROJECT_NUMBER = 2.2.7
|
||||
|
||||
# With the PROJECT_LOGO tag one can specify a logo or icon that is included
|
||||
# in the documentation. The maximum height of the logo should not exceed 55
|
||||
|
@@ -828,6 +828,12 @@ static int configure_input_filter(FilterGraph *fg, InputFilter *ifilter,
|
||||
av_freep(&ifilter->name);
|
||||
DESCRIBE_FILTER_LINK(ifilter, in, 1);
|
||||
|
||||
if (!ifilter->ist->dec) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"No decoder for stream #%d:%d, filtering impossible\n",
|
||||
ifilter->ist->file_index, ifilter->ist->st->index);
|
||||
return AVERROR_DECODER_NOT_FOUND;
|
||||
}
|
||||
switch (avfilter_pad_get_type(in->filter_ctx->input_pads, in->pad_idx)) {
|
||||
case AVMEDIA_TYPE_VIDEO: return configure_input_video_filter(fg, ifilter, in);
|
||||
case AVMEDIA_TYPE_AUDIO: return configure_input_audio_filter(fg, ifilter, in);
|
||||
|
@@ -1783,7 +1783,7 @@ static int open_output_file(OptionsContext *o, const char *filename)
|
||||
/* pick the "best" stream of each type */
|
||||
|
||||
/* video: highest resolution */
|
||||
if (!o->video_disable && oc->oformat->video_codec != AV_CODEC_ID_NONE) {
|
||||
if (!o->video_disable && av_guess_codec(oc->oformat, NULL, filename, NULL, AVMEDIA_TYPE_VIDEO) != AV_CODEC_ID_NONE) {
|
||||
int area = 0, idx = -1;
|
||||
int qcr = avformat_query_codec(oc->oformat, oc->oformat->video_codec, 0);
|
||||
for (i = 0; i < nb_input_streams; i++) {
|
||||
@@ -1805,7 +1805,7 @@ static int open_output_file(OptionsContext *o, const char *filename)
|
||||
}
|
||||
|
||||
/* audio: most channels */
|
||||
if (!o->audio_disable && oc->oformat->audio_codec != AV_CODEC_ID_NONE) {
|
||||
if (!o->audio_disable && av_guess_codec(oc->oformat, NULL, filename, NULL, AVMEDIA_TYPE_AUDIO) != AV_CODEC_ID_NONE) {
|
||||
int channels = 0, idx = -1;
|
||||
for (i = 0; i < nb_input_streams; i++) {
|
||||
ist = input_streams[i];
|
||||
@@ -2119,7 +2119,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) {
|
||||
|
@@ -2989,6 +2989,8 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
|
||||
AVDictionaryEntry *entry = av_dict_get(stream->metadata, "title", NULL, 0);
|
||||
int i;
|
||||
|
||||
*pbuffer = NULL;
|
||||
|
||||
avc = avformat_alloc_context();
|
||||
if (avc == NULL || !rtp_format) {
|
||||
return -1;
|
||||
@@ -3025,7 +3027,7 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
|
||||
av_free(avc);
|
||||
av_free(avs);
|
||||
|
||||
return strlen(*pbuffer);
|
||||
return *pbuffer ? strlen(*pbuffer) : AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
static void rtsp_cmd_options(HTTPContext *c, const char *url)
|
||||
|
@@ -108,8 +108,12 @@ av_cold void ff_h264dsp_init_arm(H264DSPContext *c, const int bit_depth,
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
if (have_armv6(cpu_flags))
|
||||
if (have_armv6(cpu_flags) && !(have_vfpv3(cpu_flags) || have_neon(cpu_flags))) {
|
||||
// This function uses the 'setend' instruction which is deprecated
|
||||
// on ARMv8. This instruction is serializing on some ARMv7 cores as
|
||||
// well. Therefore, only use the function on ARMv6.
|
||||
c->h264_find_start_code_candidate = ff_h264_find_start_code_candidate_armv6;
|
||||
}
|
||||
if (have_neon(cpu_flags))
|
||||
h264dsp_init_neon(c, bit_depth, chroma_format_idc);
|
||||
}
|
||||
|
@@ -261,7 +261,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;
|
||||
@@ -278,6 +278,8 @@ static int cdg_decode_frame(AVCodecContext *avctx,
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
bytestream2_init(&gb, avpkt->data, avpkt->size);
|
||||
|
||||
if ((ret = ff_reget_buffer(avctx, cc->frame)) < 0)
|
||||
return ret;
|
||||
if (!avctx->frame_number) {
|
||||
@@ -285,13 +287,11 @@ static int cdg_decode_frame(AVCodecContext *avctx,
|
||||
memset(cc->frame->data[1], 0, AVPALETTE_SIZE);
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -353,10 +353,9 @@ static int cdg_decode_frame(AVCodecContext *avctx,
|
||||
*got_frame = 1;
|
||||
} else {
|
||||
*got_frame = 0;
|
||||
buf_size = 0;
|
||||
}
|
||||
|
||||
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 "aandcttab.h"
|
||||
#include "eaidct.h"
|
||||
@@ -237,30 +238,32 @@ 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;
|
||||
AVFrame *frame = data;
|
||||
GetByteContext gb;
|
||||
int width, height;
|
||||
int chunk_type;
|
||||
int inter, ret;
|
||||
|
||||
if (buf_size < 26) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Input buffer too small\n");
|
||||
*got_frame = 0;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
bytestream2_init(&gb, buf, buf_size);
|
||||
|
||||
chunk_type = AV_RL32(&buf[0]);
|
||||
chunk_type = bytestream2_get_le32(&gb);
|
||||
inter = (chunk_type == MADm_TAG || chunk_type == MADe_TAG);
|
||||
buf += 8;
|
||||
bytestream2_skip(&gb, 10);
|
||||
|
||||
av_reduce(&avctx->time_base.num, &avctx->time_base.den,
|
||||
AV_RL16(&buf[6]), 1000, 1<<30);
|
||||
bytestream2_get_le16(&gb), 1000, 1<<30);
|
||||
|
||||
width = AV_RL16(&buf[8]);
|
||||
height = AV_RL16(&buf[10]);
|
||||
calc_quant_matrix(s, buf[13]);
|
||||
buf += 16;
|
||||
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;
|
||||
}
|
||||
|
||||
if (width < 16 || height < 16) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Dimensions too small\n");
|
||||
@@ -269,7 +272,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
|
||||
if (avctx->width != width || avctx->height != height) {
|
||||
av_frame_unref(s->last_frame);
|
||||
if((width * height)/2048*7 > buf_end-buf)
|
||||
if((width * height)/2048*7 > bytestream2_get_bytes_left(&gb))
|
||||
return AVERROR_INVALIDDATA;
|
||||
if ((ret = ff_set_dimensions(avctx, width, height)) < 0)
|
||||
return ret;
|
||||
@@ -292,12 +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++)
|
||||
|
@@ -117,6 +117,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;
|
||||
@@ -151,8 +152,10 @@ static void mdct_ref(FFTSample *output, FFTSample *input, int nbits)
|
||||
output[k] = REF_SCALE(s, nbits - 1);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_MDCT */
|
||||
|
||||
#if FFT_FLOAT
|
||||
#if CONFIG_DCT
|
||||
static void idct_ref(FFTSample *output, FFTSample *input, int nbits)
|
||||
{
|
||||
int n = 1<<nbits;
|
||||
@@ -185,6 +188,7 @@ static void dct_ref(FFTSample *output, FFTSample *input, int nbits)
|
||||
output[k] = s;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_DCT */
|
||||
#endif
|
||||
|
||||
|
||||
@@ -310,6 +314,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)
|
||||
@@ -318,6 +323,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");
|
||||
@@ -327,6 +333,7 @@ int main(int argc, char **argv)
|
||||
fft_ref_init(fft_nbits, do_inverse);
|
||||
break;
|
||||
#if FFT_FLOAT
|
||||
# if CONFIG_RDFT
|
||||
case TRANSFORM_RDFT:
|
||||
if (do_inverse)
|
||||
av_log(NULL, AV_LOG_INFO,"IDFT_C2R");
|
||||
@@ -335,6 +342,7 @@ 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)
|
||||
@@ -343,7 +351,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
|
||||
# endif /* CONFIG_DCT */
|
||||
#endif
|
||||
default:
|
||||
av_log(NULL, AV_LOG_ERROR, "Requested transform not supported\n");
|
||||
@@ -362,6 +370,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);
|
||||
@@ -375,6 +384,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);
|
||||
@@ -384,6 +394,7 @@ int main(int argc, char **argv)
|
||||
err = check_diff((FFTSample *)tab_ref, (FFTSample *)tab, fft_size * 2, 1.0);
|
||||
break;
|
||||
#if FFT_FLOAT
|
||||
#if CONFIG_RDFT
|
||||
case TRANSFORM_RDFT:
|
||||
fft_size_2 = fft_size >> 1;
|
||||
if (do_inverse) {
|
||||
@@ -415,6 +426,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);
|
||||
@@ -425,6 +438,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
err = check_diff((float *)tab_ref, (float *)tab, fft_size, 1.0);
|
||||
break;
|
||||
#endif /* CONFIG_DCT */
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -476,21 +490,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 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
|
||||
# endif /* CONFIG_DCT */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -87,6 +87,7 @@ typedef struct G2MContext {
|
||||
|
||||
int compression;
|
||||
int width, height, bpp;
|
||||
int orig_width, orig_height;
|
||||
int tile_width, tile_height;
|
||||
int tiles_x, tiles_y, tile_x, tile_y;
|
||||
|
||||
@@ -700,8 +701,8 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
|
||||
}
|
||||
c->width = bytestream2_get_be32(&bc);
|
||||
c->height = bytestream2_get_be32(&bc);
|
||||
if (c->width < 16 || c->width > avctx->width ||
|
||||
c->height < 16 || c->height > avctx->height) {
|
||||
if (c->width < 16 || c->width > c->orig_width ||
|
||||
c->height < 16 || c->height > c->orig_height) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Invalid frame dimensions %dx%d\n",
|
||||
c->width, c->height);
|
||||
@@ -867,6 +868,10 @@ static av_cold int g2m_decode_init(AVCodecContext *avctx)
|
||||
|
||||
avctx->pix_fmt = AV_PIX_FMT_RGB24;
|
||||
|
||||
// store original sizes and check against those if resize happens
|
||||
c->orig_width = avctx->width;
|
||||
c->orig_height = avctx->height;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -2142,10 +2142,10 @@ static void decode_postinit(H264Context *h, int setup_finished)
|
||||
stereo->type = AV_STEREO3D_CHECKERBOARD;
|
||||
break;
|
||||
case 1:
|
||||
stereo->type = AV_STEREO3D_LINES;
|
||||
stereo->type = AV_STEREO3D_COLUMNS;
|
||||
break;
|
||||
case 2:
|
||||
stereo->type = AV_STEREO3D_COLUMNS;
|
||||
stereo->type = AV_STEREO3D_LINES;
|
||||
break;
|
||||
case 3:
|
||||
if (h->quincunx_subsampling)
|
||||
|
@@ -691,7 +691,7 @@ typedef struct H264Context {
|
||||
|
||||
int16_t slice_row[MAX_SLICES]; ///< to detect when MAX_SLICES is too low
|
||||
|
||||
uint8_t parse_history[4];
|
||||
uint8_t parse_history[6];
|
||||
int parse_history_count;
|
||||
int parse_last_mb;
|
||||
uint8_t *edge_emu_buffer;
|
||||
|
@@ -28,6 +28,7 @@
|
||||
typedef struct H264BSFContext {
|
||||
uint8_t length_size;
|
||||
uint8_t first_idr;
|
||||
uint8_t idr_sps_pps_seen;
|
||||
int extradata_parsed;
|
||||
} H264BSFContext;
|
||||
|
||||
@@ -155,6 +156,7 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
|
||||
return ret;
|
||||
ctx->length_size = ret;
|
||||
ctx->first_idr = 1;
|
||||
ctx->idr_sps_pps_seen = 0;
|
||||
ctx->extradata_parsed = 1;
|
||||
}
|
||||
|
||||
@@ -174,8 +176,17 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
|
||||
if (buf + nal_size > buf_end || nal_size < 0)
|
||||
goto fail;
|
||||
|
||||
/* prepend only to the first type 5 NAL unit of an IDR picture */
|
||||
if (ctx->first_idr && (unit_type == 5 || unit_type == 7 || unit_type == 8)) {
|
||||
if (ctx->first_idr && (unit_type == 7 || unit_type == 8))
|
||||
ctx->idr_sps_pps_seen = 1;
|
||||
|
||||
/* if this is a new IDR picture following an IDR picture, reset the idr flag.
|
||||
* Just check first_mb_in_slice to be 0 as this is the simplest solution.
|
||||
* This could be checking idr_pic_id instead, but would complexify the parsing. */
|
||||
if (!ctx->first_idr && unit_type == 5 && (buf[1] & 0x80))
|
||||
ctx->first_idr = 1;
|
||||
|
||||
/* prepend only to the first type 5 NAL unit of an IDR picture, if no sps/pps are already present */
|
||||
if (ctx->first_idr && unit_type == 5 && !ctx->idr_sps_pps_seen) {
|
||||
if ((ret=alloc_and_copy(poutbuf, poutbuf_size,
|
||||
avctx->extradata, avctx->extradata_size,
|
||||
buf, nal_size)) < 0)
|
||||
@@ -185,8 +196,10 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
|
||||
if ((ret=alloc_and_copy(poutbuf, poutbuf_size,
|
||||
NULL, 0, buf, nal_size)) < 0)
|
||||
goto fail;
|
||||
if (!ctx->first_idr && unit_type == 1)
|
||||
if (!ctx->first_idr && unit_type == 1) {
|
||||
ctx->first_idr = 1;
|
||||
ctx->idr_sps_pps_seen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
buf += nal_size;
|
||||
|
@@ -91,7 +91,7 @@ static int h264_find_frame_end(H264Context *h, const uint8_t *buf,
|
||||
state = 7;
|
||||
} else {
|
||||
h->parse_history[h->parse_history_count++]= buf[i];
|
||||
if (h->parse_history_count>3) {
|
||||
if (h->parse_history_count>5) {
|
||||
unsigned int mb, last_mb= h->parse_last_mb;
|
||||
GetBitContext gb;
|
||||
|
||||
@@ -119,7 +119,7 @@ found:
|
||||
pc->frame_start_found = 0;
|
||||
if (h->is_avc)
|
||||
return next_avc;
|
||||
return i - (state & 5) - 3 * (state > 7);
|
||||
return i - (state & 5) - 5 * (state > 7);
|
||||
}
|
||||
|
||||
static int scan_mmco_reset(AVCodecParserContext *s)
|
||||
|
@@ -2818,6 +2818,8 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx)
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(s->pps_list); i++)
|
||||
av_buffer_unref(&s->pps_list[i]);
|
||||
|
||||
av_buffer_unref(&s->current_sps);
|
||||
|
||||
av_freep(&s->sh.entry_point_offset);
|
||||
av_freep(&s->sh.offset);
|
||||
av_freep(&s->sh.size);
|
||||
@@ -2939,6 +2941,13 @@ static int hevc_update_thread_context(AVCodecContext *dst,
|
||||
}
|
||||
}
|
||||
|
||||
av_buffer_unref(&s->current_sps);
|
||||
if (s0->current_sps) {
|
||||
s->current_sps = av_buffer_ref(s0->current_sps);
|
||||
if (!s->current_sps)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
if (s->sps != s0->sps)
|
||||
ret = set_sps(s, s0->sps);
|
||||
|
||||
|
@@ -776,6 +776,8 @@ typedef struct HEVCContext {
|
||||
AVBufferRef *sps_list[MAX_SPS_COUNT];
|
||||
AVBufferRef *pps_list[MAX_PPS_COUNT];
|
||||
|
||||
AVBufferRef *current_sps;
|
||||
|
||||
AVBufferPool *tab_mvf_pool;
|
||||
AVBufferPool *rpl_tab_pool;
|
||||
|
||||
|
@@ -331,6 +331,9 @@ static void hevc_close(AVCodecParserContext *s)
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(h->pps_list); i++)
|
||||
av_buffer_unref(&h->pps_list[i]);
|
||||
|
||||
av_buffer_unref(&h->current_sps);
|
||||
h->sps = NULL;
|
||||
|
||||
for (i = 0; i < h->nals_allocated; i++)
|
||||
av_freep(&h->nals[i].rbsp_buffer);
|
||||
av_freep(&h->nals);
|
||||
|
@@ -956,6 +956,12 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
|
||||
if (s->pps_list[i] && ((HEVCPPS*)s->pps_list[i]->data)->sps_id == sps_id)
|
||||
av_buffer_unref(&s->pps_list[i]);
|
||||
}
|
||||
if (s->sps_list[sps_id] && s->sps == (HEVCSPS*)s->sps_list[sps_id]->data) {
|
||||
av_buffer_unref(&s->current_sps);
|
||||
s->current_sps = av_buffer_ref(s->sps_list[sps_id]);
|
||||
if (!s->current_sps)
|
||||
s->sps = NULL;
|
||||
}
|
||||
av_buffer_unref(&s->sps_list[sps_id]);
|
||||
s->sps_list[sps_id] = sps_buf;
|
||||
}
|
||||
|
@@ -186,7 +186,8 @@ static int generate_joint_tables(HYuvContext *s)
|
||||
}
|
||||
}
|
||||
ff_free_vlc(&s->vlc[4]);
|
||||
if ((ret = init_vlc(&s->vlc[4], VLC_BITS, i, len, 1, 1, bits, 2, 2, 0)) < 0)
|
||||
if ((ret = init_vlc(&s->vlc[4], VLC_BITS, i, len, 1, 1,
|
||||
bits, 2, 2, 0)) < 0)
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
@@ -195,21 +196,20 @@ static int generate_joint_tables(HYuvContext *s)
|
||||
static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length)
|
||||
{
|
||||
GetBitContext gb;
|
||||
int i;
|
||||
int ret;
|
||||
int i, ret;
|
||||
int count = 3;
|
||||
|
||||
init_get_bits(&gb, src, length * 8);
|
||||
if ((ret = init_get_bits(&gb, src, length * 8)) < 0)
|
||||
return ret;
|
||||
|
||||
if (s->version > 2)
|
||||
count = 1 + s->alpha + 2*s->chroma;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (read_len_table(s->len[i], &gb, s->vlc_n) < 0)
|
||||
return -1;
|
||||
if (ff_huffyuv_generate_bits_table(s->bits[i], s->len[i], s->vlc_n) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if ((ret = read_len_table(s->len[i], &gb, s->vlc_n)) < 0)
|
||||
return ret;
|
||||
if ((ret = ff_huffyuv_generate_bits_table(s->bits[i], s->len[i], s->vlc_n)) < 0)
|
||||
return ret;
|
||||
ff_free_vlc(&s->vlc[i]);
|
||||
if ((ret = init_vlc(&s->vlc[i], VLC_BITS, s->vlc_n, s->len[i], 1, 1,
|
||||
s->bits[i], 4, 4, 0)) < 0)
|
||||
@@ -225,18 +225,17 @@ 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, 256) < 0)
|
||||
return -1;
|
||||
if ((ret = read_len_table(s->len[0], &gb, 256)) < 0)
|
||||
return ret;
|
||||
|
||||
init_get_bits(&gb, classic_shift_chroma,
|
||||
classic_shift_chroma_table_size * 8);
|
||||
if (read_len_table(s->len[1], &gb, 256) < 0)
|
||||
return -1;
|
||||
if ((ret = read_len_table(s->len[1], &gb, 256)) < 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];
|
||||
@@ -264,6 +263,7 @@ static int read_old_huffman_tables(HYuvContext *s)
|
||||
static av_cold int decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
HYuvContext *s = avctx->priv_data;
|
||||
int ret;
|
||||
|
||||
memset(s->vlc, 0, 4 * sizeof(VLC));
|
||||
|
||||
@@ -313,10 +313,10 @@ 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;
|
||||
}else{
|
||||
if ((ret = read_huffman_tables(s, avctx->extradata + 4,
|
||||
avctx->extradata_size - 4)) < 0)
|
||||
return ret;
|
||||
} else {
|
||||
switch (avctx->bits_per_coded_sample & 7) {
|
||||
case 1:
|
||||
s->predictor = LEFT;
|
||||
@@ -342,8 +342,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;
|
||||
}
|
||||
|
||||
if (s->version <= 2) {
|
||||
@@ -520,13 +520,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;
|
||||
@@ -535,23 +538,23 @@ 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;
|
||||
|
||||
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 < 8; 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, 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;
|
||||
@@ -798,14 +801,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];
|
||||
|
@@ -847,9 +847,9 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
break;
|
||||
case 4:
|
||||
bytestream2_init(&gb, buf, buf_size);
|
||||
if (avctx->codec_tag == MKTAG('R', 'G', 'B', '8'))
|
||||
if (avctx->codec_tag == MKTAG('R', 'G', 'B', '8') && avctx->pix_fmt == AV_PIX_FMT_RGB32)
|
||||
decode_rgb8(&gb, s->frame->data[0], avctx->width, avctx->height, s->frame->linesize[0]);
|
||||
else if (avctx->codec_tag == MKTAG('R', 'G', 'B', 'N'))
|
||||
else if (avctx->codec_tag == MKTAG('R', 'G', 'B', 'N') && avctx->pix_fmt == AV_PIX_FMT_RGB444)
|
||||
decode_rgbn(&gb, s->frame->data[0], avctx->width, avctx->height, s->frame->linesize[0]);
|
||||
else
|
||||
return unsupported(avctx);
|
||||
|
@@ -202,10 +202,10 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
|
||||
case AV_STEREO3D_CHECKERBOARD:
|
||||
fpa_type = 0;
|
||||
break;
|
||||
case AV_STEREO3D_LINES:
|
||||
case AV_STEREO3D_COLUMNS:
|
||||
fpa_type = 1;
|
||||
break;
|
||||
case AV_STEREO3D_COLUMNS:
|
||||
case AV_STEREO3D_LINES:
|
||||
fpa_type = 2;
|
||||
break;
|
||||
case AV_STEREO3D_SIDEBYSIDE:
|
||||
|
@@ -1878,6 +1878,14 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
|
||||
} else
|
||||
goto eos;
|
||||
}
|
||||
if (s->mb_y >= ((s->height + 15) >> 4) &&
|
||||
s->progressive_frame &&
|
||||
!s->progressive_sequence &&
|
||||
get_bits_left(&s->gb) <= 8 &&
|
||||
get_bits_left(&s->gb) >= 0 &&
|
||||
s->mb_skip_run == -1 &&
|
||||
show_bits(&s->gb, 8) == 0)
|
||||
goto eos;
|
||||
|
||||
ff_init_block_index(s);
|
||||
}
|
||||
|
@@ -214,6 +214,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);
|
||||
@@ -224,11 +231,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;
|
||||
|
||||
|
@@ -472,7 +472,6 @@ static void put_alpha_run(PutBitContext *pb, int run)
|
||||
|
||||
// todo alpha quantisation for high quants
|
||||
static int encode_alpha_plane(ProresContext *ctx, PutBitContext *pb,
|
||||
const uint16_t *src, int linesize,
|
||||
int mbs_per_slice, uint16_t *blocks,
|
||||
int quant)
|
||||
{
|
||||
@@ -567,11 +566,16 @@ static int encode_slice(AVCodecContext *avctx, const AVFrame *pic,
|
||||
get_alpha_data(ctx, src, linesize, xp, yp,
|
||||
pwidth, avctx->height / ctx->pictures_per_frame,
|
||||
ctx->blocks[0], mbs_per_slice, ctx->alpha_bits);
|
||||
sizes[i] = encode_alpha_plane(ctx, pb, src, linesize,
|
||||
sizes[i] = encode_alpha_plane(ctx, pb,
|
||||
mbs_per_slice, ctx->blocks[0],
|
||||
quant);
|
||||
}
|
||||
total_size += sizes[i];
|
||||
if (put_bits_left(pb) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Serious underevaluation of"
|
||||
"required buffer size");
|
||||
return AVERROR_BUFFER_TOO_SMALL;
|
||||
}
|
||||
}
|
||||
return total_size;
|
||||
}
|
||||
@@ -942,9 +946,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
|
||||
avctx->coded_frame->key_frame = 1;
|
||||
|
||||
pkt_size = ctx->frame_size_upper_bound + FF_MIN_BUFFER_SIZE;
|
||||
pkt_size = ctx->frame_size_upper_bound;
|
||||
|
||||
if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size)) < 0)
|
||||
if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size + FF_MIN_BUFFER_SIZE)) < 0)
|
||||
return ret;
|
||||
|
||||
orig_buf = pkt->data;
|
||||
@@ -1021,7 +1025,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
slice_hdr = buf;
|
||||
buf += slice_hdr_size - 1;
|
||||
init_put_bits(&pb, buf, (pkt_size - (buf - orig_buf)) * 8);
|
||||
encode_slice(avctx, pic, &pb, sizes, x, y, q, mbs_per_slice);
|
||||
ret = encode_slice(avctx, pic, &pb, sizes, x, y, q, mbs_per_slice);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
bytestream_put_byte(&slice_hdr, q);
|
||||
slice_size = slice_hdr_size + sizes[ctx->num_planes - 1];
|
||||
|
@@ -689,7 +689,7 @@ av_cold void ff_snow_common_end(SnowContext *s)
|
||||
for(i=0; i<MAX_REF_FRAMES; i++){
|
||||
av_freep(&s->ref_mvs[i]);
|
||||
av_freep(&s->ref_scores[i]);
|
||||
if(s->last_picture[i]->data[0]) {
|
||||
if(s->last_picture[i] && s->last_picture[i]->data[0]) {
|
||||
av_assert0(s->last_picture[i]->data[0] != s->current_picture->data[0]);
|
||||
}
|
||||
av_frame_free(&s->last_picture[i]);
|
||||
|
@@ -60,6 +60,10 @@ typedef struct SVQ1Context {
|
||||
HpelDSPContext hdsp;
|
||||
GetBitContext gb;
|
||||
AVFrame *prev;
|
||||
|
||||
uint8_t *pkt_swapped;
|
||||
int pkt_swapped_allocated;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
int frame_code;
|
||||
@@ -624,7 +628,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;
|
||||
@@ -796,6 +817,8 @@ static av_cold int svq1_decode_end(AVCodecContext *avctx)
|
||||
SVQ1Context *s = avctx->priv_data;
|
||||
|
||||
av_frame_free(&s->prev);
|
||||
av_freep(&s->pkt_swapped);
|
||||
s->pkt_swapped_allocated = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -6005,7 +6005,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
/* skip B-frames if we don't have reference frames */
|
||||
if (s->last_picture_ptr == NULL && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) {
|
||||
goto err;
|
||||
goto end;
|
||||
}
|
||||
if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) ||
|
||||
(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) ||
|
||||
|
@@ -638,7 +638,7 @@ static uint32_t log2sample(uint32_t v, int limit, uint32_t *result)
|
||||
|
||||
if ((v += v >> 9) < (1 << 8)) {
|
||||
dbits = nbits_table[v];
|
||||
result += (dbits << 8) + wp_log2_table[(v << (9 - dbits)) & 0xff];
|
||||
*result += (dbits << 8) + wp_log2_table[(v << (9 - dbits)) & 0xff];
|
||||
} else {
|
||||
if (v < (1L << 16))
|
||||
dbits = nbits_table[v >> 8] + 8;
|
||||
@@ -647,7 +647,7 @@ static uint32_t log2sample(uint32_t v, int limit, uint32_t *result)
|
||||
else
|
||||
dbits = nbits_table[v >> 24] + 24;
|
||||
|
||||
result += dbits = (dbits << 8) + wp_log2_table[(v >> (dbits - 9)) & 0xff];
|
||||
*result += dbits = (dbits << 8) + wp_log2_table[(v >> (dbits - 9)) & 0xff];
|
||||
|
||||
if (limit && dbits >= limit)
|
||||
return 1;
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include "avdevice.h"
|
||||
|
||||
typedef struct {
|
||||
AVClass *class;
|
||||
int fd;
|
||||
} V4L2Context;
|
||||
|
||||
|
@@ -308,6 +308,7 @@ static void select_frame(AVFilterContext *ctx, AVFrame *frame)
|
||||
select->var_values[VAR_PTS] = TS2D(frame->pts);
|
||||
select->var_values[VAR_T ] = TS2D(frame->pts) * av_q2d(inlink->time_base);
|
||||
select->var_values[VAR_POS] = av_frame_get_pkt_pos(frame) == -1 ? NAN : av_frame_get_pkt_pos(frame);
|
||||
select->var_values[VAR_KEY] = frame->key_frame;
|
||||
|
||||
switch (inlink->type) {
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
@@ -337,21 +338,20 @@ static void select_frame(AVFilterContext *ctx, AVFrame *frame)
|
||||
select->var_values[VAR_N],
|
||||
select->var_values[VAR_PTS],
|
||||
select->var_values[VAR_T],
|
||||
(int)select->var_values[VAR_KEY]);
|
||||
frame->key_frame);
|
||||
|
||||
switch (inlink->type) {
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
av_log(inlink->dst, AV_LOG_DEBUG, " interlace_type:%c pict_type:%c scene:%f",
|
||||
select->var_values[VAR_INTERLACE_TYPE] == INTERLACE_TYPE_P ? 'P' :
|
||||
select->var_values[VAR_INTERLACE_TYPE] == INTERLACE_TYPE_T ? 'T' :
|
||||
select->var_values[VAR_INTERLACE_TYPE] == INTERLACE_TYPE_B ? 'B' : '?',
|
||||
av_get_picture_type_char(select->var_values[VAR_PICT_TYPE]),
|
||||
(!frame->interlaced_frame) ? 'P' :
|
||||
frame->top_field_first ? 'T' : 'B',
|
||||
av_get_picture_type_char(frame->pict_type),
|
||||
select->var_values[VAR_SCENE]);
|
||||
break;
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
av_log(inlink->dst, AV_LOG_DEBUG, " samples_n:%d consumed_samples_n:%d",
|
||||
(int)select->var_values[VAR_SAMPLES_N],
|
||||
(int)select->var_values[VAR_CONSUMED_SAMPLES_N]);
|
||||
av_log(inlink->dst, AV_LOG_DEBUG, " samples_n:%d consumed_samples_n:%f",
|
||||
frame->nb_samples,
|
||||
select->var_values[VAR_CONSUMED_SAMPLES_N]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -72,30 +72,33 @@ static inline uint16_t dv_audio_12to16(uint16_t sample)
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the dumbest implementation of all -- it simply looks at
|
||||
* a fixed offset and if pack isn't there -- fails. We might want
|
||||
* to have a fallback mechanism for complete search of missing packs.
|
||||
*/
|
||||
static const uint8_t *dv_extract_pack(uint8_t *frame, enum dv_pack_type t)
|
||||
{
|
||||
int offs;
|
||||
int c;
|
||||
|
||||
switch (t) {
|
||||
case dv_audio_source:
|
||||
offs = (80 * 6 + 80 * 16 * 3 + 3);
|
||||
break;
|
||||
case dv_audio_control:
|
||||
offs = (80 * 6 + 80 * 16 * 4 + 3);
|
||||
break;
|
||||
case dv_video_control:
|
||||
offs = (80 * 5 + 48 + 5);
|
||||
break;
|
||||
case dv_timecode:
|
||||
offs = (80*1 + 3 + 3);
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
for (c = 0; c < 10; c++) {
|
||||
switch (t) {
|
||||
case dv_audio_source:
|
||||
if (c&1) offs = (80 * 6 + 80 * 16 * 0 + 3 + c*12000);
|
||||
else offs = (80 * 6 + 80 * 16 * 3 + 3 + c*12000);
|
||||
break;
|
||||
case dv_audio_control:
|
||||
if (c&1) offs = (80 * 6 + 80 * 16 * 1 + 3 + c*12000);
|
||||
else offs = (80 * 6 + 80 * 16 * 4 + 3 + c*12000);
|
||||
break;
|
||||
case dv_video_control:
|
||||
if (c&1) offs = (80 * 3 + 8 + c*12000);
|
||||
else offs = (80 * 5 + 48 + 5 + c*12000);
|
||||
break;
|
||||
case dv_timecode:
|
||||
offs = (80*1 + 3 + 3);
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
if (frame[offs] == t)
|
||||
break;
|
||||
}
|
||||
|
||||
return frame[offs] == t ? &frame[offs] : NULL;
|
||||
|
@@ -38,6 +38,7 @@ typedef struct LibRTMPContext {
|
||||
RTMP rtmp;
|
||||
char *app;
|
||||
char *playpath;
|
||||
char *temp_filename;
|
||||
} LibRTMPContext;
|
||||
|
||||
static void rtmp_log(int level, const char *fmt, va_list args)
|
||||
@@ -62,6 +63,7 @@ static int rtmp_close(URLContext *s)
|
||||
RTMP *r = &ctx->rtmp;
|
||||
|
||||
RTMP_Close(r);
|
||||
av_freep(&ctx->temp_filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -101,7 +103,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
|
||||
if (ctx->app) len += strlen(ctx->app) + sizeof(" app=");
|
||||
if (ctx->playpath) len += strlen(ctx->playpath) + sizeof(" playpath=");
|
||||
|
||||
if (!(filename = av_malloc(len)))
|
||||
if (!(ctx->temp_filename = filename = av_malloc(len)))
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
av_strlcpy(filename, s->filename, len);
|
||||
@@ -130,10 +132,9 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
|
||||
}
|
||||
|
||||
s->is_streamed = 1;
|
||||
rc = 0;
|
||||
return 0;
|
||||
fail:
|
||||
if (filename != s->filename)
|
||||
av_freep(&filename);
|
||||
av_freep(&ctx->temp_filename);
|
||||
if (rc)
|
||||
RTMP_Close(r);
|
||||
|
||||
|
@@ -468,7 +468,7 @@ static int tee_write_packet(AVFormatContext *avf, AVPacket *pkt)
|
||||
if ((ret = av_copy_packet(&pkt2, pkt)) < 0 ||
|
||||
(ret = av_dup_packet(&pkt2))< 0)
|
||||
if (!ret_all) {
|
||||
ret = ret_all;
|
||||
ret_all = ret;
|
||||
continue;
|
||||
}
|
||||
tb = avf ->streams[s ]->time_base;
|
||||
|
@@ -224,6 +224,9 @@ int av_parse_cpu_caps(unsigned *flags, const char *s)
|
||||
{ "vfp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFP }, .unit = "flags" },
|
||||
{ "vfpv3", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFPV3 }, .unit = "flags" },
|
||||
{ "neon", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON }, .unit = "flags" },
|
||||
#elif ARCH_AARCH64
|
||||
{ "neon", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON }, .unit = "flags" },
|
||||
{ "vfp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFP }, .unit = "flags" },
|
||||
#endif
|
||||
{ NULL },
|
||||
};
|
||||
|
@@ -18,6 +18,9 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVUTIL_STEREO3D_H
|
||||
#define AVUTIL_STEREO3D_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "frame.h"
|
||||
@@ -145,3 +148,5 @@ AVStereo3D *av_stereo3d_alloc(void);
|
||||
* @return The AVStereo3D structure to be filled by caller.
|
||||
*/
|
||||
AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame);
|
||||
|
||||
#endif /* AVUTIL_STEREO3D_H */
|
||||
|
@@ -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
|
||||
|
||||
define DEF_FFT_FIXED32
|
||||
FATE_FFT_FIXED32 += fate-fft-fixed32-$(1) fate-ifft-fixed32-$(1) \
|
||||
@@ -55,5 +55,5 @@ $(FATE_FFT_FIXED32): libavcodec/fft-fixed32-test$(EXESUF)
|
||||
$(FATE_FFT_FIXED32): CMD = run libavcodec/fft-fixed32-test $(CPUFLAGS:%=-c%) $(ARGS)
|
||||
$(FATE_FFT_FIXED32): REF = /dev/null
|
||||
|
||||
FATE-$(call ALLYES, AVCODEC FFT MDCT) += $(FATE_FFT) $(FATE_FFT_FIXED) $(FATE_FFT_FIXED32)
|
||||
fate-fft: $(FATE_FFT) $(FATE_FFT_FIXED) $(FATE_FFT_FIXED32)
|
||||
FATE-$(call ALLYES, AVCODEC FFT MDCT) += $(FATE_FFT-yes) $(FATE_FFT_FIXED-yes) $(FATE_FFT_FIXED32)
|
||||
fate-fft: $(FATE_FFT-yes) $(FATE_FFT_FIXED-yes) $(FATE_FFT_FIXED32)
|
||||
|
@@ -4,7 +4,11 @@
|
||||
|
||||
# check for git short hash
|
||||
if ! test "$revision"; then
|
||||
revision=$(cd "$1" && git describe --tags --match N 2> /dev/null)
|
||||
if (cd "$1" && grep git RELEASE 2> /dev/null >/dev/null) ; then
|
||||
revision=$(cd "$1" && git describe --tags --match N 2> /dev/null)
|
||||
else
|
||||
revision=$(cd "$1" && git describe --tags --always 2> /dev/null)
|
||||
fi
|
||||
fi
|
||||
|
||||
# Shallow Git clones (--depth) do not have the N tag:
|
||||
|
Reference in New Issue
Block a user