Compare commits
68 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1529dfb73a | |||
| e66d4725c7 | |||
| 5a1e0cae2f | |||
| d3b45f1378 | |||
| 5b44aec196 | |||
| 6c583ec9bd | |||
| ee89d9e3d6 | |||
| 1dec90d456 | |||
| 3de33c6e76 | |||
| 6a19167a6f | |||
| 457ed86478 | |||
| a7f6b27e3c | |||
| 517fd68acd | |||
| 69db79074f | |||
| 372c91b199 | |||
| ba7ba6db74 | |||
| fd235d7428 | |||
| 7edcd88a3f | |||
| 948e655d13 | |||
| 92e021ff95 | |||
| b34033dec2 | |||
| 7a9b43671a | |||
| ada9293402 | |||
| 7823b70004 | |||
| fc2bb55605 | |||
| cf65da16f8 | |||
| 209a28bb74 | |||
| 53ed19f374 | |||
| 818a3fd27c | |||
| b881ea0f9e | |||
| da3e2efad6 | |||
| 61268f2454 | |||
| d34b5c938b | |||
| 9f61f2f1ea | |||
| 36019fc088 | |||
| 3349be5745 | |||
| 80ecb421fe | |||
| bcc1fe5165 | |||
| 634f590061 | |||
| eba31bf944 | |||
| fc902dd374 | |||
| 6d5377c622 | |||
| 2547f92410 | |||
| 2a59101eb1 | |||
| be36e13e66 | |||
| 3bff0de66b | |||
| 3223f4229a | |||
| 3520590810 | |||
| 4d7bbeb164 | |||
| f5c6f81576 | |||
| 4eef201e15 | |||
| ebc43bef1f | |||
| 7e9bb72dd6 | |||
| eda64cda63 | |||
| ee20e3ff2d | |||
| b205d5a6d2 | |||
| 6449c086f1 | |||
| c99cb72d27 | |||
| 611eb95943 | |||
| 0f8e2a0b86 | |||
| b4e9103709 | |||
| 3a17fe2bdd | |||
| c1dc4d2d50 | |||
| 3dd3e8e24a | |||
| e008f89cfa | |||
| 370c346d5d | |||
| 299e0dff1f | |||
| c8dcda22f1 |
@@ -1,6 +1,74 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 4.2.1:
|
||||
- avformat/vividas: check for tiny blocks using alignment
|
||||
- avcodec/vc1_pred: Fix refdist in scaleforopp()
|
||||
- avcodec/vorbisdec: fix FASTDIV usage for vr_type == 2
|
||||
- avcodec/iff: Check for overlap in cmap_read_palette()
|
||||
- avcodec/apedec: Fix 32bit int overflow in do_apply_filter()
|
||||
- lavf/rawenc: Only accept the appropriate stream type for raw muxers.
|
||||
- avformat/matroskadec: use av_fast_realloc to reallocate ebml list arrays
|
||||
- avformat/matroskadec: use proper types for some EbmlSyntax fields
|
||||
- avcodec/ralf: fix undefined shift in extend_code()
|
||||
- avcodec/ralf: fix undefined shift
|
||||
- avcodec/bgmc: Check input space in ff_bgmc_decode_init()
|
||||
- avcodec/vp3: Check for end of input in 2 places of vp4_unpack_macroblocks()
|
||||
- avcodec/truemotion2: Fix multiple integer overflows in tm2_null_res_block()
|
||||
- avcodec/vc1_block: Check the return code from vc1_decode_p_block()
|
||||
- avcodec/vc1dec: Require res_sprite for wmv3images
|
||||
- avcodec/vc1_block: Check for double escapes
|
||||
- avcodec/vorbisdec: Check get_vlc2() failure
|
||||
- avcodec/tta: Fix integer overflow in prediction
|
||||
- avcodec/vb: Check input packet size to be large enough to contain flags
|
||||
- avcodec/cavsdec: Limit the number of access units per packet to 2
|
||||
- avcodec/atrac9dec: Check block_align
|
||||
- avcodec/alac: Check for bps of 0
|
||||
- avcodec/alac: Fix multiple integer overflows in lpc_prediction()
|
||||
- avcodec/rl2: set dimensions
|
||||
- avcodec/aacdec: Add FF_CODEC_CAP_INIT_CLEANUP
|
||||
- avcodec/idcinvideo: Add 320x240 default maximum resolution
|
||||
- avformat/realtextdec: free queue on error
|
||||
- avcodec/vp5/6/8: use vpX_rac_is_end()
|
||||
- avformat/vividas: Check av_xiphlacing() return value before use
|
||||
- avcodec/alsdec: Fix integer overflow in decode_var_block_data()
|
||||
- avcodec/alsdec: Limit maximum channels to 512
|
||||
- avcodec/anm: Check input size for a frame with just a stop code
|
||||
- avcodec/flicvideo: Optimize and Simplify FLI_COPY in flic_decode_frame_24BPP() by using bytestream2_get_buffer()
|
||||
- avcodec/loco: Check left column value
|
||||
- avcodec/ffwavesynth: Fixes invalid shift with pink noise seeking
|
||||
- avcodec/ffwavesynth: Fix integer overflow for some corner case values
|
||||
- avcodec/indeo2: Check remaining input more often
|
||||
- avcodec/diracdec: Check that slices are fewer than pixels
|
||||
- avcodec/vp56: Consider the alpha start as end of the prior header
|
||||
- avcodec/4xm: Check for end of input in decode_p_block()
|
||||
- avcodec/hevcdec: Check delta_luma_weight_l0/1
|
||||
- avcodec/hnm4video: Optimize postprocess_current_frame()
|
||||
- avcodec/hevc_refs: Optimize 16bit generate_missing_ref()
|
||||
- avcodec/scpr: Use av_memcpy_backptr() in type 17 and 33
|
||||
- avcodec/tiff: Enforce increasing offsets
|
||||
- avcodec/dds: Use ff_set_dimensions()
|
||||
- avformat/vividas: Fix another infinite loop
|
||||
- avformat/vividas: Fix infinite loop in header parser
|
||||
- avcodec/mpc8: Fix 32bit mask/enum
|
||||
- avcodec/alsdec: Fix integer overflows of raw_samples in decode_var_block_data()
|
||||
- avcodec/alsdec: Fix integer overflow of raw_samples in decode_blocks()
|
||||
- avcodec/alsdec: fix mantisse shift
|
||||
- avcodec/pngdec: consider chunk size in minimal size check
|
||||
- avcodec/vc1_block: Fix invalid shifts in vc1_decode_i_blocks()
|
||||
- avcodec/vc1_block: fix invalid shift in vc1_decode_p_mb()
|
||||
- avcodec/aacdec_template: fix integer overflow in imdct_and_windowing()
|
||||
- avformat/mpegts: Check if ready on SCTE reception
|
||||
- avcodec/omx: fix xFramerate calculation
|
||||
- avformat/avidec: add support for recognizing HEVC fourcc when demuxing
|
||||
- avformat/mpegts: fix teletext PTS when selecting teletext streams only
|
||||
- avcodec/h2645_parse: zero initialize the rbsp buffer
|
||||
- avcodec/omx: Fix handling of fragmented buffers
|
||||
- avcodec/omx: ensure zerocopy mode can be disabled on rpi builds
|
||||
- avformat/mxfdec: do not ignore bad size errors
|
||||
- avformat/matroskadec: Fix seeking
|
||||
- ffplay: properly detect all window size changes
|
||||
|
||||
version 4.2:
|
||||
- tpad filter
|
||||
- AV1 decoding support through libdav1d
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 4.2
|
||||
PROJECT_NUMBER = 4.2.1
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
||||
+1
-1
@@ -3436,7 +3436,7 @@ static void event_loop(VideoState *cur_stream)
|
||||
break;
|
||||
case SDL_WINDOWEVENT:
|
||||
switch (event.window.event) {
|
||||
case SDL_WINDOWEVENT_RESIZED:
|
||||
case SDL_WINDOWEVENT_SIZE_CHANGED:
|
||||
screen_width = cur_stream->width = event.window.data1;
|
||||
screen_height = cur_stream->height = event.window.data2;
|
||||
if (cur_stream->vis_texture) {
|
||||
|
||||
@@ -351,6 +351,8 @@ static int decode_p_block(FourXContext *f, uint16_t *dst, const uint16_t *src,
|
||||
index = size2index[log2h][log2w];
|
||||
av_assert0(index >= 0);
|
||||
|
||||
if (get_bits_left(&f->gb) < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
h = 1 << log2h;
|
||||
code = get_vlc2(&f->gb, block_type_vlc[1 - (f->version > 1)][index].table,
|
||||
BLOCK_TYPE_VLC_BITS, 1);
|
||||
|
||||
+2
-2
@@ -559,7 +559,7 @@ AVCodec ff_aac_decoder = {
|
||||
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE
|
||||
},
|
||||
.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.channel_layouts = aac_channel_layout,
|
||||
.flush = flush,
|
||||
.priv_class = &aac_decoder_class,
|
||||
@@ -584,7 +584,7 @@ AVCodec ff_aac_latm_decoder = {
|
||||
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE
|
||||
},
|
||||
.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.channel_layouts = aac_channel_layout,
|
||||
.flush = flush,
|
||||
.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
|
||||
|
||||
@@ -2659,7 +2659,7 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce)
|
||||
ac->mdct.imdct_half(&ac->mdct, buf, in);
|
||||
#if USE_FIXED
|
||||
for (i=0; i<1024; i++)
|
||||
buf[i] = (buf[i] + 4) >> 3;
|
||||
buf[i] = (buf[i] + 4LL) >> 3;
|
||||
#endif /* USE_FIXED */
|
||||
}
|
||||
|
||||
|
||||
+7
-5
@@ -171,12 +171,12 @@ static inline int sign_only(int v)
|
||||
return v ? FFSIGN(v) : 0;
|
||||
}
|
||||
|
||||
static void lpc_prediction(int32_t *error_buffer, int32_t *buffer_out,
|
||||
static void lpc_prediction(int32_t *error_buffer, uint32_t *buffer_out,
|
||||
int nb_samples, int bps, int16_t *lpc_coefs,
|
||||
int lpc_order, int lpc_quant)
|
||||
{
|
||||
int i;
|
||||
int32_t *pred = buffer_out;
|
||||
uint32_t *pred = buffer_out;
|
||||
|
||||
/* first sample always copies */
|
||||
*buffer_out = *error_buffer;
|
||||
@@ -208,7 +208,7 @@ static void lpc_prediction(int32_t *error_buffer, int32_t *buffer_out,
|
||||
for (; i < nb_samples; i++) {
|
||||
int j;
|
||||
int val = 0;
|
||||
int error_val = error_buffer[i];
|
||||
unsigned error_val = error_buffer[i];
|
||||
int error_sign;
|
||||
int d = *pred++;
|
||||
|
||||
@@ -222,7 +222,7 @@ static void lpc_prediction(int32_t *error_buffer, int32_t *buffer_out,
|
||||
/* adapt LPC coefficients */
|
||||
error_sign = sign_only(error_val);
|
||||
if (error_sign) {
|
||||
for (j = 0; j < lpc_order && error_val * error_sign > 0; j++) {
|
||||
for (j = 0; j < lpc_order && (int)error_val * error_sign > 0; j++) {
|
||||
int sign;
|
||||
val = d - pred[j];
|
||||
sign = sign_only(val) * error_sign;
|
||||
@@ -250,10 +250,12 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index,
|
||||
|
||||
alac->extra_bits = get_bits(&alac->gb, 2) << 3;
|
||||
bps = alac->sample_size - alac->extra_bits + channels - 1;
|
||||
if (bps > 32U) {
|
||||
if (bps > 32) {
|
||||
avpriv_report_missing_feature(avctx, "bps %d", bps);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
if (bps < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* whether the frame is compressed */
|
||||
is_compressed = !get_bits1(&alac->gb);
|
||||
|
||||
+18
-7
@@ -348,6 +348,11 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
|
||||
if (als_id != MKBETAG('A','L','S','\0'))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (avctx->channels > FF_SANE_NB_CHANNELS) {
|
||||
avpriv_request_sample(avctx, "Huge number of channels\n");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
ctx->cur_frame_length = sconf->frame_length;
|
||||
|
||||
// read channel config
|
||||
@@ -816,7 +821,9 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
unsigned int low;
|
||||
unsigned int value;
|
||||
|
||||
ff_bgmc_decode_init(gb, &high, &low, &value);
|
||||
int ret = ff_bgmc_decode_init(gb, &high, &low, &value);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
current_res = bd->raw_samples + start;
|
||||
|
||||
@@ -918,7 +925,7 @@ static int decode_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
y = 1 << 6;
|
||||
|
||||
for (base = begin; base < end; base++, tab++)
|
||||
y += MUL64(bd->ltp_gain[tab], raw_samples[base]);
|
||||
y += (uint64_t)MUL64(bd->ltp_gain[tab], raw_samples[base]);
|
||||
|
||||
raw_samples[ltp_smp] += y >> 7;
|
||||
}
|
||||
@@ -930,7 +937,7 @@ static int decode_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
y = 1 << 19;
|
||||
|
||||
for (sb = 0; sb < smp; sb++)
|
||||
y += MUL64(lpc_cof[sb], raw_samples[-(sb + 1)]);
|
||||
y += (uint64_t)MUL64(lpc_cof[sb], raw_samples[-(sb + 1)]);
|
||||
|
||||
*raw_samples++ -= y >> 20;
|
||||
parcor_to_lpc(smp, quant_cof, lpc_cof);
|
||||
@@ -946,7 +953,7 @@ static int decode_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
|
||||
// reconstruct difference signal for prediction (joint-stereo)
|
||||
if (bd->js_blocks && bd->raw_other) {
|
||||
int32_t *left, *right;
|
||||
uint32_t *left, *right;
|
||||
|
||||
if (bd->raw_other > raw_samples) { // D = R - L
|
||||
left = raw_samples;
|
||||
@@ -1175,10 +1182,10 @@ static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame,
|
||||
av_log(ctx->avctx, AV_LOG_WARNING, "Invalid channel pair.\n");
|
||||
|
||||
for (s = 0; s < div_blocks[b]; s++)
|
||||
bd[0].raw_samples[s] = bd[1].raw_samples[s] - bd[0].raw_samples[s];
|
||||
bd[0].raw_samples[s] = bd[1].raw_samples[s] - (unsigned)bd[0].raw_samples[s];
|
||||
} else if (bd[1].js_blocks) {
|
||||
for (s = 0; s < div_blocks[b]; s++)
|
||||
bd[1].raw_samples[s] = bd[1].raw_samples[s] + bd[0].raw_samples[s];
|
||||
bd[1].raw_samples[s] = bd[1].raw_samples[s] + (unsigned)bd[0].raw_samples[s];
|
||||
}
|
||||
|
||||
offset += div_blocks[b];
|
||||
@@ -1404,7 +1411,11 @@ static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b) {
|
||||
}
|
||||
}
|
||||
|
||||
mantissa = (unsigned int)(mantissa_temp >> cutoff_bit_count);
|
||||
if (cutoff_bit_count >= 0) {
|
||||
mantissa = (unsigned int)(mantissa_temp >> cutoff_bit_count);
|
||||
} else {
|
||||
mantissa = (unsigned int)(mantissa_temp <<-cutoff_bit_count);
|
||||
}
|
||||
|
||||
// Need one more shift?
|
||||
if (mantissa & 0x01000000ul) {
|
||||
|
||||
@@ -119,6 +119,9 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
uint8_t *dst, *dst_end;
|
||||
int count, ret;
|
||||
|
||||
if (buf_size < 7)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
|
||||
return ret;
|
||||
dst = s->frame->data[0];
|
||||
|
||||
+1
-1
@@ -1266,7 +1266,7 @@ static void do_apply_filter(APEContext *ctx, int version, APEFilter *f,
|
||||
f->delay - order,
|
||||
f->adaptcoeffs - order,
|
||||
order, APESIGN(*data));
|
||||
res = (res + (1 << (fracbits - 1))) >> fracbits;
|
||||
res = (int)(res + (1U << (fracbits - 1))) >> fracbits;
|
||||
res += *data;
|
||||
*data++ = res;
|
||||
|
||||
|
||||
@@ -842,6 +842,11 @@ static av_cold int atrac9_decode_init(AVCodecContext *avctx)
|
||||
|
||||
av_lfg_init(&s->lfg, 0xFBADF00D);
|
||||
|
||||
if (avctx->block_align <= 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid block align\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (avctx->extradata_size != 12) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid extradata length!\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
+6
-1
@@ -485,12 +485,17 @@ av_cold void ff_bgmc_end(uint8_t **cf_lut, int **cf_lut_status)
|
||||
|
||||
|
||||
/** Initialize decoding and reads the first value */
|
||||
void ff_bgmc_decode_init(GetBitContext *gb, unsigned int *h,
|
||||
int ff_bgmc_decode_init(GetBitContext *gb, unsigned int *h,
|
||||
unsigned int *l, unsigned int *v)
|
||||
{
|
||||
if (get_bits_left(gb) < VALUE_BITS)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
*h = TOP_VALUE;
|
||||
*l = 0;
|
||||
*v = get_bits_long(gb, VALUE_BITS);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, int **cf_lut_status);
|
||||
void ff_bgmc_end(uint8_t **cf_lut, int **cf_lut_status);
|
||||
|
||||
|
||||
void ff_bgmc_decode_init(GetBitContext *gb,
|
||||
int ff_bgmc_decode_init(GetBitContext *gb,
|
||||
unsigned int *h, unsigned int *l, unsigned int *v);
|
||||
|
||||
|
||||
|
||||
@@ -1215,6 +1215,7 @@ static int cavs_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
int input_size, ret;
|
||||
const uint8_t *buf_end;
|
||||
const uint8_t *buf_ptr;
|
||||
int frame_start = 0;
|
||||
|
||||
if (buf_size == 0) {
|
||||
if (!h->low_delay && h->DPB[0].f->data[0]) {
|
||||
@@ -1248,6 +1249,9 @@ static int cavs_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
h->got_keyframe = 1;
|
||||
}
|
||||
case PIC_PB_START_CODE:
|
||||
if (frame_start > 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
frame_start ++;
|
||||
if (*got_frame)
|
||||
av_frame_unref(data);
|
||||
*got_frame = 0;
|
||||
|
||||
+4
-3
@@ -613,6 +613,7 @@ static int dds_decode(AVCodecContext *avctx, void *data,
|
||||
AVFrame *frame = data;
|
||||
int mipmap;
|
||||
int ret;
|
||||
int width, height;
|
||||
|
||||
ff_texturedsp_init(&ctx->texdsp);
|
||||
bytestream2_init(gbc, avpkt->data, avpkt->size);
|
||||
@@ -631,9 +632,9 @@ static int dds_decode(AVCodecContext *avctx, void *data,
|
||||
|
||||
bytestream2_skip(gbc, 4); // flags
|
||||
|
||||
avctx->height = bytestream2_get_le32(gbc);
|
||||
avctx->width = bytestream2_get_le32(gbc);
|
||||
ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
|
||||
height = bytestream2_get_le32(gbc);
|
||||
width = bytestream2_get_le32(gbc);
|
||||
ret = ff_set_dimensions(avctx, width, height);
|
||||
if (ret < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid image size %dx%d.\n",
|
||||
avctx->width, avctx->height);
|
||||
|
||||
@@ -1276,7 +1276,9 @@ static int dirac_unpack_idwt_params(DiracContext *s)
|
||||
s->num_y = get_interleaved_ue_golomb(gb);
|
||||
if (s->num_x * s->num_y == 0 || s->num_x * (uint64_t)s->num_y > INT_MAX ||
|
||||
s->num_x * (uint64_t)s->avctx->width > INT_MAX ||
|
||||
s->num_y * (uint64_t)s->avctx->height > INT_MAX
|
||||
s->num_y * (uint64_t)s->avctx->height > INT_MAX ||
|
||||
s->num_x > s->avctx->width ||
|
||||
s->num_y > s->avctx->height
|
||||
) {
|
||||
av_log(s->avctx,AV_LOG_ERROR,"Invalid numx/y\n");
|
||||
s->num_x = s->num_y = 0;
|
||||
|
||||
@@ -220,7 +220,7 @@ static void wavesynth_seek(struct wavesynth_context *ws, int64_t ts)
|
||||
int64_t pink_ts_cur = (ws->cur_ts + PINK_UNIT - 1) & ~(PINK_UNIT - 1);
|
||||
int64_t pink_ts_next = ts & ~(PINK_UNIT - 1);
|
||||
int pos = ts & (PINK_UNIT - 1);
|
||||
lcg_seek(&ws->pink_state, (pink_ts_next - pink_ts_cur) << 1);
|
||||
lcg_seek(&ws->pink_state, (pink_ts_next - pink_ts_cur) * 2);
|
||||
if (pos) {
|
||||
pink_fill(ws);
|
||||
ws->pink_pos = pos;
|
||||
@@ -301,8 +301,8 @@ static int wavesynth_parse_extradata(AVCodecContext *avc)
|
||||
default:
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
in->amp0 = (int64_t)a1 << 32;
|
||||
in->damp = (((int64_t)a2 << 32) - ((int64_t)a1 << 32)) / dt;
|
||||
in->amp0 = (uint64_t)a1 << 32;
|
||||
in->damp = (int64_t)(((uint64_t)a2 << 32) - ((uint64_t)a1 << 32)) / dt;
|
||||
}
|
||||
if (edata != edata_end)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
@@ -1024,14 +1024,7 @@ static int flic_decode_frame_24BPP(AVCodecContext *avctx,
|
||||
for (y_ptr = 0; y_ptr < s->frame->linesize[0] * s->avctx->height;
|
||||
y_ptr += s->frame->linesize[0]) {
|
||||
|
||||
pixel_countdown = s->avctx->width;
|
||||
pixel_ptr = 0;
|
||||
while (pixel_countdown > 0) {
|
||||
pixel = bytestream2_get_le24(&g2);
|
||||
AV_WL24(&pixels[y_ptr + pixel_ptr], pixel);
|
||||
pixel_ptr += 3;
|
||||
pixel_countdown--;
|
||||
}
|
||||
bytestream2_get_buffer(&g2, pixels + y_ptr, 3*s->avctx->width);
|
||||
if (s->avctx->width & 1)
|
||||
bytestream2_skip(&g2, 3);
|
||||
}
|
||||
|
||||
@@ -345,13 +345,18 @@ static int find_next_start_code(const uint8_t *buf, const uint8_t *next_avc)
|
||||
|
||||
static void alloc_rbsp_buffer(H2645RBSP *rbsp, unsigned int size, int use_ref)
|
||||
{
|
||||
int min_size = size;
|
||||
|
||||
if (size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
|
||||
goto fail;
|
||||
size += AV_INPUT_BUFFER_PADDING_SIZE;
|
||||
|
||||
if (rbsp->rbsp_buffer_alloc_size >= size &&
|
||||
(!rbsp->rbsp_buffer_ref || av_buffer_is_writable(rbsp->rbsp_buffer_ref)))
|
||||
(!rbsp->rbsp_buffer_ref || av_buffer_is_writable(rbsp->rbsp_buffer_ref))) {
|
||||
av_assert0(rbsp->rbsp_buffer);
|
||||
memset(rbsp->rbsp_buffer + min_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
size = FFMIN(size + size / 16 + 32, INT_MAX);
|
||||
|
||||
@@ -360,7 +365,7 @@ static void alloc_rbsp_buffer(H2645RBSP *rbsp, unsigned int size, int use_ref)
|
||||
else
|
||||
av_free(rbsp->rbsp_buffer);
|
||||
|
||||
rbsp->rbsp_buffer = av_malloc(size);
|
||||
rbsp->rbsp_buffer = av_mallocz(size);
|
||||
if (!rbsp->rbsp_buffer)
|
||||
goto fail;
|
||||
rbsp->rbsp_buffer_alloc_size = size;
|
||||
|
||||
@@ -394,7 +394,7 @@ static void mark_ref(HEVCFrame *frame, int flag)
|
||||
static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc)
|
||||
{
|
||||
HEVCFrame *frame;
|
||||
int i, x, y;
|
||||
int i, y;
|
||||
|
||||
frame = alloc_frame(s);
|
||||
if (!frame)
|
||||
@@ -407,11 +407,11 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, int poc)
|
||||
frame->frame->buf[i]->size);
|
||||
} else {
|
||||
for (i = 0; frame->frame->data[i]; i++)
|
||||
for (y = 0; y < (s->ps.sps->height >> s->ps.sps->vshift[i]); y++)
|
||||
for (x = 0; x < (s->ps.sps->width >> s->ps.sps->hshift[i]); x++) {
|
||||
AV_WN16(frame->frame->data[i] + y * frame->frame->linesize[i] + 2 * x,
|
||||
1 << (s->ps.sps->bit_depth - 1));
|
||||
}
|
||||
for (y = 0; y < (s->ps.sps->height >> s->ps.sps->vshift[i]); y++) {
|
||||
uint8_t *dst = frame->frame->data[i] + y * frame->frame->linesize[i];
|
||||
AV_WN16(dst, 1 << (s->ps.sps->bit_depth - 1));
|
||||
av_memcpy_backptr(dst + 2, 2, 2*(s->ps.sps->width >> s->ps.sps->hshift[i]) - 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -182,6 +182,8 @@ static int pred_weight_table(HEVCContext *s, GetBitContext *gb)
|
||||
for (i = 0; i < s->sh.nb_refs[L0]; i++) {
|
||||
if (luma_weight_l0_flag[i]) {
|
||||
int delta_luma_weight_l0 = get_se_golomb(gb);
|
||||
if ((int8_t)delta_luma_weight_l0 != delta_luma_weight_l0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
s->sh.luma_weight_l0[i] = (1 << s->sh.luma_log2_weight_denom) + delta_luma_weight_l0;
|
||||
s->sh.luma_offset_l0[i] = get_se_golomb(gb);
|
||||
}
|
||||
@@ -224,6 +226,8 @@ static int pred_weight_table(HEVCContext *s, GetBitContext *gb)
|
||||
for (i = 0; i < s->sh.nb_refs[L1]; i++) {
|
||||
if (luma_weight_l1_flag[i]) {
|
||||
int delta_luma_weight_l1 = get_se_golomb(gb);
|
||||
if ((int8_t)delta_luma_weight_l1 != delta_luma_weight_l1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
s->sh.luma_weight_l1[i] = (1 << s->sh.luma_log2_weight_denom) + delta_luma_weight_l1;
|
||||
s->sh.luma_offset_l1[i] = get_se_golomb(gb);
|
||||
}
|
||||
|
||||
@@ -117,14 +117,17 @@ static void unpack_intraframe(AVCodecContext *avctx, uint8_t *src,
|
||||
static void postprocess_current_frame(AVCodecContext *avctx)
|
||||
{
|
||||
Hnm4VideoContext *hnm = avctx->priv_data;
|
||||
uint32_t x, y, src_x, src_y;
|
||||
uint32_t x, y, src_y;
|
||||
int width = hnm->width;
|
||||
|
||||
for (y = 0; y < hnm->height; y++) {
|
||||
uint8_t *dst = hnm->processed + y * width;
|
||||
const uint8_t *src = hnm->current;
|
||||
src_y = y - (y % 2);
|
||||
src_x = src_y * hnm->width + (y % 2);
|
||||
for (x = 0; x < hnm->width; x++) {
|
||||
hnm->processed[(y * hnm->width) + x] = hnm->current[src_x];
|
||||
src_x += 2;
|
||||
src += src_y * width + (y % 2);
|
||||
for (x = 0; x < width; x++) {
|
||||
dst[x] = *src;
|
||||
src += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,6 +243,11 @@ static int idcin_decode_frame(AVCodecContext *avctx,
|
||||
return buf_size;
|
||||
}
|
||||
|
||||
static const AVCodecDefault idcin_defaults[] = {
|
||||
{ "max_pixels", "320*240" },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
AVCodec ff_idcin_decoder = {
|
||||
.name = "idcinvideo",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("id Quake II CIN video"),
|
||||
@@ -252,4 +257,5 @@ AVCodec ff_idcin_decoder = {
|
||||
.init = idcin_decode_init,
|
||||
.decode = idcin_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DR1,
|
||||
.defaults = idcin_defaults,
|
||||
};
|
||||
|
||||
@@ -180,6 +180,10 @@ static int cmap_read_palette(AVCodecContext *avctx, uint32_t *pal)
|
||||
pal[i] = 0xFF000000 | gray2rgb((i * 255) >> avctx->bits_per_coded_sample);
|
||||
}
|
||||
if (s->masking == MASK_HAS_MASK) {
|
||||
if ((1 << avctx->bits_per_coded_sample) < count) {
|
||||
avpriv_request_sample(avctx, "overlapping mask");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
memcpy(pal + (1 << avctx->bits_per_coded_sample), pal, count * 4);
|
||||
for (i = 0; i < count; i++)
|
||||
pal[i] &= 0xFFFFFF;
|
||||
|
||||
+6
-5
@@ -79,10 +79,11 @@ static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst
|
||||
|
||||
for (j = 1; j < height; j++) {
|
||||
out = 0;
|
||||
if (get_bits_left(&ctx->gb) <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
while (out < width) {
|
||||
int c = ir2_get_code(&ctx->gb);
|
||||
int c;
|
||||
if (get_bits_left(&ctx->gb) <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
c = ir2_get_code(&ctx->gb);
|
||||
if (c >= 0x80) { /* we have a skip */
|
||||
c -= 0x7F;
|
||||
if (out + c*2 > width)
|
||||
@@ -123,9 +124,9 @@ static int ir2_decode_plane_inter(Ir2Context *ctx, int width, int height, uint8_
|
||||
|
||||
for (j = 0; j < height; j++) {
|
||||
out = 0;
|
||||
if (get_bits_left(&ctx->gb) <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
while (out < width) {
|
||||
if (get_bits_left(&ctx->gb) <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
c = ir2_get_code(&ctx->gb);
|
||||
if (c >= 0x80) { /* we have a skip */
|
||||
c -= 0x7F;
|
||||
|
||||
@@ -161,6 +161,8 @@ static int loco_decode_plane(LOCOContext *l, uint8_t *data, int width, int heigh
|
||||
for (j = 1; j < height; j++) {
|
||||
/* restore left column */
|
||||
val = loco_get_rice(&rc);
|
||||
if (val == INT_MIN)
|
||||
return AVERROR_INVALIDDATA;
|
||||
data[0] = data[-stride] + val;
|
||||
/* restore all other pixels */
|
||||
for (i = 1; i < width; i++) {
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ static inline int mpc8_dec_enum(GetBitContext *gb, int k, int n)
|
||||
do {
|
||||
n--;
|
||||
if (code >= C[n]) {
|
||||
bits |= 1 << n;
|
||||
bits |= 1U << n;
|
||||
code -= C[n];
|
||||
C -= 32;
|
||||
k--;
|
||||
|
||||
+8
-8
@@ -473,9 +473,9 @@ static av_cold int omx_component_init(AVCodecContext *avctx, const char *role)
|
||||
in_port_params.format.video.nFrameWidth = avctx->width;
|
||||
in_port_params.format.video.nFrameHeight = avctx->height;
|
||||
if (avctx->framerate.den > 0 && avctx->framerate.num > 0)
|
||||
in_port_params.format.video.xFramerate = (1 << 16) * avctx->framerate.num / avctx->framerate.den;
|
||||
in_port_params.format.video.xFramerate = (1LL << 16) * avctx->framerate.num / avctx->framerate.den;
|
||||
else
|
||||
in_port_params.format.video.xFramerate = (1 << 16) * avctx->time_base.den / avctx->time_base.num;
|
||||
in_port_params.format.video.xFramerate = (1LL << 16) * avctx->time_base.den / avctx->time_base.num;
|
||||
|
||||
err = OMX_SetParameter(s->handle, OMX_IndexParamPortDefinition, &in_port_params);
|
||||
CHECK(err);
|
||||
@@ -644,10 +644,6 @@ static av_cold int omx_encode_init(AVCodecContext *avctx)
|
||||
OMX_BUFFERHEADERTYPE *buffer;
|
||||
OMX_ERRORTYPE err;
|
||||
|
||||
#if CONFIG_OMX_RPI
|
||||
s->input_zerocopy = 1;
|
||||
#endif
|
||||
|
||||
s->omx_context = omx_init(avctx, s->libname, s->libprefix);
|
||||
if (!s->omx_context)
|
||||
return AVERROR_ENCODER_NOT_FOUND;
|
||||
@@ -739,6 +735,7 @@ static int omx_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
int ret = 0;
|
||||
OMX_BUFFERHEADERTYPE* buffer;
|
||||
OMX_ERRORTYPE err;
|
||||
int had_partial = 0;
|
||||
|
||||
if (frame) {
|
||||
uint8_t *dst[4];
|
||||
@@ -830,7 +827,7 @@ static int omx_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
// packet, or get EOS.
|
||||
buffer = get_buffer(&s->output_mutex, &s->output_cond,
|
||||
&s->num_done_out_buffers, s->done_out_buffers,
|
||||
!frame);
|
||||
!frame || had_partial);
|
||||
if (!buffer)
|
||||
break;
|
||||
|
||||
@@ -865,6 +862,9 @@ static int omx_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
s->output_buf = NULL;
|
||||
s->output_buf_size = 0;
|
||||
}
|
||||
#if CONFIG_OMX_RPI
|
||||
had_partial = 1;
|
||||
#endif
|
||||
} else {
|
||||
// End of frame, and the caller provided a preallocated frame
|
||||
if ((ret = ff_alloc_packet2(avctx, pkt, s->output_buf_size + buffer->nFilledLen, 0)) < 0) {
|
||||
@@ -913,7 +913,7 @@ static av_cold int omx_encode_end(AVCodecContext *avctx)
|
||||
static const AVOption options[] = {
|
||||
{ "omx_libname", "OpenMAX library name", OFFSET(libname), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VDE },
|
||||
{ "omx_libprefix", "OpenMAX library prefix", OFFSET(libprefix), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VDE },
|
||||
{ "zerocopy", "Try to avoid copying input frames if possible", OFFSET(input_zerocopy), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
|
||||
{ "zerocopy", "Try to avoid copying input frames if possible", OFFSET(input_zerocopy), AV_OPT_TYPE_INT, { .i64 = CONFIG_OMX_RPI }, 0, 1, VE },
|
||||
{ "profile", "Set the encoding profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = FF_PROFILE_UNKNOWN }, FF_PROFILE_UNKNOWN, FF_PROFILE_H264_HIGH, VE, "profile" },
|
||||
{ "baseline", "", 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_BASELINE }, 0, 0, VE, "profile" },
|
||||
{ "main", "", 0, AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_MAIN }, 0, 0, VE, "profile" },
|
||||
|
||||
+1
-1
@@ -1547,7 +1547,7 @@ static int decode_frame_lscr(AVCodecContext *avctx,
|
||||
return ret;
|
||||
|
||||
nb_blocks = bytestream2_get_le16(gb);
|
||||
if (bytestream2_get_bytes_left(gb) < 2 + nb_blocks * 12)
|
||||
if (bytestream2_get_bytes_left(gb) < 2 + nb_blocks * (12 + 8))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (s->last_picture.f->data[0]) {
|
||||
|
||||
@@ -1727,6 +1727,11 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
|
||||
s->sub_sampling = s->fft_order - 7;
|
||||
s->frequency_range = 255 / (1 << (2 - s->sub_sampling));
|
||||
|
||||
if (s->frame_size * 4 >> s->sub_sampling > MPA_FRAME_SIZE) {
|
||||
avpriv_request_sample(avctx, "large frames");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
switch ((s->sub_sampling * 2 + s->channels - 1)) {
|
||||
case 0: tmp = 40; break;
|
||||
case 1: tmp = 48; break;
|
||||
|
||||
+3
-3
@@ -220,7 +220,7 @@ static inline int extend_code(GetBitContext *gb, int val, int range, int bits)
|
||||
val -= range;
|
||||
}
|
||||
if (bits)
|
||||
val = (val << bits) | get_bits(gb, bits);
|
||||
val = ((unsigned)val << bits) | get_bits(gb, bits);
|
||||
return val;
|
||||
}
|
||||
|
||||
@@ -300,8 +300,8 @@ static int decode_channel(RALFContext *ctx, GetBitContext *gb, int ch,
|
||||
t = get_vlc2(gb, code_vlc->table, code_vlc->bits, 2);
|
||||
code1 = t / range2;
|
||||
code2 = t % range2;
|
||||
dst[i] = extend_code(gb, code1, range, 0) << add_bits;
|
||||
dst[i + 1] = extend_code(gb, code2, range, 0) << add_bits;
|
||||
dst[i] = extend_code(gb, code1, range, 0) * (1 << add_bits);
|
||||
dst[i + 1] = extend_code(gb, code2, range, 0) * (1 << add_bits);
|
||||
if (add_bits) {
|
||||
dst[i] |= get_bits(gb, add_bits);
|
||||
dst[i + 1] |= get_bits(gb, add_bits);
|
||||
|
||||
@@ -134,10 +134,15 @@ static av_cold int rl2_decode_init(AVCodecContext *avctx)
|
||||
Rl2Context *s = avctx->priv_data;
|
||||
int back_size;
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
s->avctx = avctx;
|
||||
avctx->pix_fmt = AV_PIX_FMT_PAL8;
|
||||
|
||||
ret = ff_set_dimensions(avctx, 320, 200);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/** parse extra data */
|
||||
if (!avctx->extradata || avctx->extradata_size < EXTRADATA1_SIZE) {
|
||||
av_log(avctx, AV_LOG_ERROR, "invalid extradata size\n");
|
||||
|
||||
+3
-4
@@ -532,7 +532,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
s->current_frame->linesize[0] / 4);
|
||||
} else if (type == 17 || type == 33) {
|
||||
uint32_t clr, *dst = (uint32_t *)s->current_frame->data[0];
|
||||
int x, y;
|
||||
int y;
|
||||
|
||||
frame->key_frame = 1;
|
||||
bytestream2_skip(gb, 1);
|
||||
@@ -548,9 +548,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
clr = bytestream2_get_le24(gb);
|
||||
}
|
||||
for (y = 0; y < avctx->height; y++) {
|
||||
for (x = 0; x < avctx->width; x++) {
|
||||
dst[x] = clr;
|
||||
}
|
||||
dst[0] = clr;
|
||||
av_memcpy_backptr((uint8_t*)(dst+1), 4, 4*avctx->width - 4);
|
||||
dst += s->current_frame->linesize[0] / 4;
|
||||
}
|
||||
} else if (type == 0 || type == 1) {
|
||||
|
||||
+10
-1
@@ -1399,7 +1399,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
TiffContext *const s = avctx->priv_data;
|
||||
AVFrame *const p = data;
|
||||
ThreadFrame frame = { .f = data };
|
||||
unsigned off;
|
||||
unsigned off, last_off;
|
||||
int le, ret, plane, planes;
|
||||
int i, j, entries, stride;
|
||||
unsigned soff, ssize;
|
||||
@@ -1454,6 +1454,7 @@ again:
|
||||
/** whether we should process this multi-page IFD's next page */
|
||||
retry_for_page = s->get_page && s->cur_page + 1 < s->get_page; // get_page is 1-indexed
|
||||
|
||||
last_off = off;
|
||||
if (retry_for_page) {
|
||||
// set offset to the next IFD
|
||||
off = ff_tget_long(&s->gb, le);
|
||||
@@ -1463,6 +1464,14 @@ again:
|
||||
}
|
||||
|
||||
if (retry_for_subifd || retry_for_page) {
|
||||
if (!off) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Requested entry not found\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (off <= last_off) {
|
||||
avpriv_request_sample(s->avctx, "non increasing IFD offset\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (off >= UINT_MAX - 14 || avpkt->size < off + 14) {
|
||||
av_log(avctx, AV_LOG_ERROR, "IFD offset is greater than image size\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -619,7 +619,7 @@ static inline void tm2_null_res_block(TM2Context *ctx, AVFrame *pic, int bx, int
|
||||
ct = ctx->D[0] + ctx->D[1] + ctx->D[2] + ctx->D[3];
|
||||
|
||||
if (bx > 0)
|
||||
left = last[-1] - ct;
|
||||
left = last[-1] - (unsigned)ct;
|
||||
else
|
||||
left = 0;
|
||||
|
||||
@@ -630,7 +630,7 @@ static inline void tm2_null_res_block(TM2Context *ctx, AVFrame *pic, int bx, int
|
||||
last[2] = right - (diff >> 2);
|
||||
last[3] = right;
|
||||
{
|
||||
int tp = left;
|
||||
unsigned tp = left;
|
||||
|
||||
ctx->D[0] = (tp + (ct >> 2)) - left;
|
||||
left += ctx->D[0];
|
||||
|
||||
+5
-5
@@ -227,7 +227,7 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
|
||||
GetBitContext gb;
|
||||
int i, ret;
|
||||
int cur_chan = 0, framelen = s->frame_length;
|
||||
int32_t *p;
|
||||
uint32_t *p;
|
||||
|
||||
if (avctx->err_recognition & AV_EF_CRCCHECK) {
|
||||
if (buf_size < 4 ||
|
||||
@@ -261,7 +261,7 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
|
||||
}
|
||||
|
||||
i = 0;
|
||||
for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++) {
|
||||
for (p = s->decode_buffer; (int32_t*)p < s->decode_buffer + (framelen * s->channels); p++) {
|
||||
int32_t *predictor = &s->ch_ctx[cur_chan].predictor;
|
||||
TTAFilter *filter = &s->ch_ctx[cur_chan].filter;
|
||||
TTARice *rice = &s->ch_ctx[cur_chan].rice;
|
||||
@@ -334,7 +334,7 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
|
||||
// decorrelate in case of multiple channels
|
||||
if (s->channels > 1) {
|
||||
int32_t *r = p - 1;
|
||||
for (*p += *r / 2; r > p - s->channels; r--)
|
||||
for (*p += *r / 2; r > (int32_t*)p - s->channels; r--)
|
||||
*r = *(r + 1) - *r;
|
||||
}
|
||||
cur_chan = 0;
|
||||
@@ -358,13 +358,13 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
|
||||
switch (s->bps) {
|
||||
case 1: {
|
||||
uint8_t *samples = (uint8_t *)frame->data[0];
|
||||
for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++)
|
||||
for (p = s->decode_buffer; (int32_t*)p < s->decode_buffer + (framelen * s->channels); p++)
|
||||
*samples++ = *p + 0x80;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
int16_t *samples = (int16_t *)frame->data[0];
|
||||
for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++)
|
||||
for (p = s->decode_buffer; (int32_t*)p < s->decode_buffer + (framelen * s->channels); p++)
|
||||
*samples++ = *p;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -199,6 +199,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
uint32_t size;
|
||||
int offset = 0;
|
||||
|
||||
if (avpkt->size < 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
bytestream2_init(&c->stream, avpkt->data, avpkt->size);
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
|
||||
+31
-14
@@ -526,7 +526,7 @@ static int vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip,
|
||||
int escape = decode210(gb);
|
||||
if (escape != 2) {
|
||||
index = get_vlc2(gb, ff_vc1_ac_coeff_table[codingset].table, AC_VLC_BITS, 3);
|
||||
if (index < 0)
|
||||
if (index >= ff_vc1_ac_sizes[codingset] - 1U)
|
||||
return AVERROR_INVALIDDATA;
|
||||
run = vc1_index_decode_table[codingset][index][0];
|
||||
level = vc1_index_decode_table[codingset][index][1];
|
||||
@@ -1378,13 +1378,15 @@ static int vc1_decode_p_mb(VC1Context *v)
|
||||
v->vc1dsp.vc1_inv_trans_8x8(v->block[v->cur_blk_idx][block_map[i]]);
|
||||
if (v->rangeredfrm)
|
||||
for (j = 0; j < 64; j++)
|
||||
v->block[v->cur_blk_idx][block_map[i]][j] <<= 1;
|
||||
v->block[v->cur_blk_idx][block_map[i]][j] *= 2;
|
||||
block_cbp |= 0xF << (i << 2);
|
||||
block_intra |= 1 << i;
|
||||
} else if (val) {
|
||||
pat = vc1_decode_p_block(v, v->block[v->cur_blk_idx][block_map[i]], i, mquant, ttmb, first_block,
|
||||
s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize,
|
||||
CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY), &block_tt);
|
||||
if (pat < 0)
|
||||
return pat;
|
||||
block_cbp |= pat << (i << 2);
|
||||
if (!v->ttmbf && ttmb < 8)
|
||||
ttmb = -1;
|
||||
@@ -1488,6 +1490,8 @@ static int vc1_decode_p_mb(VC1Context *v)
|
||||
(i & 4) ? s->uvlinesize : s->linesize,
|
||||
CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY),
|
||||
&block_tt);
|
||||
if (pat < 0)
|
||||
return pat;
|
||||
block_cbp |= pat << (i << 2);
|
||||
if (!v->ttmbf && ttmb < 8)
|
||||
ttmb = -1;
|
||||
@@ -1698,6 +1702,8 @@ static int vc1_decode_p_mb_intfr(VC1Context *v)
|
||||
first_block, s->dest[dst_idx] + off,
|
||||
(i & 4) ? s->uvlinesize : (s->linesize << fieldtx),
|
||||
CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY), &block_tt);
|
||||
if (pat < 0)
|
||||
return pat;
|
||||
block_cbp |= pat << (i << 2);
|
||||
if (!v->ttmbf && ttmb < 8)
|
||||
ttmb = -1;
|
||||
@@ -1834,6 +1840,8 @@ static int vc1_decode_p_mb_intfi(VC1Context *v)
|
||||
(i & 4) ? s->uvlinesize : s->linesize,
|
||||
CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY),
|
||||
&block_tt);
|
||||
if (pat < 0)
|
||||
return pat;
|
||||
block_cbp |= pat << (i << 2);
|
||||
if (!v->ttmbf && ttmb < 8)
|
||||
ttmb = -1;
|
||||
@@ -1853,7 +1861,7 @@ static int vc1_decode_p_mb_intfi(VC1Context *v)
|
||||
|
||||
/** Decode one B-frame MB (in Main profile)
|
||||
*/
|
||||
static void vc1_decode_b_mb(VC1Context *v)
|
||||
static int vc1_decode_b_mb(VC1Context *v)
|
||||
{
|
||||
MpegEncContext *s = &v->s;
|
||||
GetBitContext *gb = &s->gb;
|
||||
@@ -1919,7 +1927,7 @@ static void vc1_decode_b_mb(VC1Context *v)
|
||||
bmvtype = BMV_TYPE_INTERPOLATED;
|
||||
ff_vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
|
||||
vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
if (direct) {
|
||||
cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
|
||||
@@ -1936,7 +1944,7 @@ static void vc1_decode_b_mb(VC1Context *v)
|
||||
/* no coded blocks - effectively skipped */
|
||||
ff_vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
|
||||
vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
if (s->mb_intra && !mb_has_coeffs) {
|
||||
GET_MQUANT();
|
||||
@@ -1951,7 +1959,7 @@ static void vc1_decode_b_mb(VC1Context *v)
|
||||
/* interpolated skipped block */
|
||||
ff_vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
|
||||
vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
ff_vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
|
||||
@@ -1995,20 +2003,23 @@ static void vc1_decode_b_mb(VC1Context *v)
|
||||
i & 4 ? s->uvlinesize
|
||||
: s->linesize);
|
||||
} else if (val) {
|
||||
vc1_decode_p_block(v, s->block[i], i, mquant, ttmb,
|
||||
first_block, s->dest[dst_idx] + off,
|
||||
(i & 4) ? s->uvlinesize : s->linesize,
|
||||
CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY), NULL);
|
||||
int pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb,
|
||||
first_block, s->dest[dst_idx] + off,
|
||||
(i & 4) ? s->uvlinesize : s->linesize,
|
||||
CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY), NULL);
|
||||
if (pat < 0)
|
||||
return pat;
|
||||
if (!v->ttmbf && ttmb < 8)
|
||||
ttmb = -1;
|
||||
first_block = 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Decode one B-frame MB (in interlaced field B picture)
|
||||
*/
|
||||
static void vc1_decode_b_mb_intfi(VC1Context *v)
|
||||
static int vc1_decode_b_mb_intfi(VC1Context *v)
|
||||
{
|
||||
MpegEncContext *s = &v->s;
|
||||
GetBitContext *gb = &s->gb;
|
||||
@@ -2113,7 +2124,7 @@ static void vc1_decode_b_mb_intfi(VC1Context *v)
|
||||
dmv_x[1] = dmv_y[1] = pred_flag[0] = 0;
|
||||
if (!s->next_picture_ptr->field_picture) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Mixed field/frame direct mode not supported\n");
|
||||
return;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
ff_vc1_pred_b_mv_intfi(v, 0, dmv_x, dmv_y, 1, pred_flag);
|
||||
@@ -2158,6 +2169,8 @@ static void vc1_decode_b_mb_intfi(VC1Context *v)
|
||||
first_block, s->dest[dst_idx] + off,
|
||||
(i & 4) ? s->uvlinesize : s->linesize,
|
||||
CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY), &block_tt);
|
||||
if (pat < 0)
|
||||
return pat;
|
||||
block_cbp |= pat << (i << 2);
|
||||
if (!v->ttmbf && ttmb < 8)
|
||||
ttmb = -1;
|
||||
@@ -2167,6 +2180,8 @@ static void vc1_decode_b_mb_intfi(VC1Context *v)
|
||||
}
|
||||
v->cbp[s->mb_x] = block_cbp;
|
||||
v->ttblk[s->mb_x] = block_tt;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Decode one B-frame MB (in interlaced frame B picture)
|
||||
@@ -2453,6 +2468,8 @@ static int vc1_decode_b_mb_intfr(VC1Context *v)
|
||||
first_block, s->dest[dst_idx] + off,
|
||||
(i & 4) ? s->uvlinesize : (s->linesize << fieldtx),
|
||||
CONFIG_GRAY && (i & 4) && (s->avctx->flags & AV_CODEC_FLAG_GRAY), &block_tt);
|
||||
if (pat < 0)
|
||||
return pat;
|
||||
block_cbp |= pat << (i << 2);
|
||||
if (!v->ttmbf && ttmb < 8)
|
||||
ttmb = -1;
|
||||
@@ -2602,13 +2619,13 @@ static void vc1_decode_i_blocks(VC1Context *v)
|
||||
if (v->rangeredfrm)
|
||||
for (k = 0; k < 6; k++)
|
||||
for (j = 0; j < 64; j++)
|
||||
v->block[v->cur_blk_idx][block_map[k]][j] <<= 1;
|
||||
v->block[v->cur_blk_idx][block_map[k]][j] *= 2;
|
||||
vc1_put_blocks_clamped(v, 1);
|
||||
} else {
|
||||
if (v->rangeredfrm)
|
||||
for (k = 0; k < 6; k++)
|
||||
for (j = 0; j < 64; j++)
|
||||
v->block[v->cur_blk_idx][block_map[k]][j] = (v->block[v->cur_blk_idx][block_map[k]][j] - 64) << 1;
|
||||
v->block[v->cur_blk_idx][block_map[k]][j] = (v->block[v->cur_blk_idx][block_map[k]][j] - 64) * 2;
|
||||
vc1_put_blocks_clamped(v, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -197,9 +197,10 @@ static av_always_inline int scaleforopp(VC1Context *v, int n /* MV */,
|
||||
return n;
|
||||
}
|
||||
if (v->s.pict_type != AV_PICTURE_TYPE_B)
|
||||
refdist = FFMIN(v->refdist, 3);
|
||||
refdist = v->refdist;
|
||||
else
|
||||
refdist = dir ? v->brfd : v->frfd;
|
||||
refdist = FFMIN(refdist, 3);
|
||||
scaleopp = ff_vc1_field_mvpred_scales[dir ^ v->second_field][0][refdist];
|
||||
|
||||
n = (n * scaleopp >> 8) * (1 << hpel);
|
||||
|
||||
@@ -450,6 +450,11 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
|
||||
if ((ret = ff_vc1_decode_sequence_header(avctx, v, &gb)) < 0)
|
||||
return ret;
|
||||
|
||||
if (avctx->codec_id == AV_CODEC_ID_WMV3IMAGE && !v->res_sprite) {
|
||||
avpriv_request_sample(avctx, "Non sprite WMV3IMAGE");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
count = avctx->extradata_size*8 - get_bits_count(&gb);
|
||||
if (count > 0) {
|
||||
av_log(avctx, AV_LOG_INFO, "Extra data: %i bits left, value: %X\n",
|
||||
|
||||
+26
-8
@@ -1442,7 +1442,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
|
||||
int vqbook = vr->books[vqclass][pass];
|
||||
|
||||
if (vqbook >= 0 && vc->codebooks[vqbook].codevectors) {
|
||||
unsigned coffs;
|
||||
int coffs;
|
||||
unsigned dim = vc->codebooks[vqbook].dimensions;
|
||||
unsigned step = FASTDIV(vr->partition_size << 1, dim << 1);
|
||||
vorbis_codebook codebook = vc->codebooks[vqbook];
|
||||
@@ -1451,14 +1451,20 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
|
||||
|
||||
voffs = voffset+j*vlen;
|
||||
for (k = 0; k < step; ++k) {
|
||||
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
|
||||
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3);
|
||||
if (coffs < 0)
|
||||
return coffs;
|
||||
coffs *= dim;
|
||||
for (l = 0; l < dim; ++l)
|
||||
vec[voffs + k + l * step] += codebook.codevectors[coffs + l];
|
||||
}
|
||||
} else if (vr_type == 1) {
|
||||
voffs = voffset + j * vlen;
|
||||
for (k = 0; k < step; ++k) {
|
||||
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
|
||||
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3);
|
||||
if (coffs < 0)
|
||||
return coffs;
|
||||
coffs *= dim;
|
||||
for (l = 0; l < dim; ++l, ++voffs) {
|
||||
vec[voffs]+=codebook.codevectors[coffs+l];
|
||||
|
||||
@@ -1471,13 +1477,19 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
|
||||
|
||||
if (dim == 2) {
|
||||
for (k = 0; k < step; ++k) {
|
||||
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 2;
|
||||
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3);
|
||||
if (coffs < 0)
|
||||
return coffs;
|
||||
coffs *= 2;
|
||||
vec[voffs + k ] += codebook.codevectors[coffs ];
|
||||
vec[voffs + k + vlen] += codebook.codevectors[coffs + 1];
|
||||
}
|
||||
} else if (dim == 4) {
|
||||
for (k = 0; k < step; ++k, voffs += 2) {
|
||||
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 4;
|
||||
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3);
|
||||
if (coffs < 0)
|
||||
return coffs;
|
||||
coffs *= 4;
|
||||
vec[voffs ] += codebook.codevectors[coffs ];
|
||||
vec[voffs + 1 ] += codebook.codevectors[coffs + 2];
|
||||
vec[voffs + vlen ] += codebook.codevectors[coffs + 1];
|
||||
@@ -1485,7 +1497,10 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
|
||||
}
|
||||
} else
|
||||
for (k = 0; k < step; ++k) {
|
||||
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
|
||||
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3);
|
||||
if (coffs < 0)
|
||||
return coffs;
|
||||
coffs *= dim;
|
||||
for (l = 0; l < dim; l += 2, voffs++) {
|
||||
vec[voffs ] += codebook.codevectors[coffs + l ];
|
||||
vec[voffs + vlen] += codebook.codevectors[coffs + l + 1];
|
||||
@@ -1498,11 +1513,14 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
|
||||
}
|
||||
|
||||
} else if (vr_type == 2) {
|
||||
unsigned voffs_div = FASTDIV(voffset << 1, ch <<1);
|
||||
unsigned voffs_div = ch == 1 ? voffset : FASTDIV(voffset, ch);
|
||||
unsigned voffs_mod = voffset - voffs_div * ch;
|
||||
|
||||
for (k = 0; k < step; ++k) {
|
||||
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
|
||||
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3);
|
||||
if (coffs < 0)
|
||||
return coffs;
|
||||
coffs *= dim;
|
||||
for (l = 0; l < dim; ++l) {
|
||||
vec[voffs_div + voffs_mod * vlen] +=
|
||||
codebook.codevectors[coffs + l];
|
||||
|
||||
@@ -710,6 +710,8 @@ static int vp4_unpack_macroblocks(Vp3DecodeContext *s, GetBitContext *gb)
|
||||
has_partial = 0;
|
||||
bit = get_bits1(gb);
|
||||
for (i = 0; i < s->yuv_macroblock_count; i += current_run) {
|
||||
if (get_bits_left(gb) <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
current_run = vp4_get_mb_count(s, gb);
|
||||
if (current_run > s->yuv_macroblock_count - i)
|
||||
return -1;
|
||||
@@ -719,6 +721,8 @@ static int vp4_unpack_macroblocks(Vp3DecodeContext *s, GetBitContext *gb)
|
||||
}
|
||||
|
||||
if (has_partial) {
|
||||
if (get_bits_left(gb) <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
bit = get_bits1(gb);
|
||||
current_run = vp4_get_mb_count(s, gb);
|
||||
for (i = 0; i < s->yuv_macroblock_count; i++) {
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ static int vp5_parse_coeff(VP56Context *s)
|
||||
int b, i, cg, idx, ctx, ctx_last;
|
||||
int pt = 0; /* plane type (0 for Y, 1 for U or V) */
|
||||
|
||||
if (c->end <= c->buffer && c->bits >= 0) {
|
||||
if (vpX_rac_is_end(c)) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "End of AC stream reached in vp5_parse_coeff\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
+2
-2
@@ -572,7 +572,7 @@ int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
VP56Context *s = avctx->priv_data;
|
||||
AVFrame *const p = s->frames[VP56_FRAME_CURRENT];
|
||||
int remaining_buf_size = avpkt->size;
|
||||
int av_uninit(alpha_offset);
|
||||
int alpha_offset = remaining_buf_size;
|
||||
int i, res;
|
||||
int ret;
|
||||
|
||||
@@ -585,7 +585,7 @@ int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
res = s->parse_header(s, buf, remaining_buf_size);
|
||||
res = s->parse_header(s, buf, alpha_offset);
|
||||
if (res < 0)
|
||||
return res;
|
||||
|
||||
|
||||
+1
-1
@@ -473,7 +473,7 @@ static int vp6_parse_coeff(VP56Context *s)
|
||||
int b, i, cg, idx, ctx;
|
||||
int pt = 0; /* plane type (0 for Y, 1 for U or V) */
|
||||
|
||||
if (c->end <= c->buffer && c->bits >= 0) {
|
||||
if (vpX_rac_is_end(c)) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "End of AC stream reached in vp6_parse_coeff\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
+3
-3
@@ -661,7 +661,7 @@ static int vp7_decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_si
|
||||
s->fade_present = vp8_rac_get(c);
|
||||
}
|
||||
|
||||
if (c->end <= c->buffer && c->bits >= 0)
|
||||
if (vpX_rac_is_end(c))
|
||||
return AVERROR_INVALIDDATA;
|
||||
/* E. Fading information for previous frame */
|
||||
if (s->fade_present && vp8_rac_get(c)) {
|
||||
@@ -2372,7 +2372,7 @@ static av_always_inline int decode_mb_row_no_filter(AVCodecContext *avctx, void
|
||||
curframe->tf.f->data[2] + 8 * mb_y * s->uvlinesize
|
||||
};
|
||||
|
||||
if (c->end <= c->buffer && c->bits >= 0)
|
||||
if (vpX_rac_is_end(c))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (mb_y == 0)
|
||||
@@ -2403,7 +2403,7 @@ static av_always_inline int decode_mb_row_no_filter(AVCodecContext *avctx, void
|
||||
td->mv_bounds.mv_max.x = ((s->mb_width - 1) << 6) + MARGIN;
|
||||
|
||||
for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) {
|
||||
if (c->end <= c->buffer && c->bits >= 0)
|
||||
if (vpX_rac_is_end(c))
|
||||
return AVERROR_INVALIDDATA;
|
||||
// Wait for previous thread to read mb_x+2, and reach mb_y-1.
|
||||
if (prev_td != td) {
|
||||
|
||||
@@ -815,6 +815,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
"mov tag found in avi (fourcc %s)\n",
|
||||
av_fourcc2str(tag1));
|
||||
}
|
||||
if (!st->codecpar->codec_id)
|
||||
st->codecpar->codec_id = ff_codec_get_id(ff_codec_bmp_tags_unofficial, tag1);
|
||||
|
||||
/* This is needed to get the pict type which is necessary
|
||||
* for generating correct pts. */
|
||||
st->need_parsing = AVSTREAM_PARSE_HEADERS;
|
||||
|
||||
@@ -97,8 +97,8 @@ typedef enum {
|
||||
typedef const struct EbmlSyntax {
|
||||
uint32_t id;
|
||||
EbmlType type;
|
||||
int list_elem_size;
|
||||
int data_offset;
|
||||
size_t list_elem_size;
|
||||
size_t data_offset;
|
||||
union {
|
||||
int64_t i;
|
||||
uint64_t u;
|
||||
@@ -110,6 +110,7 @@ typedef const struct EbmlSyntax {
|
||||
|
||||
typedef struct EbmlList {
|
||||
int nb_elem;
|
||||
unsigned int alloc_elem_size;
|
||||
void *elem;
|
||||
} EbmlList;
|
||||
|
||||
@@ -757,7 +758,7 @@ static int matroska_reset_status(MatroskaDemuxContext *matroska,
|
||||
uint32_t id, int64_t position)
|
||||
{
|
||||
if (position >= 0) {
|
||||
int err = avio_seek(matroska->ctx->pb, position, SEEK_SET);
|
||||
int64_t err = avio_seek(matroska->ctx->pb, position, SEEK_SET);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
@@ -1236,8 +1237,13 @@ static int ebml_parse(MatroskaDemuxContext *matroska,
|
||||
data = (char *) data + syntax->data_offset;
|
||||
if (syntax->list_elem_size) {
|
||||
EbmlList *list = data;
|
||||
void *newelem = av_realloc_array(list->elem, list->nb_elem + 1,
|
||||
syntax->list_elem_size);
|
||||
void *newelem;
|
||||
|
||||
if ((unsigned)list->nb_elem + 1 >= UINT_MAX / syntax->list_elem_size)
|
||||
return AVERROR(ENOMEM);
|
||||
newelem = av_fast_realloc(list->elem,
|
||||
&list->alloc_elem_size,
|
||||
(list->nb_elem + 1) * syntax->list_elem_size);
|
||||
if (!newelem)
|
||||
return AVERROR(ENOMEM);
|
||||
list->elem = newelem;
|
||||
@@ -1490,6 +1496,7 @@ static void ebml_free(EbmlSyntax *syntax, void *data)
|
||||
ebml_free(syntax[i].def.n, ptr);
|
||||
av_freep(&list->elem);
|
||||
list->nb_elem = 0;
|
||||
list->alloc_elem_size = 0;
|
||||
} else
|
||||
ebml_free(syntax[i].def.n, data_off);
|
||||
default:
|
||||
|
||||
+12
-3
@@ -1303,15 +1303,17 @@ skip:
|
||||
st = pst;
|
||||
}
|
||||
}
|
||||
if (f->last_pcr != -1 && st && st->discard != AVDISCARD_ALL) {
|
||||
if (f->last_pcr != -1 && !f->discard) {
|
||||
// teletext packets do not always have correct timestamps,
|
||||
// the standard says they should be handled after 40.6 ms at most,
|
||||
// and the pcr error to this packet should be no more than 100 ms.
|
||||
// TODO: we should interpolate the PCR, not just use the last one
|
||||
int64_t pcr = f->last_pcr / 300;
|
||||
pcr_found = 1;
|
||||
pes->st->pts_wrap_reference = st->pts_wrap_reference;
|
||||
pes->st->pts_wrap_behavior = st->pts_wrap_behavior;
|
||||
if (st) {
|
||||
pes->st->pts_wrap_reference = st->pts_wrap_reference;
|
||||
pes->st->pts_wrap_behavior = st->pts_wrap_behavior;
|
||||
}
|
||||
if (pes->dts == AV_NOPTS_VALUE || pes->dts < pcr) {
|
||||
pes->pts = pes->dts = pcr;
|
||||
} else if (pes->st->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT &&
|
||||
@@ -1723,6 +1725,13 @@ static void scte_data_cb(MpegTSFilter *filter, const uint8_t *section,
|
||||
if (idx < 0)
|
||||
return;
|
||||
|
||||
/**
|
||||
* In case we receive an SCTE-35 packet before mpegts context is fully
|
||||
* initialized.
|
||||
*/
|
||||
if (!ts->pkt)
|
||||
return;
|
||||
|
||||
new_data_packet(section, section_len, ts->pkt);
|
||||
ts->pkt->stream_index = idx;
|
||||
prg = av_find_program_from_stream(ts->stream, NULL, idx);
|
||||
|
||||
@@ -3508,8 +3508,8 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
} else {
|
||||
if ((size = next_ofs - pos) <= 0) {
|
||||
av_log(s, AV_LOG_ERROR, "bad size: %"PRId64"\n", size);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto skip;
|
||||
mxf->current_klv_data = (KLVPacket){{0}};
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
// We must not overread, because the next edit unit might be in another KLV
|
||||
if (size > max_data_size)
|
||||
|
||||
@@ -39,6 +39,18 @@ static int force_one_stream(AVFormatContext *s)
|
||||
s->oformat->name);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
if ( s->oformat->audio_codec != AV_CODEC_ID_NONE
|
||||
&& s->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) {
|
||||
av_log(s, AV_LOG_ERROR, "%s files have exactly one audio stream\n",
|
||||
s->oformat->name);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
if ( s->oformat->video_codec != AV_CODEC_ID_NONE
|
||||
&& s->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO) {
|
||||
av_log(s, AV_LOG_ERROR, "%s files have exactly one video stream\n",
|
||||
s->oformat->name);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,6 +123,8 @@ static int realtext_read_header(AVFormatContext *s)
|
||||
|
||||
end:
|
||||
av_bprint_finalize(&buf, NULL);
|
||||
if (res < 0)
|
||||
ff_subtitles_queue_clean(&rt->q);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -491,6 +491,11 @@ const AVCodecTag ff_codec_bmp_tags[] = {
|
||||
{ AV_CODEC_ID_NONE, 0 }
|
||||
};
|
||||
|
||||
const AVCodecTag ff_codec_bmp_tags_unofficial[] = {
|
||||
{ AV_CODEC_ID_HEVC, MKTAG('H', 'E', 'V', 'C') },
|
||||
{ AV_CODEC_ID_NONE, 0 }
|
||||
};
|
||||
|
||||
const AVCodecTag ff_codec_wav_tags[] = {
|
||||
{ AV_CODEC_ID_PCM_S16LE, 0x0001 },
|
||||
/* must come after s16le in this list */
|
||||
|
||||
@@ -73,6 +73,8 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *pa
|
||||
extern const AVCodecTag ff_codec_bmp_tags[]; // exposed through avformat_get_riff_video_tags()
|
||||
extern const AVCodecTag ff_codec_wav_tags[];
|
||||
|
||||
extern const AVCodecTag ff_codec_bmp_tags_unofficial[];
|
||||
|
||||
void ff_parse_specific_params(AVStream *st, int *au_rate, int *au_ssize, int *au_scale);
|
||||
|
||||
int ff_read_riff_info(AVFormatContext *s, int64_t size);
|
||||
|
||||
+15
-2
@@ -153,6 +153,10 @@ static void decode_block(uint8_t *src, uint8_t *dest, unsigned size,
|
||||
|
||||
if (align) {
|
||||
uint32_t tmpkey = *key_ptr - key;
|
||||
if (a2 > s) {
|
||||
a2 = s;
|
||||
avpriv_request_sample(NULL, "tiny aligned block\n");
|
||||
}
|
||||
memcpy(tmp + align, src, a2);
|
||||
xor_block(tmp, tmp, 4, key, &tmpkey);
|
||||
memcpy(dest, tmp + align, a2);
|
||||
@@ -392,8 +396,14 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *
|
||||
p = st->codecpar->extradata;
|
||||
p[0] = 2;
|
||||
|
||||
for (j = 0; j < num_data - 1; j++)
|
||||
offset += av_xiphlacing(&p[offset], data_len[j]);
|
||||
for (j = 0; j < num_data - 1; j++) {
|
||||
unsigned delta = av_xiphlacing(&p[offset], data_len[j]);
|
||||
if (delta > data_len[j]) {
|
||||
av_free(pb);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
offset += delta;
|
||||
}
|
||||
|
||||
for (j = 0; j < num_data; j++) {
|
||||
int ret = avio_read(pb, &p[offset], data_len[j]);
|
||||
@@ -546,6 +556,9 @@ static int viv_read_header(AVFormatContext *s)
|
||||
break;
|
||||
|
||||
block_len = ffio_read_varlen(pb);
|
||||
if (avio_feof(pb) || block_len <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
block_type = avio_r8(pb);
|
||||
|
||||
if (block_type == 22) {
|
||||
|
||||
Reference in New Issue
Block a user