Compare commits
33 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
faac8e4331 | ||
![]() |
5be683d687 | ||
![]() |
96c1421627 | ||
![]() |
8a59dbbc68 | ||
![]() |
0683ef4b50 | ||
![]() |
b420354a8b | ||
![]() |
1d0f9c92c5 | ||
![]() |
d846d3e88e | ||
![]() |
621f1a2e63 | ||
![]() |
9a241d95ef | ||
![]() |
41b15817ce | ||
![]() |
07ea57c5bb | ||
![]() |
84fedd3be7 | ||
![]() |
74fb9df48b | ||
![]() |
8c0fd44317 | ||
![]() |
6f02d93c0f | ||
![]() |
9333ee7c0d | ||
![]() |
3e30424961 | ||
![]() |
fe2df122b4 | ||
![]() |
f96fdb46b7 | ||
![]() |
7fa861dfe0 | ||
![]() |
48f616ceee | ||
![]() |
8968de6c61 | ||
![]() |
043cb40bec | ||
![]() |
76b289bcf2 | ||
![]() |
52ba406b94 | ||
![]() |
071eb56a6a | ||
![]() |
2f67222780 | ||
![]() |
a376ef4a17 | ||
![]() |
43fdd89a3f | ||
![]() |
60f2f332a3 | ||
![]() |
7e05c70bb0 | ||
![]() |
b46840475e |
22
Changelog
22
Changelog
@@ -1,6 +1,28 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 2.5.6
|
||||
- avcodec/atrac3plusdsp: fix on stack alignment
|
||||
- ac3: validate end in ff_ac3_bit_alloc_calc_mask
|
||||
- aacpsy: avoid psy_band->threshold becoming NaN
|
||||
- aasc: return correct buffer size from aasc_decode_frame
|
||||
- msrledec: use signed pixel_ptr in msrle_decode_pal4
|
||||
- swresample: Allow reinitialization without ever setting channel layouts (cherry picked from commit 80a28c7509a11114e1aea5b208d56c6646d69c07)
|
||||
- swresample: Allow reinitialization without ever setting channel counts
|
||||
- avcodec/h264: Do not fail with randomly truncated VUIs
|
||||
- avcodec/h264_ps: Move truncation check from VUI to SPS
|
||||
- avcodec/h264: Be more tolerant to changing pps id between slices
|
||||
- avcodec/aacdec: Fix storing state before PCE decode
|
||||
- avcodec/h264: reset the counts in the correct context
|
||||
- avcodec/h264_slice: Do not reset mb_aff_frame per slice
|
||||
- avcodec/h264: finish previous slices before switching to single thread mode
|
||||
- avcodec/h264: Fix race between slices where one overwrites data from the next
|
||||
- avcodec/h264_refs: Do not set reference to things which do not exist
|
||||
- avcodec/h264: Fail for invalid mixed IDR / non IDR frames in slice threading mode
|
||||
- h264: avoid unnecessary calls to get_format
|
||||
- avcodec/msrledec: restructure msrle_decode_pal4() based on the line number instead of the pixel pointer
|
||||
|
||||
|
||||
version 2.5.5:
|
||||
- vp9: make above buffer pointer 32-byte aligned.
|
||||
- avcodec/dnxhddec: Check that the frame is interlaced before using cur_field
|
||||
|
@@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 2.5.5
|
||||
PROJECT_NUMBER = 2.5.6
|
||||
|
||||
# With the PROJECT_LOGO tag one can specify a logo or icon that is included
|
||||
# in the documentation. The maximum height of the logo should not exceed 55
|
||||
|
@@ -253,10 +253,14 @@ Possible flags for this option are:
|
||||
@item sse4.1
|
||||
@item sse4.2
|
||||
@item avx
|
||||
@item avx2
|
||||
@item xop
|
||||
@item fma3
|
||||
@item fma4
|
||||
@item 3dnow
|
||||
@item 3dnowext
|
||||
@item bmi1
|
||||
@item bmi2
|
||||
@item cmov
|
||||
@end table
|
||||
@item ARM
|
||||
@@ -267,6 +271,13 @@ Possible flags for this option are:
|
||||
@item vfp
|
||||
@item vfpv3
|
||||
@item neon
|
||||
@item setend
|
||||
@end table
|
||||
@item AArch64
|
||||
@table @samp
|
||||
@item armv8
|
||||
@item vfp
|
||||
@item neon
|
||||
@end table
|
||||
@item PowerPC
|
||||
@table @samp
|
||||
|
10
ffmpeg.c
10
ffmpeg.c
@@ -2620,11 +2620,13 @@ static int transcode_init(void)
|
||||
enc_ctx->rc_max_rate = dec_ctx->rc_max_rate;
|
||||
enc_ctx->rc_buffer_size = dec_ctx->rc_buffer_size;
|
||||
enc_ctx->field_order = dec_ctx->field_order;
|
||||
enc_ctx->extradata = av_mallocz(extra_size);
|
||||
if (!enc_ctx->extradata) {
|
||||
return AVERROR(ENOMEM);
|
||||
if (dec_ctx->extradata_size) {
|
||||
enc_ctx->extradata = av_mallocz(extra_size);
|
||||
if (!enc_ctx->extradata) {
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
memcpy(enc_ctx->extradata, dec_ctx->extradata, dec_ctx->extradata_size);
|
||||
}
|
||||
memcpy(enc_ctx->extradata, dec_ctx->extradata, dec_ctx->extradata_size);
|
||||
enc_ctx->extradata_size= dec_ctx->extradata_size;
|
||||
enc_ctx->bits_per_coded_sample = dec_ctx->bits_per_coded_sample;
|
||||
|
||||
|
@@ -425,7 +425,7 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
|
||||
* Save current output configuration if and only if it has been locked.
|
||||
*/
|
||||
static void push_output_configuration(AACContext *ac) {
|
||||
if (ac->oc[1].status == OC_LOCKED) {
|
||||
if (ac->oc[1].status == OC_LOCKED || ac->oc[0].status == OC_NONE) {
|
||||
ac->oc[0] = ac->oc[1];
|
||||
}
|
||||
ac->oc[1].status = OC_NONE;
|
||||
@@ -904,7 +904,7 @@ static int decode_eld_specific_config(AACContext *ac, AVCodecContext *avctx,
|
||||
if (len == 15 + 255)
|
||||
len += get_bits(gb, 16);
|
||||
if (get_bits_left(gb) < len * 8 + 4) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, overread_err);
|
||||
av_log(avctx, AV_LOG_ERROR, overread_err);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
skip_bits_long(gb, 8 * len);
|
||||
|
@@ -727,7 +727,10 @@ static void psy_3gpp_analyze_channel(FFPsyContext *ctx, int channel,
|
||||
if (active_lines > 0.0f)
|
||||
band->thr = calc_reduced_thr_3gpp(band, coeffs[g].min_snr, reduction);
|
||||
pe += calc_pe_3gpp(band);
|
||||
band->norm_fac = band->active_lines / band->thr;
|
||||
if (band->thr > 0.0f)
|
||||
band->norm_fac = band->active_lines / band->thr;
|
||||
else
|
||||
band->norm_fac = 0.0f;
|
||||
norm_fac += band->norm_fac;
|
||||
}
|
||||
}
|
||||
|
@@ -137,7 +137,7 @@ static int aasc_decode_frame(AVCodecContext *avctx,
|
||||
return ret;
|
||||
|
||||
/* report that the buffer was completely consumed */
|
||||
return buf_size;
|
||||
return avpkt->size;
|
||||
}
|
||||
|
||||
static av_cold int aasc_decode_end(AVCodecContext *avctx)
|
||||
|
@@ -131,6 +131,9 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
|
||||
int band_start, band_end, begin, end1;
|
||||
int lowcomp, fastleak, slowleak;
|
||||
|
||||
if (end <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* excitation function */
|
||||
band_start = ff_ac3_bin_to_band_tab[start];
|
||||
band_end = ff_ac3_bin_to_band_tab[end-1] + 1;
|
||||
|
@@ -357,11 +357,15 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
|
||||
|
||||
ctx->cs_switch = 1;
|
||||
|
||||
for (i = 0; i < avctx->channels; i++) {
|
||||
sconf->chan_pos[i] = -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < avctx->channels; i++) {
|
||||
int idx;
|
||||
|
||||
idx = get_bits(&gb, chan_pos_bits);
|
||||
if (idx >= avctx->channels) {
|
||||
if (idx >= avctx->channels || sconf->chan_pos[idx] != -1) {
|
||||
av_log(avctx, AV_LOG_WARNING, "Invalid channel reordering.\n");
|
||||
ctx->cs_switch = 0;
|
||||
break;
|
||||
@@ -1286,8 +1290,16 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
|
||||
|
||||
if (ch[dep].time_diff_sign) {
|
||||
t = -t;
|
||||
if (t > 0 && begin < t) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "begin %u smaller than time diff index %d.\n", begin, t);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
begin -= t;
|
||||
} else {
|
||||
if (t > 0 && end < t) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "end %u smaller than time diff index %d.\n", end, t);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
end -= t;
|
||||
}
|
||||
|
||||
@@ -1727,9 +1739,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
|
||||
// allocate and assign channel data buffer for mcc mode
|
||||
if (sconf->mc_coding) {
|
||||
ctx->chan_data_buffer = av_malloc(sizeof(*ctx->chan_data_buffer) *
|
||||
ctx->chan_data_buffer = av_mallocz(sizeof(*ctx->chan_data_buffer) *
|
||||
num_buffers * num_buffers);
|
||||
ctx->chan_data = av_malloc(sizeof(*ctx->chan_data) *
|
||||
ctx->chan_data = av_mallocz(sizeof(*ctx->chan_data) *
|
||||
num_buffers);
|
||||
ctx->reverted_channels = av_malloc(sizeof(*ctx->reverted_channels) *
|
||||
num_buffers);
|
||||
|
@@ -599,8 +599,8 @@ void ff_atrac3p_ipqf(FFTContext *dct_ctx, Atrac3pIPQFChannelCtx *hist,
|
||||
const float *in, float *out)
|
||||
{
|
||||
int i, s, sb, t, pos_now, pos_next;
|
||||
DECLARE_ALIGNED(32, float, idct_in)[ATRAC3P_SUBBANDS];
|
||||
DECLARE_ALIGNED(32, float, idct_out)[ATRAC3P_SUBBANDS];
|
||||
LOCAL_ALIGNED(32, float, idct_in, [ATRAC3P_SUBBANDS]);
|
||||
LOCAL_ALIGNED(32, float, idct_out, [ATRAC3P_SUBBANDS]);
|
||||
|
||||
memset(out, 0, ATRAC3P_FRAME_SAMPLES * sizeof(*out));
|
||||
|
||||
|
@@ -1516,9 +1516,6 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size,
|
||||
continue;
|
||||
|
||||
again:
|
||||
if ( (!(avctx->active_thread_type & FF_THREAD_FRAME) || nals_needed >= nal_index)
|
||||
&& !h->current_slice)
|
||||
h->au_pps_id = -1;
|
||||
/* Ignore per frame NAL unit type during extradata
|
||||
* parsing. Decoding slices is not possible in codec init
|
||||
* with frame-mt */
|
||||
@@ -1554,8 +1551,14 @@ again:
|
||||
ret = -1;
|
||||
goto end;
|
||||
}
|
||||
if(!idr_cleared)
|
||||
if(!idr_cleared) {
|
||||
if (h->current_slice && (avctx->active_thread_type & FF_THREAD_SLICE)) {
|
||||
av_log(h, AV_LOG_ERROR, "invalid mixed IDR / non IDR frames cannot be decoded in slice multithreading mode\n");
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto end;
|
||||
}
|
||||
idr(h); // FIXME ensure we don't lose some frames if there is reordering
|
||||
}
|
||||
idr_cleared = 1;
|
||||
h->has_recovery_point = 1;
|
||||
case NAL_SLICE:
|
||||
@@ -1564,6 +1567,10 @@ again:
|
||||
hx->inter_gb_ptr = &hx->gb;
|
||||
hx->data_partitioning = 0;
|
||||
|
||||
if ( nals_needed >= nal_index
|
||||
|| (!(avctx->active_thread_type & FF_THREAD_FRAME) && !context_count))
|
||||
h->au_pps_id = -1;
|
||||
|
||||
if ((err = ff_h264_decode_slice_header(hx, h)))
|
||||
break;
|
||||
|
||||
@@ -1685,7 +1692,9 @@ again:
|
||||
break;
|
||||
case NAL_SPS:
|
||||
init_get_bits(&h->gb, ptr, bit_length);
|
||||
if (ff_h264_decode_seq_parameter_set(h) < 0 && (h->is_avc ? nalsize : 1)) {
|
||||
if (ff_h264_decode_seq_parameter_set(h, 0) >= 0)
|
||||
break;
|
||||
if (h->is_avc ? nalsize : 1) {
|
||||
av_log(h->avctx, AV_LOG_DEBUG,
|
||||
"SPS decoding failure, trying again with the complete NAL\n");
|
||||
if (h->is_avc)
|
||||
@@ -1694,8 +1703,11 @@ again:
|
||||
break;
|
||||
init_get_bits(&h->gb, &buf[buf_index + 1 - consumed],
|
||||
8*(next_avc - buf_index + consumed - 1));
|
||||
ff_h264_decode_seq_parameter_set(h);
|
||||
if (ff_h264_decode_seq_parameter_set(h, 0) >= 0)
|
||||
break;
|
||||
}
|
||||
init_get_bits(&h->gb, ptr, bit_length);
|
||||
ff_h264_decode_seq_parameter_set(h, 1);
|
||||
|
||||
break;
|
||||
case NAL_PPS:
|
||||
@@ -1728,8 +1740,14 @@ again:
|
||||
if (err < 0 || err == SLICE_SKIPED) {
|
||||
if (err < 0)
|
||||
av_log(h->avctx, AV_LOG_ERROR, "decode_slice_header error\n");
|
||||
h->ref_count[0] = h->ref_count[1] = h->list_count = 0;
|
||||
hx->ref_count[0] = hx->ref_count[1] = hx->list_count = 0;
|
||||
} else if (err == SLICE_SINGLETHREAD) {
|
||||
if (context_count > 1) {
|
||||
ret = ff_h264_execute_decode_slices(h, context_count - 1);
|
||||
if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
|
||||
goto end;
|
||||
context_count = 0;
|
||||
}
|
||||
/* Slice could not be decoded in parallel mode, copy down
|
||||
* NAL unit stuff to context 0 and restart. Note that
|
||||
* rbsp_buffer is not transferred, but since we no longer
|
||||
|
@@ -539,6 +539,7 @@ typedef struct H264Context {
|
||||
int mb_x, mb_y;
|
||||
int resync_mb_x;
|
||||
int resync_mb_y;
|
||||
int mb_index_end;
|
||||
int mb_skip_run;
|
||||
int mb_height, mb_width;
|
||||
int mb_stride;
|
||||
@@ -778,7 +779,7 @@ int ff_h264_decode_sei(H264Context *h);
|
||||
/**
|
||||
* Decode SPS
|
||||
*/
|
||||
int ff_h264_decode_seq_parameter_set(H264Context *h);
|
||||
int ff_h264_decode_seq_parameter_set(H264Context *h, int ignore_truncation);
|
||||
|
||||
/**
|
||||
* compute profile from sps
|
||||
|
@@ -271,7 +271,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
|
||||
init_get_bits(&h->gb, ptr, 8 * dst_length);
|
||||
switch (h->nal_unit_type) {
|
||||
case NAL_SPS:
|
||||
ff_h264_decode_seq_parameter_set(h);
|
||||
ff_h264_decode_seq_parameter_set(h, 0);
|
||||
break;
|
||||
case NAL_PPS:
|
||||
ff_h264_decode_picture_parameter_set(h, h->gb.size_in_bits);
|
||||
|
@@ -241,12 +241,6 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps)
|
||||
}
|
||||
}
|
||||
|
||||
if (get_bits_left(&h->gb) < 0) {
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"Overread VUI by %d bits\n", -get_bits_left(&h->gb));
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -303,7 +297,7 @@ static void decode_scaling_matrices(H264Context *h, SPS *sps,
|
||||
}
|
||||
}
|
||||
|
||||
int ff_h264_decode_seq_parameter_set(H264Context *h)
|
||||
int ff_h264_decode_seq_parameter_set(H264Context *h, int ignore_truncation)
|
||||
{
|
||||
int profile_idc, level_idc, constraint_set_flags = 0;
|
||||
unsigned int sps_id;
|
||||
@@ -523,6 +517,13 @@ int ff_h264_decode_seq_parameter_set(H264Context *h)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (get_bits_left(&h->gb) < 0) {
|
||||
av_log(h->avctx, ignore_truncation ? AV_LOG_WARNING : AV_LOG_ERROR,
|
||||
"Overread %s by %d bits\n", sps->vui_parameters_present_flag ? "VUI" : "SPS", -get_bits_left(&h->gb));
|
||||
if (!ignore_truncation)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!sps->sar.den)
|
||||
sps->sar.den = 1;
|
||||
|
||||
|
@@ -707,7 +707,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count)
|
||||
*/
|
||||
if (h->short_ref_count && h->short_ref[0] == h->cur_pic_ptr) {
|
||||
/* Just mark the second field valid */
|
||||
h->cur_pic_ptr->reference = PICT_FRAME;
|
||||
h->cur_pic_ptr->reference |= h->picture_structure;
|
||||
} else if (h->cur_pic_ptr->long_ref) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "illegal short term reference "
|
||||
"assignment for second field "
|
||||
|
@@ -1307,6 +1307,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
||||
int field_pic_flag, bottom_field_flag;
|
||||
int first_slice = h == h0 && !h0->current_slice;
|
||||
int frame_num, picture_structure, droppable;
|
||||
int mb_aff_frame, last_mb_aff_frame;
|
||||
PPS *pps;
|
||||
|
||||
h->qpel_put = h->h264qpel.put_h264_qpel_pixels_tab;
|
||||
@@ -1434,7 +1435,8 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
||||
|| h->mb_width != h->sps.mb_width
|
||||
|| h->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag)
|
||||
));
|
||||
if (non_j_pixfmt(h0->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h0, 0)))
|
||||
if (h0->avctx->pix_fmt == AV_PIX_FMT_NONE
|
||||
|| (non_j_pixfmt(h0->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h0, 0))))
|
||||
must_reinit = 1;
|
||||
|
||||
if (first_slice && av_cmp_q(h->sps.sar, h->avctx->sample_aspect_ratio))
|
||||
@@ -1530,7 +1532,8 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
||||
}
|
||||
|
||||
h->mb_mbaff = 0;
|
||||
h->mb_aff_frame = 0;
|
||||
mb_aff_frame = 0;
|
||||
last_mb_aff_frame = h0->mb_aff_frame;
|
||||
last_pic_structure = h0->picture_structure;
|
||||
last_pic_droppable = h0->droppable;
|
||||
droppable = h->nal_ref_idc == 0;
|
||||
@@ -1548,12 +1551,13 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
||||
picture_structure = PICT_TOP_FIELD + bottom_field_flag;
|
||||
} else {
|
||||
picture_structure = PICT_FRAME;
|
||||
h->mb_aff_frame = h->sps.mb_aff;
|
||||
mb_aff_frame = h->sps.mb_aff;
|
||||
}
|
||||
}
|
||||
if (h0->current_slice) {
|
||||
if (last_pic_structure != picture_structure ||
|
||||
last_pic_droppable != droppable) {
|
||||
last_pic_droppable != droppable ||
|
||||
last_mb_aff_frame != mb_aff_frame) {
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"Changing field mode (%d -> %d) between slices is not allowed\n",
|
||||
last_pic_structure, h->picture_structure);
|
||||
@@ -1569,6 +1573,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
||||
h->picture_structure = picture_structure;
|
||||
h->droppable = droppable;
|
||||
h->frame_num = frame_num;
|
||||
h->mb_aff_frame = mb_aff_frame;
|
||||
h->mb_field_decoding_flag = picture_structure != PICT_FRAME;
|
||||
|
||||
if (h0->current_slice == 0) {
|
||||
@@ -2444,8 +2449,17 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg)
|
||||
|
||||
for (;;) {
|
||||
// START_TIMER
|
||||
int ret = ff_h264_decode_mb_cabac(h);
|
||||
int eos;
|
||||
int ret, eos;
|
||||
|
||||
if (h->mb_x + h->mb_y * h->mb_width >= h->mb_index_end) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "Slice overlaps next at %d\n",
|
||||
h->mb_index_end);
|
||||
er_add_slice(h, h->resync_mb_x, h->resync_mb_y, h->mb_x,
|
||||
h->mb_y, ER_MB_ERROR);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
ret = ff_h264_decode_mb_cabac(h);
|
||||
// STOP_TIMER("decode_mb_cabac")
|
||||
|
||||
if (ret >= 0)
|
||||
@@ -2507,7 +2521,17 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg)
|
||||
}
|
||||
} else {
|
||||
for (;;) {
|
||||
int ret = ff_h264_decode_mb_cavlc(h);
|
||||
int ret;
|
||||
|
||||
if (h->mb_x + h->mb_y * h->mb_width >= h->mb_index_end) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "Slice overlaps next at %d\n",
|
||||
h->mb_index_end);
|
||||
er_add_slice(h, h->resync_mb_x, h->resync_mb_y, h->mb_x,
|
||||
h->mb_y, ER_MB_ERROR);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
ret = ff_h264_decode_mb_cavlc(h);
|
||||
|
||||
if (ret >= 0)
|
||||
ff_h264_hl_decode_mb(h);
|
||||
@@ -2595,19 +2619,33 @@ int ff_h264_execute_decode_slices(H264Context *h, unsigned context_count)
|
||||
|
||||
av_assert0(h->mb_y < h->mb_height);
|
||||
|
||||
h->mb_index_end = INT_MAX;
|
||||
|
||||
if (h->avctx->hwaccel ||
|
||||
h->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
|
||||
return 0;
|
||||
if (context_count == 1) {
|
||||
return decode_slice(avctx, &h);
|
||||
} else {
|
||||
int j, mb_index;
|
||||
av_assert0(context_count > 0);
|
||||
for (i = 1; i < context_count; i++) {
|
||||
for (i = 0; i < context_count; i++) {
|
||||
int mb_index_end = h->mb_width * h->mb_height;
|
||||
hx = h->thread_context[i];
|
||||
if (CONFIG_ERROR_RESILIENCE) {
|
||||
mb_index = hx->resync_mb_x + hx->resync_mb_y * h->mb_width;
|
||||
if (CONFIG_ERROR_RESILIENCE && i) {
|
||||
hx->er.error_count = 0;
|
||||
}
|
||||
hx->x264_build = h->x264_build;
|
||||
for (j = 0; j < context_count; j++) {
|
||||
H264Context *sl2 = h->thread_context[j];
|
||||
int mb_index2 = sl2->resync_mb_x + sl2->resync_mb_y * h->mb_width;
|
||||
|
||||
if (i==j || mb_index > mb_index2)
|
||||
continue;
|
||||
mb_index_end = FFMIN(mb_index_end, mb_index2);
|
||||
}
|
||||
hx->mb_index_end = mb_index_end;
|
||||
}
|
||||
|
||||
avctx->execute(avctx, decode_slice, h->thread_context,
|
||||
|
@@ -36,17 +36,15 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
|
||||
unsigned char rle_code;
|
||||
unsigned char extra_byte, odd_pixel;
|
||||
unsigned char stream_byte;
|
||||
unsigned int pixel_ptr = 0;
|
||||
int row_dec = pic->linesize[0];
|
||||
int row_ptr = (avctx->height - 1) * row_dec;
|
||||
int frame_size = row_dec * avctx->height;
|
||||
int pixel_ptr = 0;
|
||||
int line = avctx->height - 1;
|
||||
int i;
|
||||
|
||||
while (row_ptr >= 0) {
|
||||
while (line >= 0 && pixel_ptr <= avctx->width) {
|
||||
if (bytestream2_get_bytes_left(gb) <= 0) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"MS RLE: bytestream overrun, %d rows left\n",
|
||||
row_ptr);
|
||||
"MS RLE: bytestream overrun, %dx%d left\n",
|
||||
avctx->width - pixel_ptr, line);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
rle_code = stream_byte = bytestream2_get_byteu(gb);
|
||||
@@ -55,7 +53,7 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
|
||||
stream_byte = bytestream2_get_byte(gb);
|
||||
if (stream_byte == 0) {
|
||||
/* line is done, goto the next one */
|
||||
row_ptr -= row_dec;
|
||||
line--;
|
||||
pixel_ptr = 0;
|
||||
} else if (stream_byte == 1) {
|
||||
/* decode is done */
|
||||
@@ -65,13 +63,12 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
|
||||
stream_byte = bytestream2_get_byte(gb);
|
||||
pixel_ptr += stream_byte;
|
||||
stream_byte = bytestream2_get_byte(gb);
|
||||
row_ptr -= stream_byte * row_dec;
|
||||
} else {
|
||||
// copy pixels from encoded stream
|
||||
odd_pixel = stream_byte & 1;
|
||||
rle_code = (stream_byte + 1) / 2;
|
||||
extra_byte = rle_code & 0x01;
|
||||
if (row_ptr + pixel_ptr + stream_byte > frame_size ||
|
||||
if (pixel_ptr + 2*rle_code - odd_pixel > avctx->width ||
|
||||
bytestream2_get_bytes_left(gb) < rle_code) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"MS RLE: frame/stream ptr just went out of bounds (copy)\n");
|
||||
@@ -82,13 +79,13 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
|
||||
if (pixel_ptr >= avctx->width)
|
||||
break;
|
||||
stream_byte = bytestream2_get_byteu(gb);
|
||||
pic->data[0][row_ptr + pixel_ptr] = stream_byte >> 4;
|
||||
pic->data[0][line * pic->linesize[0] + pixel_ptr] = stream_byte >> 4;
|
||||
pixel_ptr++;
|
||||
if (i + 1 == rle_code && odd_pixel)
|
||||
break;
|
||||
if (pixel_ptr >= avctx->width)
|
||||
break;
|
||||
pic->data[0][row_ptr + pixel_ptr] = stream_byte & 0x0F;
|
||||
pic->data[0][line * pic->linesize[0] + pixel_ptr] = stream_byte & 0x0F;
|
||||
pixel_ptr++;
|
||||
}
|
||||
|
||||
@@ -98,7 +95,7 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
|
||||
}
|
||||
} else {
|
||||
// decode a run of data
|
||||
if (row_ptr + pixel_ptr + stream_byte > frame_size) {
|
||||
if (pixel_ptr + rle_code > avctx->width + 1) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"MS RLE: frame ptr just went out of bounds (run)\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -108,9 +105,9 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
|
||||
if (pixel_ptr >= avctx->width)
|
||||
break;
|
||||
if ((i & 1) == 0)
|
||||
pic->data[0][row_ptr + pixel_ptr] = stream_byte >> 4;
|
||||
pic->data[0][line * pic->linesize[0] + pixel_ptr] = stream_byte >> 4;
|
||||
else
|
||||
pic->data[0][row_ptr + pixel_ptr] = stream_byte & 0x0F;
|
||||
pic->data[0][line * pic->linesize[0] + pixel_ptr] = stream_byte & 0x0F;
|
||||
pixel_ptr++;
|
||||
}
|
||||
}
|
||||
|
@@ -1583,6 +1583,9 @@ int av_find_default_stream_index(AVFormatContext *s)
|
||||
score += 50;
|
||||
}
|
||||
|
||||
if (st->discard != AVDISCARD_ALL)
|
||||
score += 200;
|
||||
|
||||
if (score > best_score) {
|
||||
best_score = score;
|
||||
best_stream = i;
|
||||
|
@@ -49,6 +49,7 @@ static int flags, checked;
|
||||
void av_force_cpu_flags(int arg){
|
||||
if ( (arg & ( AV_CPU_FLAG_3DNOW |
|
||||
AV_CPU_FLAG_3DNOWEXT |
|
||||
AV_CPU_FLAG_MMXEXT |
|
||||
AV_CPU_FLAG_SSE |
|
||||
AV_CPU_FLAG_SSE2 |
|
||||
AV_CPU_FLAG_SSE2SLOW |
|
||||
|
@@ -41,12 +41,20 @@ PCA *ff_pca_init(int n){
|
||||
return NULL;
|
||||
|
||||
pca= av_mallocz(sizeof(*pca));
|
||||
if (!pca)
|
||||
return NULL;
|
||||
|
||||
pca->n= n;
|
||||
pca->z = av_malloc_array(n, sizeof(*pca->z));
|
||||
pca->count=0;
|
||||
pca->covariance= av_calloc(n*n, sizeof(double));
|
||||
pca->mean= av_calloc(n, sizeof(double));
|
||||
|
||||
if (!pca->z || !pca->covariance || !pca->mean) {
|
||||
ff_pca_free(pca);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pca;
|
||||
}
|
||||
|
||||
|
@@ -35,12 +35,12 @@
|
||||
#define PARAM AV_OPT_FLAG_AUDIO_PARAM
|
||||
|
||||
static const AVOption options[]={
|
||||
{"ich" , "set input channel count" , OFFSET( in.ch_count ), AV_OPT_TYPE_INT , {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"in_channel_count" , "set input channel count" , OFFSET( in.ch_count ), AV_OPT_TYPE_INT , {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"och" , "set output channel count" , OFFSET(out.ch_count ), AV_OPT_TYPE_INT , {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"out_channel_count" , "set output channel count" , OFFSET(out.ch_count ), AV_OPT_TYPE_INT , {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"uch" , "set used channel count" , OFFSET(used_ch_count ), AV_OPT_TYPE_INT , {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"used_channel_count" , "set used channel count" , OFFSET(used_ch_count ), AV_OPT_TYPE_INT , {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"ich" , "set input channel count" , OFFSET(user_in_ch_count ), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"in_channel_count" , "set input channel count" , OFFSET(user_in_ch_count ), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"och" , "set output channel count" , OFFSET(user_out_ch_count ), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"out_channel_count" , "set output channel count" , OFFSET(user_out_ch_count ), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"uch" , "set used channel count" , OFFSET(user_used_ch_count), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"used_channel_count" , "set used channel count" , OFFSET(user_used_ch_count), AV_OPT_TYPE_INT, {.i64=0 }, 0 , SWR_CH_MAX, PARAM},
|
||||
{"isr" , "set input sample rate" , OFFSET( in_sample_rate), AV_OPT_TYPE_INT , {.i64=0 }, 0 , INT_MAX , PARAM},
|
||||
{"in_sample_rate" , "set input sample rate" , OFFSET( in_sample_rate), AV_OPT_TYPE_INT , {.i64=0 }, 0 , INT_MAX , PARAM},
|
||||
{"osr" , "set output sample rate" , OFFSET(out_sample_rate), AV_OPT_TYPE_INT , {.i64=0 }, 0 , INT_MAX , PARAM},
|
||||
@@ -51,10 +51,10 @@ static const AVOption options[]={
|
||||
{"out_sample_fmt" , "set output sample format" , OFFSET(out_sample_fmt ), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1 , INT_MAX, PARAM},
|
||||
{"tsf" , "set internal sample format" , OFFSET(int_sample_fmt ), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1 , INT_MAX, PARAM},
|
||||
{"internal_sample_fmt" , "set internal sample format" , OFFSET(int_sample_fmt ), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1 , INT_MAX, PARAM},
|
||||
{"icl" , "set input channel layout" , OFFSET( in_ch_layout ), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, 0 , INT64_MAX , PARAM, "channel_layout"},
|
||||
{"in_channel_layout" , "set input channel layout" , OFFSET( in_ch_layout ), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, 0 , INT64_MAX , PARAM, "channel_layout"},
|
||||
{"ocl" , "set output channel layout" , OFFSET(out_ch_layout ), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, 0 , INT64_MAX , PARAM, "channel_layout"},
|
||||
{"out_channel_layout" , "set output channel layout" , OFFSET(out_ch_layout ), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, 0 , INT64_MAX , PARAM, "channel_layout"},
|
||||
{"icl" , "set input channel layout" , OFFSET(user_in_ch_layout ), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, 0 , INT64_MAX , PARAM, "channel_layout"},
|
||||
{"in_channel_layout" , "set input channel layout" , OFFSET(user_in_ch_layout ), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, 0 , INT64_MAX , PARAM, "channel_layout"},
|
||||
{"ocl" , "set output channel layout" , OFFSET(user_out_ch_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, 0 , INT64_MAX , PARAM, "channel_layout"},
|
||||
{"out_channel_layout" , "set output channel layout" , OFFSET(user_out_ch_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=0 }, 0 , INT64_MAX , PARAM, "channel_layout"},
|
||||
{"clev" , "set center mix level" , OFFSET(clev ), AV_OPT_TYPE_FLOAT, {.dbl=C_30DB }, -32 , 32 , PARAM},
|
||||
{"center_mix_level" , "set center mix level" , OFFSET(clev ), AV_OPT_TYPE_FLOAT, {.dbl=C_30DB }, -32 , 32 , PARAM},
|
||||
{"slev" , "set surround mix level" , OFFSET(slev ), AV_OPT_TYPE_FLOAT, {.dbl=C_30DB }, -32 , 32 , PARAM},
|
||||
|
@@ -65,8 +65,8 @@ int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride)
|
||||
if (!s || s->in_convert) // s needs to be allocated but not initialized
|
||||
return AVERROR(EINVAL);
|
||||
memset(s->matrix, 0, sizeof(s->matrix));
|
||||
nb_in = av_get_channel_layout_nb_channels(s->in_ch_layout);
|
||||
nb_out = av_get_channel_layout_nb_channels(s->out_ch_layout);
|
||||
nb_in = av_get_channel_layout_nb_channels(s->user_in_ch_layout);
|
||||
nb_out = av_get_channel_layout_nb_channels(s->user_out_ch_layout);
|
||||
for (out = 0; out < nb_out; out++) {
|
||||
for (in = 0; in < nb_in; in++)
|
||||
s->matrix[out][in] = matrix[in];
|
||||
|
@@ -314,6 +314,11 @@ int main(int argc, char **argv){
|
||||
fprintf(stderr, "Failed to init backw_ctx\n");
|
||||
return 1;
|
||||
}
|
||||
if (uint_rand(rand_seed) % 3 == 0)
|
||||
av_opt_set_int(forw_ctx, "ich", 0, 0);
|
||||
if (uint_rand(rand_seed) % 3 == 0)
|
||||
av_opt_set_int(forw_ctx, "och", 0, 0);
|
||||
|
||||
if(swr_init( forw_ctx) < 0)
|
||||
fprintf(stderr, "swr_init(->) failed\n");
|
||||
if(swr_init(backw_ctx) < 0)
|
||||
|
@@ -86,10 +86,10 @@ struct SwrContext *swr_alloc_set_opts(struct SwrContext *s,
|
||||
if (av_opt_set_int(s, "tsf", AV_SAMPLE_FMT_NONE, 0) < 0)
|
||||
goto fail;
|
||||
|
||||
if (av_opt_set_int(s, "ich", av_get_channel_layout_nb_channels(s-> in_ch_layout), 0) < 0)
|
||||
if (av_opt_set_int(s, "ich", av_get_channel_layout_nb_channels(s-> user_in_ch_layout), 0) < 0)
|
||||
goto fail;
|
||||
|
||||
if (av_opt_set_int(s, "och", av_get_channel_layout_nb_channels(s->out_ch_layout), 0) < 0)
|
||||
if (av_opt_set_int(s, "och", av_get_channel_layout_nb_channels(s->user_out_ch_layout), 0) < 0)
|
||||
goto fail;
|
||||
|
||||
av_opt_set_int(s, "uch", 0, 0);
|
||||
@@ -152,6 +152,7 @@ av_cold void swr_close(SwrContext *s){
|
||||
|
||||
av_cold int swr_init(struct SwrContext *s){
|
||||
int ret;
|
||||
char l1[1024], l2[1024];
|
||||
|
||||
clear_context(s);
|
||||
|
||||
@@ -164,6 +165,13 @@ av_cold int swr_init(struct SwrContext *s){
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
s->out.ch_count = s-> user_out_ch_count;
|
||||
s-> in.ch_count = s-> user_in_ch_count;
|
||||
s->used_ch_count = s->user_used_ch_count;
|
||||
|
||||
s-> in_ch_layout = s-> user_in_ch_layout;
|
||||
s->out_ch_layout = s->user_out_ch_layout;
|
||||
|
||||
if(av_get_channel_layout_nb_channels(s-> in_ch_layout) > SWR_CH_MAX) {
|
||||
av_log(s, AV_LOG_WARNING, "Input channel layout 0x%"PRIx64" is invalid or unsupported.\n", s-> in_ch_layout);
|
||||
s->in_ch_layout = 0;
|
||||
@@ -271,10 +279,18 @@ av_cold int swr_init(struct SwrContext *s){
|
||||
return -1;
|
||||
}
|
||||
|
||||
av_get_channel_layout_string(l1, sizeof(l1), s-> in.ch_count, s-> in_ch_layout);
|
||||
av_get_channel_layout_string(l2, sizeof(l2), s->out.ch_count, s->out_ch_layout);
|
||||
if (s->out_ch_layout && s->out.ch_count != av_get_channel_layout_nb_channels(s->out_ch_layout)) {
|
||||
av_log(s, AV_LOG_ERROR, "Output channel layout %s mismatches specified channel count %d\n", l2, s->out.ch_count);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
if (s->in_ch_layout && s->used_ch_count != av_get_channel_layout_nb_channels(s->in_ch_layout)) {
|
||||
av_log(s, AV_LOG_ERROR, "Input channel layout %s mismatches specified channel count %d\n", l1, s->used_ch_count);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if ((!s->out_ch_layout || !s->in_ch_layout) && s->used_ch_count != s->out.ch_count && !s->rematrix_custom) {
|
||||
char l1[1024], l2[1024];
|
||||
av_get_channel_layout_string(l1, sizeof(l1), s-> in.ch_count, s-> in_ch_layout);
|
||||
av_get_channel_layout_string(l2, sizeof(l2), s->out.ch_count, s->out_ch_layout);
|
||||
av_log(s, AV_LOG_ERROR, "Rematrix is needed between %s and %s "
|
||||
"but there is not enough information to do it\n", l1, l2);
|
||||
return -1;
|
||||
|
@@ -90,6 +90,12 @@ struct SwrContext {
|
||||
int used_ch_count; ///< number of used input channels (mapped channel count if channel_map, otherwise in.ch_count)
|
||||
enum SwrEngine engine;
|
||||
|
||||
int user_in_ch_count; ///< User set input channel count
|
||||
int user_out_ch_count; ///< User set output channel count
|
||||
int user_used_ch_count; ///< User set used channel count
|
||||
int64_t user_in_ch_layout; ///< User set input channel layout
|
||||
int64_t user_out_ch_layout; ///< User set output channel layout
|
||||
|
||||
struct DitherContext dither;
|
||||
|
||||
int filter_size; /**< length of each FIR filter in the resampling filterbank relative to the cutoff frequency */
|
||||
|
Reference in New Issue
Block a user