update ffmpeg to 3.4.8.

This commit is contained in:
Roy Tam 2020-07-20 09:46:52 +08:00
commit 7fec328c85
31 changed files with 320 additions and 235 deletions

View file

@ -1,6 +1,6 @@
This directory contains files used in goanna builds from FFmpeg
(http://ffmpeg.org). The current files are from FFmpeg as of
Release 3.4.2
Release 3.4.8
All source files match their path from the library's source archive.
Currently, we only use the vp8 and vp9 portion of the library, and only on x86

View file

@ -411,6 +411,8 @@ static int read_stream_mux_config(struct LATMContext *latmctx,
} else {
int esc;
do {
if (get_bits_left(gb) < 9)
return AVERROR_INVALIDDATA;
esc = get_bits(gb, 1);
skip_bits(gb, 8);
} while (esc);
@ -561,7 +563,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,
@ -586,7 +588,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),

View file

@ -1156,6 +1156,9 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
AACContext *ac = avctx->priv_data;
int ret;
if (avctx->sample_rate > 96000)
return AVERROR_INVALIDDATA;
ret = ff_thread_once(&aac_table_init, &aac_static_table_init);
if (ret != 0)
return AVERROR_UNKNOWN;
@ -1672,25 +1675,24 @@ static int decode_spectrum_and_dequant(AACContext *ac, INTFLOAT coef[1024],
}
} else if (cbt_m1 == NOISE_BT - 1) {
for (group = 0; group < (AAC_SIGNE)g_len; group++, cfo+=128) {
#if !USE_FIXED
float scale;
#endif /* !USE_FIXED */
INTFLOAT band_energy;
#if USE_FIXED
for (k = 0; k < off_len; k++) {
ac->random_state = lcg_random(ac->random_state);
#if USE_FIXED
cfo[k] = ac->random_state >> 3;
#else
cfo[k] = ac->random_state;
#endif /* USE_FIXED */
}
#if USE_FIXED
band_energy = ac->fdsp->scalarproduct_fixed(cfo, cfo, off_len);
band_energy = fixed_sqrt(band_energy, 31);
noise_scale(cfo, sf[idx], band_energy, off_len);
#else
float scale;
for (k = 0; k < off_len; k++) {
ac->random_state = lcg_random(ac->random_state);
cfo[k] = ac->random_state;
}
band_energy = ac->fdsp->scalarproduct_float(cfo, cfo, off_len);
scale = sf[idx] / sqrtf(band_energy);
ac->fdsp->vector_fmul_scalar(cfo, cfo, scale, off_len);
@ -2463,6 +2465,9 @@ static void apply_tns(INTFLOAT coef_param[1024], TemporalNoiseShaping *tns,
INTFLOAT tmp[TNS_MAX_ORDER+1];
UINTFLOAT *coef = coef_param;
if(!mmm)
return;
for (w = 0; w < ics->num_windows; w++) {
bottom = ics->num_swb;
for (filt = 0; filt < tns->n_filt[w]; filt++) {
@ -2627,7 +2632,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 */
}

View file

@ -414,33 +414,33 @@ static void hybrid_synthesis(PSDSPContext *dsp, INTFLOAT out[2][38][64],
memset(out[0][n], 0, 5*sizeof(out[0][n][0]));
memset(out[1][n], 0, 5*sizeof(out[1][n][0]));
for (i = 0; i < 12; i++) {
out[0][n][0] += in[ i][n][0];
out[1][n][0] += in[ i][n][1];
out[0][n][0] += (UINTFLOAT)in[ i][n][0];
out[1][n][0] += (UINTFLOAT)in[ i][n][1];
}
for (i = 0; i < 8; i++) {
out[0][n][1] += in[12+i][n][0];
out[1][n][1] += in[12+i][n][1];
out[0][n][1] += (UINTFLOAT)in[12+i][n][0];
out[1][n][1] += (UINTFLOAT)in[12+i][n][1];
}
for (i = 0; i < 4; i++) {
out[0][n][2] += in[20+i][n][0];
out[1][n][2] += in[20+i][n][1];
out[0][n][3] += in[24+i][n][0];
out[1][n][3] += in[24+i][n][1];
out[0][n][4] += in[28+i][n][0];
out[1][n][4] += in[28+i][n][1];
out[0][n][2] += (UINTFLOAT)in[20+i][n][0];
out[1][n][2] += (UINTFLOAT)in[20+i][n][1];
out[0][n][3] += (UINTFLOAT)in[24+i][n][0];
out[1][n][3] += (UINTFLOAT)in[24+i][n][1];
out[0][n][4] += (UINTFLOAT)in[28+i][n][0];
out[1][n][4] += (UINTFLOAT)in[28+i][n][1];
}
}
dsp->hybrid_synthesis_deint(out, in + 27, 5, len);
} else {
for (n = 0; n < len; n++) {
out[0][n][0] = in[0][n][0] + in[1][n][0] + in[2][n][0] +
in[3][n][0] + in[4][n][0] + in[5][n][0];
out[1][n][0] = in[0][n][1] + in[1][n][1] + in[2][n][1] +
in[3][n][1] + in[4][n][1] + in[5][n][1];
out[0][n][1] = in[6][n][0] + in[7][n][0];
out[1][n][1] = in[6][n][1] + in[7][n][1];
out[0][n][2] = in[8][n][0] + in[9][n][0];
out[1][n][2] = in[8][n][1] + in[9][n][1];
out[0][n][0] = (UINTFLOAT)in[0][n][0] + in[1][n][0] + in[2][n][0] +
(UINTFLOAT)in[3][n][0] + in[4][n][0] + in[5][n][0];
out[1][n][0] = (UINTFLOAT)in[0][n][1] + in[1][n][1] + in[2][n][1] +
(UINTFLOAT)in[3][n][1] + in[4][n][1] + in[5][n][1];
out[0][n][1] = (UINTFLOAT)in[6][n][0] + in[7][n][0];
out[1][n][1] = (UINTFLOAT)in[6][n][1] + in[7][n][1];
out[0][n][2] = (UINTFLOAT)in[8][n][0] + in[9][n][0];
out[1][n][2] = (UINTFLOAT)in[8][n][1] + in[9][n][1];
}
dsp->hybrid_synthesis_deint(out, in + 7, 3, len);
}

View file

@ -54,10 +54,10 @@ static void ps_hybrid_analysis_c(INTFLOAT (*out)[2], INTFLOAT (*in)[2],
INT64FLOAT sum_im = (INT64FLOAT)filter[i][6][0] * in[6][1];
for (j = 0; j < 6; j++) {
INTFLOAT in0_re = in[j][0];
INTFLOAT in0_im = in[j][1];
INTFLOAT in1_re = in[12-j][0];
INTFLOAT in1_im = in[12-j][1];
INT64FLOAT in0_re = in[j][0];
INT64FLOAT in0_im = in[j][1];
INT64FLOAT in1_re = in[12-j][0];
INT64FLOAT in1_im = in[12-j][1];
sum_re += (INT64FLOAT)filter[i][j][0] * (in0_re + in1_re) -
(INT64FLOAT)filter[i][j][1] * (in0_im - in1_im);
sum_im += (INT64FLOAT)filter[i][j][0] * (in0_im + in1_im) +

View file

@ -109,7 +109,7 @@ int avcodec_dct_init(AVDCT *dsp)
#if CONFIG_IDCTDSP
{
IDCTDSPContext idsp;
IDCTDSPContext idsp = {0};
ff_idctdsp_init(&idsp, avctx);
COPY(idsp, idct);
COPY(idsp, idct_permutation);

View file

@ -162,9 +162,9 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
uint32_t code;
volatile VLC_TYPE (* volatile table)[2]; // the double volatile is needed to prevent an internal compiler error in gcc 4.2
table_size = 1 << table_nb_bits;
if (table_nb_bits > 30)
return -1;
table_size = 1 << table_nb_bits;
table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC);
ff_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size);
if (table_index < 0)
@ -188,8 +188,9 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
}
for (k = 0; k < nb; k++) {
int bits = table[j][1];
int oldsym = table[j][0];
ff_dlog(NULL, "%4x: code=%d n=%d\n", j, i, n);
if (bits != 0 && bits != n) {
if ((bits || oldsym) && (bits != n || oldsym != symbol)) {
av_log(NULL, AV_LOG_ERROR, "incorrect codes\n");
return AVERROR_INVALIDDATA;
}
@ -226,6 +227,10 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
/* note: realloc has been done, so reload tables */
table = (volatile VLC_TYPE (*)[2])&vlc->table[table_index];
table[j][0] = index; //code
if (table[j][0] != index) {
avpriv_request_sample(NULL, "strange codes");
return AVERROR_PATCHWELCOME;
}
i = k-1;
}
}

View file

@ -47,7 +47,8 @@ void av_bsf_free(AVBSFContext **pctx)
av_opt_free(ctx);
av_packet_free(&ctx->internal->buffer_pkt);
if (ctx->internal)
av_packet_free(&ctx->internal->buffer_pkt);
av_freep(&ctx->internal);
av_freep(&ctx->priv_data);

View file

@ -216,16 +216,20 @@ static int find_headers_search(FLACParseContext *fpc, uint8_t *buf, int buf_size
uint32_t x;
for (i = 0; i < mod_offset; i++) {
if ((AV_RB16(buf + i) & 0xFFFE) == 0xFFF8)
size = find_headers_search_validate(fpc, search_start + i);
if ((AV_RB16(buf + i) & 0xFFFE) == 0xFFF8) {
int ret = find_headers_search_validate(fpc, search_start + i);
size = FFMAX(size, ret);
}
}
for (; i < buf_size - 1; i += 4) {
x = AV_RB32(buf + i);
if (((x & ~(x + 0x01010101)) & 0x80808080)) {
for (j = 0; j < 4; j++) {
if ((AV_RB16(buf + i + j) & 0xFFFE) == 0xFFF8)
size = find_headers_search_validate(fpc, search_start + i + j);
if ((AV_RB16(buf + i + j) & 0xFFFE) == 0xFFF8) {
int ret = find_headers_search_validate(fpc, search_start + i + j);
size = FFMAX(size, ret);
}
}
}
}

View file

@ -66,8 +66,8 @@ static void FUNC(flac_decorrelate_ls_c)(uint8_t **out, int32_t **in,
int i;
for (i = 0; i < len; i++) {
int a = in[0][i];
int b = in[1][i];
unsigned a = in[0][i];
unsigned b = in[1][i];
S(samples, 0, i) = a << shift;
S(samples, 1, i) = (a - b) << shift;
}
@ -80,8 +80,8 @@ static void FUNC(flac_decorrelate_rs_c)(uint8_t **out, int32_t **in,
int i;
for (i = 0; i < len; i++) {
int a = in[0][i];
int b = in[1][i];
unsigned a = in[0][i];
unsigned b = in[1][i];
S(samples, 0, i) = (a + b) << shift;
S(samples, 1, i) = b << shift;
}
@ -94,7 +94,7 @@ static void FUNC(flac_decorrelate_ms_c)(uint8_t **out, int32_t **in,
int i;
for (i = 0; i < len; i++) {
int a = in[0][i];
unsigned a = in[0][i];
int b = in[1][i];
a -= b >> 1;
S(samples, 0, i) = (a + b) << shift;

View file

@ -49,6 +49,8 @@ extern const uint8_t ff_interleaved_dirac_golomb_vlc_code[256];
/**
* Read an unsigned Exp-Golomb code in the range 0 to 8190.
*
* @returns the read value or a negative error code.
*/
static inline int get_ue_golomb(GetBitContext *gb)
{

View file

@ -296,7 +296,8 @@ int ff_h264_init_poc(int pic_field_poc[2], int *pic_poc,
if (picture_structure == PICT_FRAME)
field_poc[1] += pc->delta_poc_bottom;
} else if (sps->poc_type == 1) {
int abs_frame_num, expected_delta_per_poc_cycle, expectedpoc;
int abs_frame_num;
int64_t expected_delta_per_poc_cycle, expectedpoc;
int i;
if (sps->poc_cycle_length != 0)

View file

@ -373,9 +373,11 @@ int ff_h264_build_ref_list(H264Context *h, H264SliceContext *sl)
av_assert0(0);
}
if (i < 0) {
if (i < 0 || mismatches_ref(h, ref)) {
av_log(h->avctx, AV_LOG_ERROR,
"reference picture missing during reorder\n");
i < 0 ? "reference picture missing during reorder\n" :
"mismatching reference\n"
);
memset(&sl->ref_list[list][index], 0, sizeof(sl->ref_list[0][0])); // FIXME
} else {
for (i = index; i + 1 < sl->ref_count[list]; i++) {

View file

@ -626,7 +626,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
}
ret = ff_h2645_packet_split(&h->pkt, buf, buf_size, avctx, h->is_avc,
h->nal_length_size, avctx->codec_id, avctx->flags2 & AV_CODEC_FLAG2_FAST);
h->nal_length_size, avctx->codec_id, 0);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR,
"Error splitting the input into NAL units.\n");

View file

@ -642,11 +642,11 @@ int ff_hevc_cu_qp_delta_abs(HEVCContext *s)
}
if (prefix_val >= 5) {
int k = 0;
while (k < CABAC_MAX_BIN && get_cabac_bypass(&s->HEVClc->cc)) {
while (k < 7 && get_cabac_bypass(&s->HEVClc->cc)) {
suffix_val += 1 << k;
k++;
}
if (k == CABAC_MAX_BIN) {
if (k == 7) {
av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", k);
return AVERROR_INVALIDDATA;
}

View file

@ -1582,22 +1582,25 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx,
pps->entropy_coding_sync_enabled_flag = get_bits1(gb);
if (pps->tiles_enabled_flag) {
pps->num_tile_columns = get_ue_golomb_long(gb) + 1;
pps->num_tile_rows = get_ue_golomb_long(gb) + 1;
if (pps->num_tile_columns <= 0 ||
pps->num_tile_columns >= sps->width) {
int num_tile_columns_minus1 = get_ue_golomb(gb);
int num_tile_rows_minus1 = get_ue_golomb(gb);
if (num_tile_columns_minus1 < 0 ||
num_tile_columns_minus1 >= sps->ctb_width - 1) {
av_log(avctx, AV_LOG_ERROR, "num_tile_columns_minus1 out of range: %d\n",
pps->num_tile_columns - 1);
ret = AVERROR_INVALIDDATA;
num_tile_columns_minus1);
ret = num_tile_columns_minus1 < 0 ? num_tile_columns_minus1 : AVERROR_INVALIDDATA;
goto err;
}
if (pps->num_tile_rows <= 0 ||
pps->num_tile_rows >= sps->height) {
if (num_tile_rows_minus1 < 0 ||
num_tile_rows_minus1 >= sps->ctb_height - 1) {
av_log(avctx, AV_LOG_ERROR, "num_tile_rows_minus1 out of range: %d\n",
pps->num_tile_rows - 1);
ret = AVERROR_INVALIDDATA;
num_tile_rows_minus1);
ret = num_tile_rows_minus1 < 0 ? num_tile_rows_minus1 : AVERROR_INVALIDDATA;
goto err;
}
pps->num_tile_columns = num_tile_columns_minus1 + 1;
pps->num_tile_rows = num_tile_rows_minus1 + 1;
pps->column_width = av_malloc_array(pps->num_tile_columns, sizeof(*pps->column_width));
pps->row_height = av_malloc_array(pps->num_tile_rows, sizeof(*pps->row_height));

View file

@ -343,8 +343,8 @@ typedef struct HEVCPPS {
uint8_t tiles_enabled_flag;
uint8_t entropy_coding_sync_enabled_flag;
int num_tile_columns; ///< num_tile_columns_minus1 + 1
int num_tile_rows; ///< num_tile_rows_minus1 + 1
uint16_t num_tile_columns; ///< num_tile_columns_minus1 + 1
uint16_t num_tile_rows; ///< num_tile_rows_minus1 + 1
uint8_t uniform_spacing_flag;
uint8_t loop_filter_across_tiles_enabled_flag;

View file

@ -397,7 +397,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)
@ -410,11 +410,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);
}
}
}

View file

@ -181,6 +181,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);
}
@ -223,6 +225,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);
}
@ -474,7 +478,7 @@ static int hls_slice_header(HEVCContext *s)
sh->first_slice_in_pic_flag = get_bits1(gb);
if (s->ref && sh->first_slice_in_pic_flag) {
av_log(s->avctx, AV_LOG_ERROR, "Two slices reporting being the first in the same frame.\n");
return 1; // This slice will be skiped later, do not corrupt state
return 1; // This slice will be skipped later, do not corrupt state
}
if ((IS_IDR(s) || IS_BLA(s)) && sh->first_slice_in_pic_flag) {
@ -3250,6 +3254,8 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx)
ff_h2645_packet_uninit(&s->pkt);
ff_hevc_reset_sei(&s->sei);
return 0;
}
@ -3439,6 +3445,7 @@ static void hevc_decode_flush(AVCodecContext *avctx)
{
HEVCContext *s = avctx->priv_data;
ff_hevc_flush_dpb(s);
ff_hevc_reset_sei(&s->sei);
s->max_ra = INT_MAX;
s->eos = 1;
}

View file

@ -262,6 +262,9 @@ int ff_combine_frame(ParseContext *pc, int next,
for (; pc->overread > 0; pc->overread--)
pc->buffer[pc->index++] = pc->buffer[pc->overread_index++];
if (next > *buf_size)
return AVERROR(EINVAL);
/* flush remaining if EOF */
if (!*buf_size && next == END_NOT_FOUND)
next = 0;

View file

@ -515,7 +515,7 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
void ff_color_frame(AVFrame *frame, const int c[4])
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
int p, y, x;
int p, y;
av_assert0(desc->flags & AV_PIX_FMT_FLAG_PLANAR);
@ -524,13 +524,19 @@ void ff_color_frame(AVFrame *frame, const int c[4])
int is_chroma = p == 1 || p == 2;
int bytes = is_chroma ? AV_CEIL_RSHIFT(frame->width, desc->log2_chroma_w) : frame->width;
int height = is_chroma ? AV_CEIL_RSHIFT(frame->height, desc->log2_chroma_h) : frame->height;
for (y = 0; y < height; y++) {
if (desc->comp[0].depth >= 9) {
for (x = 0; x<bytes; x++)
((uint16_t*)dst)[x] = c[p];
}else
memset(dst, c[p], bytes);
if (desc->comp[0].depth >= 9) {
((uint16_t*)dst)[0] = c[p];
av_memcpy_backptr(dst + 2, 2, bytes - 2);
dst += frame->linesize[p];
for (y = 1; y < height; y++) {
memcpy(dst, frame->data[p], 2*bytes);
dst += frame->linesize[p];
}
} else {
for (y = 0; y < height; y++) {
memset(dst, c[p], bytes);
dst += frame->linesize[p];
}
}
}
}
@ -630,6 +636,7 @@ int attribute_align_arg ff_codec_open2_recursive(AVCodecContext *avctx, const AV
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
{
int ret = 0;
int codec_init_ok = 0;
AVDictionary *tmp = NULL;
const AVPixFmtDescriptor *pixdesc;
@ -771,6 +778,16 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
ret = AVERROR(EINVAL);
goto free_and_end;
}
if (avctx->sample_rate < 0) {
av_log(avctx, AV_LOG_ERROR, "Invalid sample rate: %d\n", avctx->sample_rate);
ret = AVERROR(EINVAL);
goto free_and_end;
}
if (avctx->block_align < 0) {
av_log(avctx, AV_LOG_ERROR, "Invalid block align: %d\n", avctx->block_align);
ret = AVERROR(EINVAL);
goto free_and_end;
}
avctx->codec = codec;
if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) &&
@ -1024,6 +1041,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (ret < 0) {
goto free_and_end;
}
codec_init_ok = 1;
}
ret=0;
@ -1056,6 +1074,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
ret = AVERROR(EINVAL);
goto free_and_end;
}
if (avctx->bits_per_coded_sample < 0) {
ret = AVERROR(EINVAL);
goto free_and_end;
}
if (avctx->sub_charenc) {
if (avctx->codec_type != AVMEDIA_TYPE_SUBTITLE) {
av_log(avctx, AV_LOG_ERROR, "Character encoding is only "
@ -1112,10 +1134,14 @@ end:
return ret;
free_and_end:
if (avctx->codec &&
(avctx->codec->caps_internal & FF_CODEC_CAP_INIT_CLEANUP))
if (avctx->codec && avctx->codec->close &&
(codec_init_ok ||
(avctx->codec->caps_internal & FF_CODEC_CAP_INIT_CLEANUP)))
avctx->codec->close(avctx);
if (HAVE_THREADS && avctx->internal->thread_ctx)
ff_thread_free(avctx);
if (codec->priv_class && codec->priv_data_size)
av_opt_free(avctx->priv_data);
av_opt_free(avctx);
@ -1128,6 +1154,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
av_dict_free(&tmp);
av_freep(&avctx->priv_data);
av_freep(&avctx->subtitle_header);
if (avctx->internal) {
av_frame_free(&avctx->internal->to_free);
av_frame_free(&avctx->internal->compat_decode_frame);

View file

@ -44,7 +44,8 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
src_y = 1 - block_h;
}
if (src_x >= w) {
src += (w - 1 - src_x) * sizeof(pixel);
// The subtracted expression has an unsigned type and must thus not be negative
src -= (1 + src_x - w) * sizeof(pixel);
src_x = w - 1;
} else if (src_x <= -block_w) {
src += (1 - block_w - src_x) * sizeof(pixel);

View file

@ -89,6 +89,7 @@ typedef struct VP56RangeCoder {
const uint8_t *buffer;
const uint8_t *end;
unsigned int code_word;
int end_reached;
} VP56RangeCoder;
typedef struct VP56RefDc {
@ -227,6 +228,16 @@ int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
extern const uint8_t ff_vp56_norm_shift[256];
int ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int buf_size);
/**
* vp5689 returns 1 if the end of the stream has been reached, 0 otherwise.
*/
static av_always_inline int vpX_rac_is_end(VP56RangeCoder *c)
{
if (c->end <= c->buffer && c->bits >= 0)
c->end_reached ++;
return c->end_reached > 10;
}
static av_always_inline unsigned int vp56_rac_renorm(VP56RangeCoder *c)
{
int shift = ff_vp56_norm_shift[c->high];

View file

@ -43,6 +43,7 @@ int ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int buf_si
c->bits = -16;
c->buffer = buf;
c->end = buf + buf_size;
c->end_reached = 0;
if (buf_size < 1)
return AVERROR_INVALIDDATA;
c->code_word = bytestream_get_be24(&c->buffer);

View file

@ -606,7 +606,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)) {
@ -2301,7 +2301,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)
@ -2332,7 +2332,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) {

View file

@ -1378,48 +1378,48 @@ static av_always_inline void iadst16_1d(const dctcoef *in, ptrdiff_t stride,
dctint t0a, t1a, t2a, t3a, t4a, t5a, t6a, t7a;
dctint t8a, t9a, t10a, t11a, t12a, t13a, t14a, t15a;
t0 = IN(15) * 16364 + IN(0) * 804;
t1 = IN(15) * 804 - IN(0) * 16364;
t2 = IN(13) * 15893 + IN(2) * 3981;
t3 = IN(13) * 3981 - IN(2) * 15893;
t4 = IN(11) * 14811 + IN(4) * 7005;
t5 = IN(11) * 7005 - IN(4) * 14811;
t6 = IN(9) * 13160 + IN(6) * 9760;
t7 = IN(9) * 9760 - IN(6) * 13160;
t8 = IN(7) * 11003 + IN(8) * 12140;
t9 = IN(7) * 12140 - IN(8) * 11003;
t10 = IN(5) * 8423 + IN(10) * 14053;
t11 = IN(5) * 14053 - IN(10) * 8423;
t12 = IN(3) * 5520 + IN(12) * 15426;
t13 = IN(3) * 15426 - IN(12) * 5520;
t14 = IN(1) * 2404 + IN(14) * 16207;
t15 = IN(1) * 16207 - IN(14) * 2404;
t0 = IN(15) * 16364U + IN(0) * 804U;
t1 = IN(15) * 804U - IN(0) * 16364U;
t2 = IN(13) * 15893U + IN(2) * 3981U;
t3 = IN(13) * 3981U - IN(2) * 15893U;
t4 = IN(11) * 14811U + IN(4) * 7005U;
t5 = IN(11) * 7005U - IN(4) * 14811U;
t6 = IN(9) * 13160U + IN(6) * 9760U;
t7 = IN(9) * 9760U - IN(6) * 13160U;
t8 = IN(7) * 11003U + IN(8) * 12140U;
t9 = IN(7) * 12140U - IN(8) * 11003U;
t10 = IN(5) * 8423U + IN(10) * 14053U;
t11 = IN(5) * 14053U - IN(10) * 8423U;
t12 = IN(3) * 5520U + IN(12) * 15426U;
t13 = IN(3) * 15426U - IN(12) * 5520U;
t14 = IN(1) * 2404U + IN(14) * 16207U;
t15 = IN(1) * 16207U - IN(14) * 2404U;
t0a = (t0 + t8 + (1 << 13)) >> 14;
t1a = (t1 + t9 + (1 << 13)) >> 14;
t2a = (t2 + t10 + (1 << 13)) >> 14;
t3a = (t3 + t11 + (1 << 13)) >> 14;
t4a = (t4 + t12 + (1 << 13)) >> 14;
t5a = (t5 + t13 + (1 << 13)) >> 14;
t6a = (t6 + t14 + (1 << 13)) >> 14;
t7a = (t7 + t15 + (1 << 13)) >> 14;
t8a = (t0 - t8 + (1 << 13)) >> 14;
t9a = (t1 - t9 + (1 << 13)) >> 14;
t10a = (t2 - t10 + (1 << 13)) >> 14;
t11a = (t3 - t11 + (1 << 13)) >> 14;
t12a = (t4 - t12 + (1 << 13)) >> 14;
t13a = (t5 - t13 + (1 << 13)) >> 14;
t14a = (t6 - t14 + (1 << 13)) >> 14;
t15a = (t7 - t15 + (1 << 13)) >> 14;
t0a = (dctint)((1U << 13) + t0 + t8 ) >> 14;
t1a = (dctint)((1U << 13) + t1 + t9 ) >> 14;
t2a = (dctint)((1U << 13) + t2 + t10) >> 14;
t3a = (dctint)((1U << 13) + t3 + t11) >> 14;
t4a = (dctint)((1U << 13) + t4 + t12) >> 14;
t5a = (dctint)((1U << 13) + t5 + t13) >> 14;
t6a = (dctint)((1U << 13) + t6 + t14) >> 14;
t7a = (dctint)((1U << 13) + t7 + t15) >> 14;
t8a = (dctint)((1U << 13) + t0 - t8 ) >> 14;
t9a = (dctint)((1U << 13) + t1 - t9 ) >> 14;
t10a = (dctint)((1U << 13) + t2 - t10) >> 14;
t11a = (dctint)((1U << 13) + t3 - t11) >> 14;
t12a = (dctint)((1U << 13) + t4 - t12) >> 14;
t13a = (dctint)((1U << 13) + t5 - t13) >> 14;
t14a = (dctint)((1U << 13) + t6 - t14) >> 14;
t15a = (dctint)((1U << 13) + t7 - t15) >> 14;
t8 = t8a * 16069 + t9a * 3196;
t9 = t8a * 3196 - t9a * 16069;
t10 = t10a * 9102 + t11a * 13623;
t11 = t10a * 13623 - t11a * 9102;
t12 = t13a * 16069 - t12a * 3196;
t13 = t13a * 3196 + t12a * 16069;
t14 = t15a * 9102 - t14a * 13623;
t15 = t15a * 13623 + t14a * 9102;
t8 = t8a * 16069U + t9a * 3196U;
t9 = t8a * 3196U - t9a * 16069U;
t10 = t10a * 9102U + t11a * 13623U;
t11 = t10a * 13623U - t11a * 9102U;
t12 = t13a * 16069U - t12a * 3196U;
t13 = t13a * 3196U + t12a * 16069U;
t14 = t15a * 9102U - t14a * 13623U;
t15 = t15a * 13623U + t14a * 9102U;
t0 = t0a + t4a;
t1 = t1a + t5a;
@ -1429,49 +1429,49 @@ static av_always_inline void iadst16_1d(const dctcoef *in, ptrdiff_t stride,
t5 = t1a - t5a;
t6 = t2a - t6a;
t7 = t3a - t7a;
t8a = (t8 + t12 + (1 << 13)) >> 14;
t9a = (t9 + t13 + (1 << 13)) >> 14;
t10a = (t10 + t14 + (1 << 13)) >> 14;
t11a = (t11 + t15 + (1 << 13)) >> 14;
t12a = (t8 - t12 + (1 << 13)) >> 14;
t13a = (t9 - t13 + (1 << 13)) >> 14;
t14a = (t10 - t14 + (1 << 13)) >> 14;
t15a = (t11 - t15 + (1 << 13)) >> 14;
t8a = (dctint)((1U << 13) + t8 + t12) >> 14;
t9a = (dctint)((1U << 13) + t9 + t13) >> 14;
t10a = (dctint)((1U << 13) + t10 + t14) >> 14;
t11a = (dctint)((1U << 13) + t11 + t15) >> 14;
t12a = (dctint)((1U << 13) + t8 - t12) >> 14;
t13a = (dctint)((1U << 13) + t9 - t13) >> 14;
t14a = (dctint)((1U << 13) + t10 - t14) >> 14;
t15a = (dctint)((1U << 13) + t11 - t15) >> 14;
t4a = t4 * 15137 + t5 * 6270;
t5a = t4 * 6270 - t5 * 15137;
t6a = t7 * 15137 - t6 * 6270;
t7a = t7 * 6270 + t6 * 15137;
t12 = t12a * 15137 + t13a * 6270;
t13 = t12a * 6270 - t13a * 15137;
t14 = t15a * 15137 - t14a * 6270;
t15 = t15a * 6270 + t14a * 15137;
t4a = t4 * 15137U + t5 * 6270U;
t5a = t4 * 6270U - t5 * 15137U;
t6a = t7 * 15137U - t6 * 6270U;
t7a = t7 * 6270U + t6 * 15137U;
t12 = t12a * 15137U + t13a * 6270U;
t13 = t12a * 6270U - t13a * 15137U;
t14 = t15a * 15137U - t14a * 6270U;
t15 = t15a * 6270U + t14a * 15137U;
out[ 0] = t0 + t2;
out[15] = -(t1 + t3);
t2a = t0 - t2;
t3a = t1 - t3;
out[ 3] = -((t4a + t6a + (1 << 13)) >> 14);
out[12] = (t5a + t7a + (1 << 13)) >> 14;
t6 = (t4a - t6a + (1 << 13)) >> 14;
t7 = (t5a - t7a + (1 << 13)) >> 14;
out[ 3] = -((dctint)((1U << 13) + t4a + t6a) >> 14);
out[12] = (dctint)((1U << 13) + t5a + t7a) >> 14;
t6 = (dctint)((1U << 13) + t4a - t6a) >> 14;
t7 = (dctint)((1U << 13) + t5a - t7a) >> 14;
out[ 1] = -(t8a + t10a);
out[14] = t9a + t11a;
t10 = t8a - t10a;
t11 = t9a - t11a;
out[ 2] = (t12 + t14 + (1 << 13)) >> 14;
out[13] = -((t13 + t15 + (1 << 13)) >> 14);
t14a = (t12 - t14 + (1 << 13)) >> 14;
t15a = (t13 - t15 + (1 << 13)) >> 14;
out[ 2] = (dctint)((1U << 13) + t12 + t14) >> 14;
out[13] = -((dctint)((1U << 13) + t13 + t15) >> 14);
t14a = (dctint)((1U << 13) + t12 - t14) >> 14;
t15a = (dctint)((1U << 13) + t13 - t15) >> 14;
out[ 7] = ((t2a + t3a) * -11585 + (1 << 13)) >> 14;
out[ 8] = ((t2a - t3a) * 11585 + (1 << 13)) >> 14;
out[ 4] = ((t7 + t6) * 11585 + (1 << 13)) >> 14;
out[11] = ((t7 - t6) * 11585 + (1 << 13)) >> 14;
out[ 6] = ((t11 + t10) * 11585 + (1 << 13)) >> 14;
out[ 9] = ((t11 - t10) * 11585 + (1 << 13)) >> 14;
out[ 5] = ((t14a + t15a) * -11585 + (1 << 13)) >> 14;
out[10] = ((t14a - t15a) * 11585 + (1 << 13)) >> 14;
out[ 7] = (dctint)(-(t2a + t3a) * 11585U + (1 << 13)) >> 14;
out[ 8] = (dctint)( (t2a - t3a) * 11585U + (1 << 13)) >> 14;
out[ 4] = (dctint)( (t7 + t6) * 11585U + (1 << 13)) >> 14;
out[11] = (dctint)( (t7 - t6) * 11585U + (1 << 13)) >> 14;
out[ 6] = (dctint)( (t11 + t10) * 11585U + (1 << 13)) >> 14;
out[ 9] = (dctint)( (t11 - t10) * 11585U + (1 << 13)) >> 14;
out[ 5] = (dctint)(-(t14a + t15a) * 11585U + (1 << 13)) >> 14;
out[10] = (dctint)( (t14a - t15a) * 11585U + (1 << 13)) >> 14;
}
itxfm_wrap(16, 6)
@ -1479,38 +1479,38 @@ itxfm_wrap(16, 6)
static av_always_inline void idct32_1d(const dctcoef *in, ptrdiff_t stride,
dctcoef *out, int pass)
{
dctint t0a = ((IN(0) + IN(16)) * 11585 + (1 << 13)) >> 14;
dctint t1a = ((IN(0) - IN(16)) * 11585 + (1 << 13)) >> 14;
dctint t2a = (IN( 8) * 6270 - IN(24) * 15137 + (1 << 13)) >> 14;
dctint t3a = (IN( 8) * 15137 + IN(24) * 6270 + (1 << 13)) >> 14;
dctint t4a = (IN( 4) * 3196 - IN(28) * 16069 + (1 << 13)) >> 14;
dctint t7a = (IN( 4) * 16069 + IN(28) * 3196 + (1 << 13)) >> 14;
dctint t5a = (IN(20) * 13623 - IN(12) * 9102 + (1 << 13)) >> 14;
dctint t6a = (IN(20) * 9102 + IN(12) * 13623 + (1 << 13)) >> 14;
dctint t8a = (IN( 2) * 1606 - IN(30) * 16305 + (1 << 13)) >> 14;
dctint t15a = (IN( 2) * 16305 + IN(30) * 1606 + (1 << 13)) >> 14;
dctint t9a = (IN(18) * 12665 - IN(14) * 10394 + (1 << 13)) >> 14;
dctint t14a = (IN(18) * 10394 + IN(14) * 12665 + (1 << 13)) >> 14;
dctint t10a = (IN(10) * 7723 - IN(22) * 14449 + (1 << 13)) >> 14;
dctint t13a = (IN(10) * 14449 + IN(22) * 7723 + (1 << 13)) >> 14;
dctint t11a = (IN(26) * 15679 - IN( 6) * 4756 + (1 << 13)) >> 14;
dctint t12a = (IN(26) * 4756 + IN( 6) * 15679 + (1 << 13)) >> 14;
dctint t16a = (IN( 1) * 804 - IN(31) * 16364 + (1 << 13)) >> 14;
dctint t31a = (IN( 1) * 16364 + IN(31) * 804 + (1 << 13)) >> 14;
dctint t17a = (IN(17) * 12140 - IN(15) * 11003 + (1 << 13)) >> 14;
dctint t30a = (IN(17) * 11003 + IN(15) * 12140 + (1 << 13)) >> 14;
dctint t18a = (IN( 9) * 7005 - IN(23) * 14811 + (1 << 13)) >> 14;
dctint t29a = (IN( 9) * 14811 + IN(23) * 7005 + (1 << 13)) >> 14;
dctint t19a = (IN(25) * 15426 - IN( 7) * 5520 + (1 << 13)) >> 14;
dctint t28a = (IN(25) * 5520 + IN( 7) * 15426 + (1 << 13)) >> 14;
dctint t20a = (IN( 5) * 3981 - IN(27) * 15893 + (1 << 13)) >> 14;
dctint t27a = (IN( 5) * 15893 + IN(27) * 3981 + (1 << 13)) >> 14;
dctint t21a = (IN(21) * 14053 - IN(11) * 8423 + (1 << 13)) >> 14;
dctint t26a = (IN(21) * 8423 + IN(11) * 14053 + (1 << 13)) >> 14;
dctint t22a = (IN(13) * 9760 - IN(19) * 13160 + (1 << 13)) >> 14;
dctint t25a = (IN(13) * 13160 + IN(19) * 9760 + (1 << 13)) >> 14;
dctint t23a = (IN(29) * 16207 - IN( 3) * 2404 + (1 << 13)) >> 14;
dctint t24a = (IN(29) * 2404 + IN( 3) * 16207 + (1 << 13)) >> 14;
dctint t0a = (dctint)((IN(0) + IN(16)) * 11585U + (1 << 13)) >> 14;
dctint t1a = (dctint)((IN(0) - IN(16)) * 11585U + (1 << 13)) >> 14;
dctint t2a = (dctint)(IN( 8) * 6270U - IN(24) * 15137U + (1 << 13)) >> 14;
dctint t3a = (dctint)(IN( 8) * 15137U + IN(24) * 6270U + (1 << 13)) >> 14;
dctint t4a = (dctint)(IN( 4) * 3196U - IN(28) * 16069U + (1 << 13)) >> 14;
dctint t7a = (dctint)(IN( 4) * 16069U + IN(28) * 3196U + (1 << 13)) >> 14;
dctint t5a = (dctint)(IN(20) * 13623U - IN(12) * 9102U + (1 << 13)) >> 14;
dctint t6a = (dctint)(IN(20) * 9102U + IN(12) * 13623U + (1 << 13)) >> 14;
dctint t8a = (dctint)(IN( 2) * 1606U - IN(30) * 16305U + (1 << 13)) >> 14;
dctint t15a = (dctint)(IN( 2) * 16305U + IN(30) * 1606U + (1 << 13)) >> 14;
dctint t9a = (dctint)(IN(18) * 12665U - IN(14) * 10394U + (1 << 13)) >> 14;
dctint t14a = (dctint)(IN(18) * 10394U + IN(14) * 12665U + (1 << 13)) >> 14;
dctint t10a = (dctint)(IN(10) * 7723U - IN(22) * 14449U + (1 << 13)) >> 14;
dctint t13a = (dctint)(IN(10) * 14449U + IN(22) * 7723U + (1 << 13)) >> 14;
dctint t11a = (dctint)(IN(26) * 15679U - IN( 6) * 4756U + (1 << 13)) >> 14;
dctint t12a = (dctint)(IN(26) * 4756U + IN( 6) * 15679U + (1 << 13)) >> 14;
dctint t16a = (dctint)(IN( 1) * 804U - IN(31) * 16364U + (1 << 13)) >> 14;
dctint t31a = (dctint)(IN( 1) * 16364U + IN(31) * 804U + (1 << 13)) >> 14;
dctint t17a = (dctint)(IN(17) * 12140U - IN(15) * 11003U + (1 << 13)) >> 14;
dctint t30a = (dctint)(IN(17) * 11003U + IN(15) * 12140U + (1 << 13)) >> 14;
dctint t18a = (dctint)(IN( 9) * 7005U - IN(23) * 14811U + (1 << 13)) >> 14;
dctint t29a = (dctint)(IN( 9) * 14811U + IN(23) * 7005U + (1 << 13)) >> 14;
dctint t19a = (dctint)(IN(25) * 15426U - IN( 7) * 5520U + (1 << 13)) >> 14;
dctint t28a = (dctint)(IN(25) * 5520U + IN( 7) * 15426U + (1 << 13)) >> 14;
dctint t20a = (dctint)(IN( 5) * 3981U - IN(27) * 15893U + (1 << 13)) >> 14;
dctint t27a = (dctint)(IN( 5) * 15893U + IN(27) * 3981U + (1 << 13)) >> 14;
dctint t21a = (dctint)(IN(21) * 14053U - IN(11) * 8423U + (1 << 13)) >> 14;
dctint t26a = (dctint)(IN(21) * 8423U + IN(11) * 14053U + (1 << 13)) >> 14;
dctint t22a = (dctint)(IN(13) * 9760U - IN(19) * 13160U + (1 << 13)) >> 14;
dctint t25a = (dctint)(IN(13) * 13160U + IN(19) * 9760U + (1 << 13)) >> 14;
dctint t23a = (dctint)(IN(29) * 16207U - IN( 3) * 2404U + (1 << 13)) >> 14;
dctint t24a = (dctint)(IN(29) * 2404U + IN( 3) * 16207U + (1 << 13)) >> 14;
dctint t0 = t0a + t3a;
dctint t1 = t1a + t2a;
@ -1545,20 +1545,20 @@ static av_always_inline void idct32_1d(const dctcoef *in, ptrdiff_t stride,
dctint t30 = t31a - t30a;
dctint t31 = t31a + t30a;
t5a = ((t6 - t5) * 11585 + (1 << 13)) >> 14;
t6a = ((t6 + t5) * 11585 + (1 << 13)) >> 14;
t9a = ( t14 * 6270 - t9 * 15137 + (1 << 13)) >> 14;
t14a = ( t14 * 15137 + t9 * 6270 + (1 << 13)) >> 14;
t10a = (-(t13 * 15137 + t10 * 6270) + (1 << 13)) >> 14;
t13a = ( t13 * 6270 - t10 * 15137 + (1 << 13)) >> 14;
t17a = ( t30 * 3196 - t17 * 16069 + (1 << 13)) >> 14;
t30a = ( t30 * 16069 + t17 * 3196 + (1 << 13)) >> 14;
t18a = (-(t29 * 16069 + t18 * 3196) + (1 << 13)) >> 14;
t29a = ( t29 * 3196 - t18 * 16069 + (1 << 13)) >> 14;
t21a = ( t26 * 13623 - t21 * 9102 + (1 << 13)) >> 14;
t26a = ( t26 * 9102 + t21 * 13623 + (1 << 13)) >> 14;
t22a = (-(t25 * 9102 + t22 * 13623) + (1 << 13)) >> 14;
t25a = ( t25 * 13623 - t22 * 9102 + (1 << 13)) >> 14;
t5a = (dctint)((t6 - t5) * 11585U + (1 << 13)) >> 14;
t6a = (dctint)((t6 + t5) * 11585U + (1 << 13)) >> 14;
t9a = (dctint)( t14 * 6270U - t9 * 15137U + (1 << 13)) >> 14;
t14a = (dctint)( t14 * 15137U + t9 * 6270U + (1 << 13)) >> 14;
t10a = (dctint)(-(t13 * 15137U + t10 * 6270U) + (1 << 13)) >> 14;
t13a = (dctint)( t13 * 6270U - t10 * 15137U + (1 << 13)) >> 14;
t17a = (dctint)( t30 * 3196U - t17 * 16069U + (1 << 13)) >> 14;
t30a = (dctint)( t30 * 16069U + t17 * 3196U + (1 << 13)) >> 14;
t18a = (dctint)(-(t29 * 16069U + t18 * 3196U) + (1 << 13)) >> 14;
t29a = (dctint)( t29 * 3196U - t18 * 16069U + (1 << 13)) >> 14;
t21a = (dctint)( t26 * 13623U - t21 * 9102U + (1 << 13)) >> 14;
t26a = (dctint)( t26 * 9102U + t21 * 13623U + (1 << 13)) >> 14;
t22a = (dctint)(-(t25 * 9102U + t22 * 13623U) + (1 << 13)) >> 14;
t25a = (dctint)( t25 * 13623U - t22 * 9102U + (1 << 13)) >> 14;
t0a = t0 + t7;
t1a = t1 + t6a;
@ -1593,18 +1593,18 @@ static av_always_inline void idct32_1d(const dctcoef *in, ptrdiff_t stride,
t30 = t30a + t29a;
t31a = t31 + t28;
t10a = ((t13 - t10) * 11585 + (1 << 13)) >> 14;
t13a = ((t13 + t10) * 11585 + (1 << 13)) >> 14;
t11 = ((t12a - t11a) * 11585 + (1 << 13)) >> 14;
t12 = ((t12a + t11a) * 11585 + (1 << 13)) >> 14;
t18a = ( t29 * 6270 - t18 * 15137 + (1 << 13)) >> 14;
t29a = ( t29 * 15137 + t18 * 6270 + (1 << 13)) >> 14;
t19 = ( t28a * 6270 - t19a * 15137 + (1 << 13)) >> 14;
t28 = ( t28a * 15137 + t19a * 6270 + (1 << 13)) >> 14;
t20 = (-(t27a * 15137 + t20a * 6270) + (1 << 13)) >> 14;
t27 = ( t27a * 6270 - t20a * 15137 + (1 << 13)) >> 14;
t21a = (-(t26 * 15137 + t21 * 6270) + (1 << 13)) >> 14;
t26a = ( t26 * 6270 - t21 * 15137 + (1 << 13)) >> 14;
t10a = (dctint)((t13 - t10) * 11585U + (1 << 13)) >> 14;
t13a = (dctint)((t13 + t10) * 11585U + (1 << 13)) >> 14;
t11 = (dctint)((t12a - t11a) * 11585U + (1 << 13)) >> 14;
t12 = (dctint)((t12a + t11a) * 11585U + (1 << 13)) >> 14;
t18a = (dctint)( t29 * 6270U - t18 * 15137U + (1 << 13)) >> 14;
t29a = (dctint)( t29 * 15137U + t18 * 6270U + (1 << 13)) >> 14;
t19 = (dctint)( t28a * 6270U - t19a * 15137U + (1 << 13)) >> 14;
t28 = (dctint)( t28a * 15137U + t19a * 6270U + (1 << 13)) >> 14;
t20 = (dctint)(-(t27a * 15137U + t20a * 6270U) + (1 << 13)) >> 14;
t27 = (dctint)( t27a * 6270U - t20a * 15137U + (1 << 13)) >> 14;
t21a = (dctint)(-(t26 * 15137U + t21 * 6270U) + (1 << 13)) >> 14;
t26a = (dctint)( t26 * 6270U - t21 * 15137U + (1 << 13)) >> 14;
t0 = t0a + t15a;
t1 = t1a + t14;
@ -1639,14 +1639,14 @@ static av_always_inline void idct32_1d(const dctcoef *in, ptrdiff_t stride,
t30a = t30 + t25;
t31 = t31a + t24a;
t20 = ((t27a - t20a) * 11585 + (1 << 13)) >> 14;
t27 = ((t27a + t20a) * 11585 + (1 << 13)) >> 14;
t21a = ((t26 - t21 ) * 11585 + (1 << 13)) >> 14;
t26a = ((t26 + t21 ) * 11585 + (1 << 13)) >> 14;
t22 = ((t25a - t22a) * 11585 + (1 << 13)) >> 14;
t25 = ((t25a + t22a) * 11585 + (1 << 13)) >> 14;
t23a = ((t24 - t23 ) * 11585 + (1 << 13)) >> 14;
t24a = ((t24 + t23 ) * 11585 + (1 << 13)) >> 14;
t20 = (dctint)((t27a - t20a) * 11585U + (1 << 13)) >> 14;
t27 = (dctint)((t27a + t20a) * 11585U + (1 << 13)) >> 14;
t21a = (dctint)((t26 - t21 ) * 11585U + (1 << 13)) >> 14;
t26a = (dctint)((t26 + t21 ) * 11585U + (1 << 13)) >> 14;
t22 = (dctint)((t25a - t22a) * 11585U + (1 << 13)) >> 14;
t25 = (dctint)((t25a + t22a) * 11585U + (1 << 13)) >> 14;
t23a = (dctint)((t24 - t23 ) * 11585U + (1 << 13)) >> 14;
t24a = (dctint)((t24 + t23 ) * 11585U + (1 << 13)) >> 14;
out[ 0] = t0 + t31;
out[ 1] = t1 + t30a;

View file

@ -222,12 +222,13 @@ int av_strcasecmp(const char *a, const char *b)
int av_strncasecmp(const char *a, const char *b, size_t n)
{
const char *end = a + n;
uint8_t c1, c2;
if (n <= 0)
return 0;
do {
c1 = av_tolower(*a++);
c2 = av_tolower(*b++);
} while (a < end && c1 && c1 == c2);
} while (--n && c1 && c1 == c2);
return c1 - c2;
}

View file

@ -307,7 +307,7 @@ static av_always_inline av_const double av_clipd_c(double a, double amin, double
*/
static av_always_inline av_const int av_ceil_log2_c(int x)
{
return av_log2((x - 1) << 1);
return av_log2((x - 1U) << 1);
}
/**

View file

@ -24,6 +24,12 @@
#include <stdint.h>
/**
* Context structure for the Lagged Fibonacci PRNG.
* The exact layout, types and content of this struct may change and should
* not be accessed directly. Only its sizeof() is guranteed to stay the same
* to allow easy instanciation.
*/
typedef struct AVLFG {
unsigned int state[64];
int index;
@ -45,8 +51,9 @@ int av_lfg_init_from_data(AVLFG *c, const uint8_t *data, unsigned int length);
* it may be good enough and faster for your specific use case.
*/
static inline unsigned int av_lfg_get(AVLFG *c){
c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63];
return c->state[c->index++ & 63];
unsigned a = c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63];
c->index += 1U;
return a;
}
/**
@ -57,7 +64,9 @@ static inline unsigned int av_lfg_get(AVLFG *c){
static inline unsigned int av_mlfg_get(AVLFG *c){
unsigned int a= c->state[(c->index-55) & 63];
unsigned int b= c->state[(c->index-24) & 63];
return c->state[c->index++ & 63] = 2*a*b+a+b;
a = c->state[c->index & 63] = 2*a*b+a+b;
c->index += 1U;
return a;
}
/**

View file

@ -338,7 +338,7 @@ av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
* @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
* correctly aligned.
*/
av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
/**
* Reallocate the given buffer if it is not large enough, otherwise do nothing.

View file

@ -64,7 +64,7 @@ static inline SoftFloat_IEEE754 av_int2sf_ieee754(int64_t n, int e) {
* by the IEEE 754 spec.
*/
static inline SoftFloat_IEEE754 av_bits2sf_ieee754(uint32_t n) {
return ((SoftFloat_IEEE754) { (n & 0x80000000UL), (n & 0x7FFFFFUL), (n & 0x7F800000UL) });
return ((SoftFloat_IEEE754) { (n & 0x80000000UL) >> 31, (n & 0x7FFFFFUL), (int8_t)((n & 0x7F800000UL) >> 23)});
}
/** Convert the softfloat to integer