Compare commits
96 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0045969e41 | |||
| b06958917c | |||
| cc39b2be23 | |||
| e0bd87de8f | |||
| 3faf444010 | |||
| 5b41bb29d7 | |||
| 1c058d94b9 | |||
| b15311eb6f | |||
| 98f1672022 | |||
| cbaa9ef0d6 | |||
| ac3358d73a | |||
| eac75d405b | |||
| 595af5a036 | |||
| 33629ff60f | |||
| 43956940ea | |||
| 2d582d142c | |||
| d2b0aae5e1 | |||
| 8fe79605fd | |||
| 7ae349a324 | |||
| 24f1698758 | |||
| 649f09c4cf | |||
| e3bacdbaad | |||
| 3bc20fe48c | |||
| 7a7ec3ccd9 | |||
| 634605f79e | |||
| cf27b297ca | |||
| bd5cf1dd8f | |||
| f78573466d | |||
| 41fba53525 | |||
| a23a6bf06b | |||
| cbc5d2bf30 | |||
| c58b0d981e | |||
| 3fb241210a | |||
| 9463930faf | |||
| 9e52f6b986 | |||
| 7ecaa736e7 | |||
| 7fdc2ba3d4 | |||
| 514d0e29c8 | |||
| 47a5cde6ac | |||
| c6e16ec711 | |||
| 3dfadef522 | |||
| e35c534890 | |||
| 2789d15114 | |||
| a47bc9a056 | |||
| 925adad3e0 | |||
| 286e14667f | |||
| 1795bef7c7 | |||
| d50d11c56c | |||
| bada03d746 | |||
| 2f1bff1690 | |||
| 60a3bd625f | |||
| 0077298904 | |||
| b3745ce8c2 | |||
| 933ae708c5 | |||
| e588252a42 | |||
| 7de7d81ee5 | |||
| 9d0aa058c9 | |||
| 5302adb323 | |||
| c5dd6fefd4 | |||
| 13a9a0c1a4 | |||
| 9da5ba1f57 | |||
| 8c8406462b | |||
| 18aef7c075 | |||
| cd83ff5d4c | |||
| 22349b9f7d | |||
| d54ca4167c | |||
| 670832e2a2 | |||
| 6ff5c4cd49 | |||
| 402f832984 | |||
| d768242152 | |||
| 84cf741861 | |||
| 8fc8b3eebe | |||
| 5709ac5c42 | |||
| 4121c1db15 | |||
| 0081afeaa7 | |||
| df2258f18d | |||
| 8498cf60b2 | |||
| 3943086656 | |||
| 35ab85884b | |||
| f141ac2d70 | |||
| e0f859e8fe | |||
| 7da1e8a0d8 | |||
| 8b0a063ba9 | |||
| 80b1cc31b8 | |||
| c49b88b93b | |||
| dfc147d24f | |||
| 859ce02c98 | |||
| aa3ec219e1 | |||
| a9f108bd78 | |||
| 02477323b9 | |||
| d9655621b3 | |||
| 1a4cb3b29c | |||
| ff02eeafd8 | |||
| bd28de1b4d | |||
| 57d094e3e3 | |||
| 65d61a4bbb |
@@ -1,6 +1,94 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 2.4.11:
|
||||
- avformat/hevc: Check num_long_term_ref_pics_sps to avoid potentially long loops
|
||||
- avformat/hevc: Fix parsing errors
|
||||
- ffmpeg: Use correct codec_id for av_parser_change() check
|
||||
- ffmpeg: Check av_parser_change() for failure
|
||||
- avcodec/h264_mp4toannexb_bsf: Reorder operations in nal_size check
|
||||
- ffmpeg: Check for RAWVIDEO and do not relay only on AVFMT_RAWPICTURE
|
||||
- ffmpeg: check avpicture_fill() return value
|
||||
- avformat/mux: Update sidedata in ff_write_chained()
|
||||
- avcodec/flashsvenc: Correct max dimension in error message
|
||||
- avcodec/svq1enc: Check dimensions
|
||||
- avcodec/dcaenc: clear bitstream end
|
||||
- libavcodec/aacdec_template: Use init_get_bits8() in aac_decode_frame()
|
||||
- rawdec: fix mjpeg probing buffer size check
|
||||
- rawdec: fix mjpeg probing
|
||||
- avcodec/vp8: Check buffer size in vp8_decode_frame_header()
|
||||
- avcodec/vp8: Fix null pointer dereference in ff_vp8_decode_free()
|
||||
- avcodec/diracdec: Check for hpel_base allocation failure
|
||||
- avcodec/rv34: Clear pointers in ff_rv34_decode_init_thread_copy()
|
||||
- avfilter/af_aresample: Check ff_all_* for allocation failures
|
||||
- avcodec/pthread_frame: clear priv_data, avoid stale pointer in error case
|
||||
- swscale/utils: Clear pix buffers
|
||||
- avutil/fifo: Fix the case where func() returns less bytes than requested in av_fifo_generic_write()
|
||||
- avformat/mov: Fix deallocation when MOVStreamContext failed to allocate
|
||||
- ffmpeg: Fix cleanup with ost = NULL
|
||||
- avcodec/pthread_frame: check avctx on deallocation
|
||||
- avcodec/sanm: Reset sizes in destroy_buffers()
|
||||
- avcodec/alac: Clear pointers in allocate_buffers()
|
||||
- bytestream2: set the reader to the end when reading more than available
|
||||
- avcodec/utils: use a minimum 32pixel width in avcodec_align_dimensions2() for H.264
|
||||
- avcodec/mpegvideo: Clear pointers in ff_mpv_common_init()
|
||||
- oggparsedirac: check return value of init_get_bits
|
||||
- wmalosslessdec: reset frame->nb_samples on packet loss
|
||||
- wmalosslessdec: avoid reading 0 bits with get_bits
|
||||
- avcodec/rawenc: Use ff_alloc_packet() instead of ff_alloc_packet2()
|
||||
- avcodec/aacsbr: Assert that bs_num_env is positive
|
||||
- avcodec/aacsbr: check that the element type matches before applying SBR
|
||||
- avcodec/h264_slice: Use w/h from the AVFrame instead of mb_w/h
|
||||
- vp9/update_prob: prevent out of bounds table read
|
||||
- avfilter/vf_transpose: Fix rounding error
|
||||
- avcodec/pngdec: Only allow one IHDR chunk
|
||||
- wmavoice: limit wmavoice_decode_packet return value to packet size
|
||||
- swscale/swscale_unscaled: Fix rounding difference with RGBA output between little and big endian
|
||||
- ffmpeg: Do not use the data/size of a bitstream filter after failure
|
||||
- swscale/x86/rgb2rgb_template: fix signedness of v in shuffle_bytes_2103_{mmx,mmxext}
|
||||
- swscale/x86/rgb2rgb_template: add missing xmm clobbers
|
||||
- vda: unlock the pixel buffer base address.
|
||||
- swscale/rgb2rgb_template: Fix signedness of v in shuffle_bytes_2103_c()
|
||||
- swscale/rgb2rgb_template: Implement shuffle_bytes_0321_c and fix shuffle_bytes_2103_c on BE
|
||||
- swscale/rgb2rgb_template: Disable shuffle_bytes_2103_c on big endian
|
||||
- swr: Remember previously set int_sample_format from user
|
||||
- matroskadec: check audio sample rate
|
||||
- matroskadec: validate audio channels and bitdepth
|
||||
- avcodec/dpxenc: implement write16/32 as functions
|
||||
- postproc: fix unaligned access
|
||||
- avio: fix potential crashes when combining ffio_ensure_seekback + crc
|
||||
- h264: er: Copy from the previous reference only if compatible
|
||||
- sonic: set avctx->channels in sonic_decode_init
|
||||
- vp8: change mv_{min,max}.{x,y} type to int
|
||||
- vp9: change type of tile_size from unsigned to int64_t
|
||||
- arm: only enable setend on ARMv6
|
||||
- libopenjpegdec: check existence of image component data
|
||||
- mov: abort on EOF in ff_mov_read_chan
|
||||
- ffmpeg_opt: Check for localtime() failure
|
||||
- avformat: Fix bug in parse_rps for HEVC.
|
||||
- takdec: ensure chan2 is a valid channel index
|
||||
- avcodec/h264_slice: Use AVFrame diemensions for grayscale handling
|
||||
- avdevice/lavfi: do not rescale AV_NOPTS_VALUE in lavfi_read_packet()
|
||||
- libavutil/channel_layout: Correctly return layout when channel specification ends with a trailing 'c'.
|
||||
- avcodec/jpeg2000dec: Check that coords match before applying ICT
|
||||
- avformat/ffmdec: Check ffio_set_buf_size() return value
|
||||
- avcodec/adpcm: Check for overreads
|
||||
- avcodec/alsdec: Check for overread
|
||||
- avcodec/atrac3plusdec: consume only as many bytes as available
|
||||
- swresample/swresample: Cleanup on init failure.
|
||||
- Revert "avformat/rtpenc: check av_packet_get_side_data() return, fix null ptr dereference"
|
||||
- avformat/mxfenc: Accept MXF D-10 with 49.999840 Mbit/sec
|
||||
- swresample/dither: check memory allocation
|
||||
- opusdec: properly handle mismatching configurations in multichannel streams
|
||||
- MAINTAINERS: Remove myself as leader
|
||||
- h263: Always check both dimensions
|
||||
- avformat/swfdec: Do not error out on pixel format changes
|
||||
- avcodec/exr: fix crash caused by merge
|
||||
- avcodec/x86/h264_weight: handle weight1=128
|
||||
- avcodec/hevc_ps: Only discard overread VPS if a previous is available
|
||||
- avformat/mov: Mark avio context of decompressed atoms as seekable
|
||||
_ avfilter/x86/vf_hqdn3d: Fix register types
|
||||
|
||||
version 2.4.10:
|
||||
- diracdec: check if reference could not be allocated
|
||||
- diracdec: avoid overflow of bytes*8 in decode_lowdelay
|
||||
|
||||
@@ -14,7 +14,6 @@ patches and related discussions.
|
||||
Project Leader
|
||||
==============
|
||||
|
||||
Michael Niedermayer
|
||||
final design decisions
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -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.4.10
|
||||
PROJECT_NUMBER = 2.4.11
|
||||
|
||||
# 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
|
||||
|
||||
@@ -466,7 +466,12 @@ static void ffmpeg_cleanup(int ret)
|
||||
}
|
||||
for (i = 0; i < nb_output_streams; i++) {
|
||||
OutputStream *ost = output_streams[i];
|
||||
AVBitStreamFilterContext *bsfc = ost->bitstream_filters;
|
||||
AVBitStreamFilterContext *bsfc;
|
||||
|
||||
if (!ost)
|
||||
continue;
|
||||
|
||||
bsfc = ost->bitstream_filters;
|
||||
while (bsfc) {
|
||||
AVBitStreamFilterContext *next = bsfc->next;
|
||||
av_bitstream_filter_close(bsfc);
|
||||
@@ -645,6 +650,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
|
||||
if (!new_pkt.buf)
|
||||
exit_program(1);
|
||||
} else if (a < 0) {
|
||||
new_pkt = *pkt;
|
||||
av_log(NULL, AV_LOG_ERROR, "Failed to open bitstream filter %s for stream %d with codec %s",
|
||||
bsfc->filter->name, pkt->stream_index,
|
||||
avctx->codec ? avctx->codec->name : "copy");
|
||||
@@ -1681,17 +1687,21 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
|
||||
|
||||
opkt.duration = av_rescale_q(pkt->duration, ist->st->time_base, ost->st->time_base);
|
||||
opkt.flags = pkt->flags;
|
||||
|
||||
// FIXME remove the following 2 lines they shall be replaced by the bitstream filters
|
||||
if ( ost->enc_ctx->codec_id != AV_CODEC_ID_H264
|
||||
&& ost->enc_ctx->codec_id != AV_CODEC_ID_MPEG1VIDEO
|
||||
&& ost->enc_ctx->codec_id != AV_CODEC_ID_MPEG2VIDEO
|
||||
&& ost->enc_ctx->codec_id != AV_CODEC_ID_VC1
|
||||
if ( ost->st->codec->codec_id != AV_CODEC_ID_H264
|
||||
&& ost->st->codec->codec_id != AV_CODEC_ID_MPEG1VIDEO
|
||||
&& ost->st->codec->codec_id != AV_CODEC_ID_MPEG2VIDEO
|
||||
&& ost->st->codec->codec_id != AV_CODEC_ID_VC1
|
||||
) {
|
||||
if (av_parser_change(ost->parser, ost->st->codec,
|
||||
int ret = av_parser_change(ost->parser, ost->st->codec,
|
||||
&opkt.data, &opkt.size,
|
||||
pkt->data, pkt->size,
|
||||
pkt->flags & AV_PKT_FLAG_KEY)) {
|
||||
pkt->flags & AV_PKT_FLAG_KEY);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL, "av_parser_change failed\n");
|
||||
exit_program(1);
|
||||
}
|
||||
if (ret) {
|
||||
opkt.buf = av_buffer_create(opkt.data, opkt.size, av_buffer_default_free, NULL, 0);
|
||||
if (!opkt.buf)
|
||||
exit_program(1);
|
||||
@@ -1702,9 +1712,15 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
|
||||
}
|
||||
av_copy_packet_side_data(&opkt, pkt);
|
||||
|
||||
if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (of->ctx->oformat->flags & AVFMT_RAWPICTURE)) {
|
||||
if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
|
||||
ost->st->codec->codec_id == AV_CODEC_ID_RAWVIDEO &&
|
||||
(of->ctx->oformat->flags & AVFMT_RAWPICTURE)) {
|
||||
/* store AVPicture in AVPacket, as expected by the output format */
|
||||
avpicture_fill(&pict, opkt.data, ost->st->codec->pix_fmt, ost->st->codec->width, ost->st->codec->height);
|
||||
int ret = avpicture_fill(&pict, opkt.data, ost->st->codec->pix_fmt, ost->st->codec->width, ost->st->codec->height);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL, "avpicture_fill failed\n");
|
||||
exit_program(1);
|
||||
}
|
||||
opkt.data = (uint8_t *)&pict;
|
||||
opkt.size = sizeof(AVPicture);
|
||||
opkt.flags |= AV_PKT_FLAG_KEY;
|
||||
|
||||
@@ -2321,6 +2321,9 @@ static int opt_vstats(void *optctx, const char *opt, const char *arg)
|
||||
time_t today2 = time(NULL);
|
||||
struct tm *today = localtime(&today2);
|
||||
|
||||
if (!today)
|
||||
return AVERROR(errno);
|
||||
|
||||
snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
|
||||
today->tm_sec);
|
||||
return opt_vstats_file(NULL, opt, filename);
|
||||
|
||||
@@ -77,6 +77,8 @@ static int vda_retrieve_data(AVCodecContext *s, AVFrame *frame)
|
||||
frame->width, frame->height);
|
||||
|
||||
ret = av_frame_copy_props(vda->tmp_frame, frame);
|
||||
CVPixelBufferUnlockBaseAddress(pixbuf, kCVPixelBufferLock_ReadOnly);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
||||
+1
-1
@@ -3096,7 +3096,7 @@ static int aac_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if (INT_MAX / 8 <= buf_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((err = init_get_bits(&gb, buf, buf_size * 8)) < 0)
|
||||
if ((err = init_get_bits8(&gb, buf, buf_size)) < 0)
|
||||
return err;
|
||||
|
||||
switch (ac->oc[1].m4ac.object_type) {
|
||||
|
||||
@@ -1018,6 +1018,8 @@ static unsigned int read_sbr_data(AACContext *ac, SpectralBandReplication *sbr,
|
||||
{
|
||||
unsigned int cnt = get_bits_count(gb);
|
||||
|
||||
sbr->id_aac = id_aac;
|
||||
|
||||
if (id_aac == TYPE_SCE || id_aac == TYPE_CCE) {
|
||||
if (read_sbr_single_channel_element(ac, sbr, gb)) {
|
||||
sbr_turnoff(sbr);
|
||||
@@ -1688,6 +1690,12 @@ void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
|
||||
int nch = (id_aac == TYPE_CPE) ? 2 : 1;
|
||||
int err;
|
||||
|
||||
if (id_aac != sbr->id_aac) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR,
|
||||
"element type mismatch %d != %d\n", id_aac, sbr->id_aac);
|
||||
sbr_turnoff(sbr);
|
||||
}
|
||||
|
||||
if (!sbr->kx_and_m_pushed) {
|
||||
sbr->kx[0] = sbr->kx[1];
|
||||
sbr->m[0] = sbr->m[1];
|
||||
@@ -1711,6 +1719,7 @@ void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
|
||||
sbr->c.sbr_hf_inverse_filter(&sbr->dsp, sbr->alpha0, sbr->alpha1,
|
||||
(const float (*)[40][2]) sbr->X_low, sbr->k[0]);
|
||||
sbr_chirp(sbr, &sbr->data[ch]);
|
||||
av_assert0(sbr->data[ch].bs_num_env > 0);
|
||||
sbr_hf_gen(ac, sbr, sbr->X_high,
|
||||
(const float (*)[40][2]) sbr->X_low,
|
||||
(const float (*)[2]) sbr->alpha0,
|
||||
|
||||
+12
-1
@@ -574,6 +574,8 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
|
||||
case AV_CODEC_ID_ADPCM_IMA_DK4:
|
||||
if (avctx->block_align > 0)
|
||||
buf_size = FFMIN(buf_size, avctx->block_align);
|
||||
if (buf_size < 4 * ch)
|
||||
return AVERROR_INVALIDDATA;
|
||||
nb_samples = 1 + (buf_size - 4 * ch) * 2 / ch;
|
||||
break;
|
||||
case AV_CODEC_ID_ADPCM_IMA_RAD:
|
||||
@@ -587,13 +589,15 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
|
||||
int bsamples = ff_adpcm_ima_block_samples[avctx->bits_per_coded_sample - 2];
|
||||
if (avctx->block_align > 0)
|
||||
buf_size = FFMIN(buf_size, avctx->block_align);
|
||||
if (buf_size < 4 * ch)
|
||||
return AVERROR_INVALIDDATA;
|
||||
nb_samples = 1 + (buf_size - 4 * ch) / (bsize * ch) * bsamples;
|
||||
break;
|
||||
}
|
||||
case AV_CODEC_ID_ADPCM_MS:
|
||||
if (avctx->block_align > 0)
|
||||
buf_size = FFMIN(buf_size, avctx->block_align);
|
||||
nb_samples = 2 + (buf_size - 7 * ch) * 2 / ch;
|
||||
nb_samples = (buf_size - 6 * ch) * 2 / ch;
|
||||
break;
|
||||
case AV_CODEC_ID_ADPCM_SBPRO_2:
|
||||
case AV_CODEC_ID_ADPCM_SBPRO_3:
|
||||
@@ -606,6 +610,8 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
|
||||
case AV_CODEC_ID_ADPCM_SBPRO_4: samples_per_byte = 2; break;
|
||||
}
|
||||
if (!s->status[0].step_index) {
|
||||
if (buf_size < ch)
|
||||
return AVERROR_INVALIDDATA;
|
||||
nb_samples++;
|
||||
buf_size -= ch;
|
||||
}
|
||||
@@ -1524,6 +1530,11 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
*got_frame_ptr = 1;
|
||||
|
||||
if (avpkt->size < bytestream2_tell(&gb)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Overread of %d < %d\n", avpkt->size, bytestream2_tell(&gb));
|
||||
return avpkt->size;
|
||||
}
|
||||
|
||||
return bytestream2_tell(&gb);
|
||||
}
|
||||
|
||||
|
||||
@@ -534,6 +534,12 @@ static int allocate_buffers(ALACContext *alac)
|
||||
int ch;
|
||||
int buf_size = alac->max_samples_per_frame * sizeof(int32_t);
|
||||
|
||||
for (ch = 0; ch < 2; ch++) {
|
||||
alac->predict_error_buffer[ch] = NULL;
|
||||
alac->output_samples_buffer[ch] = NULL;
|
||||
alac->extra_bits_buffer[ch] = NULL;
|
||||
}
|
||||
|
||||
for (ch = 0; ch < FFMIN(alac->channels, 2); ch++) {
|
||||
FF_ALLOC_OR_GOTO(alac->avctx, alac->predict_error_buffer[ch],
|
||||
buf_size, buf_alloc_fail);
|
||||
|
||||
@@ -1493,6 +1493,11 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
|
||||
|
||||
// TODO: read_diff_float_data
|
||||
|
||||
if (get_bits_left(gb) < 0) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Overread %d\n", -get_bits_left(gb));
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -381,7 +381,7 @@ static int atrac3p_decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
*got_frame_ptr = 1;
|
||||
|
||||
return avctx->block_align;
|
||||
return FFMIN(avctx->block_align, avpkt->size);
|
||||
}
|
||||
|
||||
AVCodec ff_atrac3p_decoder = {
|
||||
|
||||
@@ -71,8 +71,10 @@ static av_always_inline type bytestream2_get_ ## name ## u(GetByteContext *g) \
|
||||
} \
|
||||
static av_always_inline type bytestream2_get_ ## name(GetByteContext *g) \
|
||||
{ \
|
||||
if (g->buffer_end - g->buffer < bytes) \
|
||||
if (g->buffer_end - g->buffer < bytes) { \
|
||||
g->buffer = g->buffer_end; \
|
||||
return 0; \
|
||||
} \
|
||||
return bytestream2_get_ ## name ## u(g); \
|
||||
} \
|
||||
static av_always_inline type bytestream2_peek_ ## name(GetByteContext *g) \
|
||||
|
||||
@@ -939,6 +939,10 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
for (i = 0; i < SUBFRAMES; i++)
|
||||
put_subframe(c, i);
|
||||
|
||||
|
||||
for (i = put_bits_count(&c->pb); i < 8*c->frame_size; i++)
|
||||
put_bits(&c->pb, 1, 0);
|
||||
|
||||
flush_put_bits(&c->pb);
|
||||
|
||||
avpkt->pts = frame->pts;
|
||||
|
||||
+12
-4
@@ -1561,7 +1561,7 @@ static void select_dsp_funcs(DiracContext *s, int width, int height, int xblen,
|
||||
}
|
||||
}
|
||||
|
||||
static void interpolate_refplane(DiracContext *s, DiracFrame *ref, int plane, int width, int height)
|
||||
static int interpolate_refplane(DiracContext *s, DiracFrame *ref, int plane, int width, int height)
|
||||
{
|
||||
/* chroma allocates an edge of 8 when subsampled
|
||||
which for 4:2:2 means an h edge of 16 and v edge of 8
|
||||
@@ -1573,11 +1573,14 @@ static void interpolate_refplane(DiracContext *s, DiracFrame *ref, int plane, in
|
||||
|
||||
/* no need for hpel if we only have fpel vectors */
|
||||
if (!s->mv_precision)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
for (i = 1; i < 4; i++) {
|
||||
if (!ref->hpel_base[plane][i])
|
||||
ref->hpel_base[plane][i] = av_malloc((height+2*edge) * ref->avframe->linesize[plane] + 32);
|
||||
if (!ref->hpel_base[plane][i]) {
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
/* we need to be 16-byte aligned even for chroma */
|
||||
ref->hpel[plane][i] = ref->hpel_base[plane][i] + edge*ref->avframe->linesize[plane] + 16;
|
||||
}
|
||||
@@ -1591,6 +1594,8 @@ static void interpolate_refplane(DiracContext *s, DiracFrame *ref, int plane, in
|
||||
s->mpvencdsp.draw_edges(ref->hpel[plane][3], ref->avframe->linesize[plane], width, height, edge, edge, EDGE_TOP | EDGE_BOTTOM);
|
||||
}
|
||||
ref->interpolated[plane] = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1640,8 +1645,11 @@ static int dirac_decode_frame_internal(DiracContext *s)
|
||||
|
||||
select_dsp_funcs(s, p->width, p->height, p->xblen, p->yblen);
|
||||
|
||||
for (i = 0; i < s->num_refs; i++)
|
||||
interpolate_refplane(s, s->ref_pics[i], comp, p->width, p->height);
|
||||
for (i = 0; i < s->num_refs; i++) {
|
||||
int ret = interpolate_refplane(s, s->ref_pics[i], comp, p->width, p->height);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
memset(s->mctmp, 0, 4*p->yoffset*p->stride);
|
||||
|
||||
|
||||
+13
-10
@@ -75,17 +75,20 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define write16(p, value) \
|
||||
do { \
|
||||
if (s->big_endian) AV_WB16(p, value); \
|
||||
else AV_WL16(p, value); \
|
||||
} while(0)
|
||||
static av_always_inline void write16_internal(int big_endian, void *p, int value)
|
||||
{
|
||||
if (big_endian) AV_WB16(p, value);
|
||||
else AV_WL16(p, value);
|
||||
}
|
||||
|
||||
#define write32(p, value) \
|
||||
do { \
|
||||
if (s->big_endian) AV_WB32(p, value); \
|
||||
else AV_WL32(p, value); \
|
||||
} while(0)
|
||||
static av_always_inline void write32_internal(int big_endian, void *p, int value)
|
||||
{
|
||||
if (big_endian) AV_WB32(p, value);
|
||||
else AV_WL32(p, value);
|
||||
}
|
||||
|
||||
#define write16(p, value) write16_internal(s->big_endian, p, value)
|
||||
#define write32(p, value) write32_internal(s->big_endian, p, value)
|
||||
|
||||
static void encode_rgb48_10bit(AVCodecContext *avctx, const AVPicture *pic, uint8_t *dst)
|
||||
{
|
||||
|
||||
+16
-15
@@ -1011,6 +1011,22 @@ static int decode_header(EXRContext *s)
|
||||
int current_channel_offset = 0;
|
||||
int magic_number, version, flags, i;
|
||||
|
||||
s->xmin = ~0;
|
||||
s->xmax = ~0;
|
||||
s->ymin = ~0;
|
||||
s->ymax = ~0;
|
||||
s->xdelta = ~0;
|
||||
s->ydelta = ~0;
|
||||
s->channel_offsets[0] = -1;
|
||||
s->channel_offsets[1] = -1;
|
||||
s->channel_offsets[2] = -1;
|
||||
s->channel_offsets[3] = -1;
|
||||
s->pixel_type = EXR_UNKNOWN;
|
||||
s->compression = EXR_UNKN;
|
||||
s->nb_channels = 0;
|
||||
s->w = 0;
|
||||
s->h = 0;
|
||||
|
||||
if (bytestream2_get_bytes_left(&s->gb) < 10) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Header too short to parse.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -1351,21 +1367,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
float one_gamma = 1.0f / s->gamma;
|
||||
|
||||
s->avctx = avctx;
|
||||
s->xmin = ~0;
|
||||
s->xmax = ~0;
|
||||
s->ymin = ~0;
|
||||
s->ymax = ~0;
|
||||
s->xdelta = ~0;
|
||||
s->ydelta = ~0;
|
||||
s->channel_offsets[0] = -1;
|
||||
s->channel_offsets[1] = -1;
|
||||
s->channel_offsets[2] = -1;
|
||||
s->channel_offsets[3] = -1;
|
||||
s->pixel_type = EXR_UNKNOWN;
|
||||
s->compression = EXR_UNKN;
|
||||
s->nb_channels = 0;
|
||||
s->w = 0;
|
||||
s->h = 0;
|
||||
|
||||
if ( one_gamma > 0.9999f && one_gamma < 1.0001f ) {
|
||||
for ( i = 0; i < 65536; ++i ) {
|
||||
|
||||
@@ -111,7 +111,7 @@ static av_cold int flashsv_encode_init(AVCodecContext *avctx)
|
||||
|
||||
if (avctx->width > 4095 || avctx->height > 4095) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Input dimensions too large, input must be max 4096x4096 !\n");
|
||||
"Input dimensions too large, input must be max 4095x4095 !\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
|
||||
buf += ctx->length_size;
|
||||
unit_type = *buf & 0x1f;
|
||||
|
||||
if (buf + nal_size > buf_end || nal_size < 0)
|
||||
if (nal_size > buf_end - buf || nal_size < 0)
|
||||
goto fail;
|
||||
|
||||
if (unit_type == 7 || unit_type == 8)
|
||||
|
||||
+10
-7
@@ -278,11 +278,11 @@ static int alloc_picture(H264Context *h, H264Picture *pic)
|
||||
av_pix_fmt_get_chroma_sub_sample(pic->f.format,
|
||||
&h_chroma_shift, &v_chroma_shift);
|
||||
|
||||
for(i=0; i<FF_CEIL_RSHIFT(h->avctx->height, v_chroma_shift); i++) {
|
||||
for(i=0; i<FF_CEIL_RSHIFT(pic->f.height, v_chroma_shift); i++) {
|
||||
memset(pic->f.data[1] + pic->f.linesize[1]*i,
|
||||
0x80, FF_CEIL_RSHIFT(h->avctx->width, h_chroma_shift));
|
||||
0x80, FF_CEIL_RSHIFT(pic->f.width, h_chroma_shift));
|
||||
memset(pic->f.data[2] + pic->f.linesize[2]*i,
|
||||
0x80, FF_CEIL_RSHIFT(h->avctx->width, h_chroma_shift));
|
||||
0x80, FF_CEIL_RSHIFT(pic->f.width, h_chroma_shift));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1690,14 +1690,17 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
||||
* vectors. Given we are concealing a lost frame, this probably
|
||||
* is not noticeable by comparison, but it should be fixed. */
|
||||
if (h->short_ref_count) {
|
||||
if (prev) {
|
||||
if (prev &&
|
||||
h->short_ref[0]->f.width == prev->f.width &&
|
||||
h->short_ref[0]->f.height == prev->f.height &&
|
||||
h->short_ref[0]->f.format == prev->f.format) {
|
||||
av_image_copy(h->short_ref[0]->f.data,
|
||||
h->short_ref[0]->f.linesize,
|
||||
(const uint8_t **)prev->f.data,
|
||||
prev->f.linesize,
|
||||
h->avctx->pix_fmt,
|
||||
h->mb_width * 16,
|
||||
h->mb_height * 16);
|
||||
prev->f.format,
|
||||
prev->f.width,
|
||||
prev->f.height);
|
||||
h->short_ref[0]->poc = prev->poc + 2;
|
||||
}
|
||||
h->short_ref[0]->frame_num = h->prev_frame_num;
|
||||
|
||||
@@ -461,7 +461,8 @@ int ff_hevc_decode_nal_vps(HEVCContext *s)
|
||||
if (get_bits_left(gb) < 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"Overread VPS by %d bits\n", -get_bits_left(gb));
|
||||
goto err;
|
||||
if (s->vps_list[vps_id])
|
||||
goto err;
|
||||
}
|
||||
|
||||
av_buffer_unref(&s->vps_list[vps_id]);
|
||||
|
||||
+1
-1
@@ -1018,7 +1018,7 @@ static int imc_decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
IMCContext *q = avctx->priv_data;
|
||||
|
||||
LOCAL_ALIGNED_16(uint16_t, buf16, [IMC_BLOCK_SIZE / 2 + FF_INPUT_BUFFER_PADDING_SIZE/2]);
|
||||
LOCAL_ALIGNED_16(uint16_t, buf16, [(IMC_BLOCK_SIZE + FF_INPUT_BUFFER_PADDING_SIZE) / 2]);
|
||||
|
||||
if (buf_size < IMC_BLOCK_SIZE * avctx->channels) {
|
||||
av_log(avctx, AV_LOG_ERROR, "frame too small!\n");
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <limits.h>
|
||||
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/internal.h"
|
||||
#include "libavutil/mathematics.h"
|
||||
#include "avcodec.h"
|
||||
@@ -872,7 +873,7 @@ end:
|
||||
/* most is hardcoded. should extend to handle all h263 streams */
|
||||
int ff_h263_decode_picture_header(MpegEncContext *s)
|
||||
{
|
||||
int format, width, height, i;
|
||||
int format, width, height, i, ret;
|
||||
uint32_t startcode;
|
||||
|
||||
align_get_bits(&s->gb);
|
||||
@@ -927,8 +928,6 @@ int ff_h263_decode_picture_header(MpegEncContext *s)
|
||||
/* H.263v1 */
|
||||
width = ff_h263_format[format][0];
|
||||
height = ff_h263_format[format][1];
|
||||
if (!width)
|
||||
return -1;
|
||||
|
||||
s->pict_type = AV_PICTURE_TYPE_I + get_bits1(&s->gb);
|
||||
|
||||
@@ -1084,10 +1083,9 @@ int ff_h263_decode_picture_header(MpegEncContext *s)
|
||||
s->qscale = get_bits(&s->gb, 5);
|
||||
}
|
||||
|
||||
if (s->width == 0 || s->height == 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "dimensions 0\n");
|
||||
return -1;
|
||||
}
|
||||
if ((ret = av_image_check_size(s->width, s->height, 0, s)) < 0)
|
||||
return ret;
|
||||
|
||||
s->mb_width = (s->width + 15) / 16;
|
||||
s->mb_height = (s->height + 15) / 16;
|
||||
s->mb_num = s->mb_width * s->mb_height;
|
||||
|
||||
@@ -1162,11 +1162,16 @@ static void mct_decode(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)
|
||||
int32_t *src[3], i0, i1, i2;
|
||||
float *srcf[3], i0f, i1f, i2f;
|
||||
|
||||
for (i = 1; i < 3; i++)
|
||||
for (i = 1; i < 3; i++) {
|
||||
if (tile->codsty[0].transform != tile->codsty[i].transform) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Transforms mismatch, MCT not supported\n");
|
||||
return;
|
||||
}
|
||||
if (memcmp(tile->comp[0].coord, tile->comp[i].coord, sizeof(tile->comp[0].coord))) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Coords mismatch, MCT not supported\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
if (tile->codsty[0].transform == FF_DWT97)
|
||||
|
||||
@@ -356,6 +356,15 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
|
||||
goto done;
|
||||
}
|
||||
|
||||
for (i = 0; i < image->numcomps; i++) {
|
||||
if (!image->comps[i].data) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Image component %d contains no data.\n", i);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
desc = av_pix_fmt_desc_get(avctx->pix_fmt);
|
||||
pixel_size = desc->comp[0].step_minus1 + 1;
|
||||
ispacked = libopenjpeg_ispacked(avctx->pix_fmt);
|
||||
|
||||
+78
-4
@@ -1285,6 +1285,82 @@ fail:
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
static void clear_context(MpegEncContext *s)
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
memset(&s->next_picture, 0, sizeof(s->next_picture));
|
||||
memset(&s->last_picture, 0, sizeof(s->last_picture));
|
||||
memset(&s->current_picture, 0, sizeof(s->current_picture));
|
||||
memset(&s->new_picture, 0, sizeof(s->new_picture));
|
||||
|
||||
memset(s->thread_context, 0, sizeof(s->thread_context));
|
||||
|
||||
s->me.map = NULL;
|
||||
s->me.score_map = NULL;
|
||||
s->dct_error_sum = NULL;
|
||||
s->block = NULL;
|
||||
s->blocks = NULL;
|
||||
memset(s->pblocks, 0, sizeof(s->pblocks));
|
||||
s->ac_val_base = NULL;
|
||||
s->ac_val[0] =
|
||||
s->ac_val[1] =
|
||||
s->ac_val[2] =NULL;
|
||||
s->edge_emu_buffer = NULL;
|
||||
s->me.scratchpad = NULL;
|
||||
s->me.temp =
|
||||
s->rd_scratchpad =
|
||||
s->b_scratchpad =
|
||||
s->obmc_scratchpad = NULL;
|
||||
|
||||
s->parse_context.buffer = NULL;
|
||||
s->parse_context.buffer_size = 0;
|
||||
s->bitstream_buffer = NULL;
|
||||
s->allocated_bitstream_buffer_size = 0;
|
||||
s->picture = NULL;
|
||||
s->mb_type = NULL;
|
||||
s->p_mv_table_base = NULL;
|
||||
s->b_forw_mv_table_base = NULL;
|
||||
s->b_back_mv_table_base = NULL;
|
||||
s->b_bidir_forw_mv_table_base = NULL;
|
||||
s->b_bidir_back_mv_table_base = NULL;
|
||||
s->b_direct_mv_table_base = NULL;
|
||||
s->p_mv_table = NULL;
|
||||
s->b_forw_mv_table = NULL;
|
||||
s->b_back_mv_table = NULL;
|
||||
s->b_bidir_forw_mv_table = NULL;
|
||||
s->b_bidir_back_mv_table = NULL;
|
||||
s->b_direct_mv_table = NULL;
|
||||
for (i = 0; i < 2; i++) {
|
||||
for (j = 0; j < 2; j++) {
|
||||
for (k = 0; k < 2; k++) {
|
||||
s->b_field_mv_table_base[i][j][k] = NULL;
|
||||
s->b_field_mv_table[i][j][k] = NULL;
|
||||
}
|
||||
s->b_field_select_table[i][j] = NULL;
|
||||
s->p_field_mv_table_base[i][j] = NULL;
|
||||
s->p_field_mv_table[i][j] = NULL;
|
||||
}
|
||||
s->p_field_select_table[i] = NULL;
|
||||
}
|
||||
|
||||
s->dc_val_base = NULL;
|
||||
s->coded_block_base = NULL;
|
||||
s->mbintra_table = NULL;
|
||||
s->cbp_table = NULL;
|
||||
s->pred_dir_table = NULL;
|
||||
|
||||
s->mbskip_table = NULL;
|
||||
|
||||
s->er.error_status_table = NULL;
|
||||
s->er.er_temp_buffer = NULL;
|
||||
s->mb_index2xy = NULL;
|
||||
s->lambda_table = NULL;
|
||||
|
||||
s->cplx_tab = NULL;
|
||||
s->bits_tab = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* init common structure for both encoder and decoder.
|
||||
* this assumes that some variables like width/height are already set
|
||||
@@ -1296,6 +1372,8 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
|
||||
s->avctx->active_thread_type & FF_THREAD_SLICE) ?
|
||||
s->avctx->thread_count : 1;
|
||||
|
||||
clear_context(s);
|
||||
|
||||
if (s->encoding && s->avctx->slices)
|
||||
nb_slices = s->avctx->slices;
|
||||
|
||||
@@ -1343,10 +1421,6 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
|
||||
if (!s->picture[i].f)
|
||||
goto fail;
|
||||
}
|
||||
memset(&s->next_picture, 0, sizeof(s->next_picture));
|
||||
memset(&s->last_picture, 0, sizeof(s->last_picture));
|
||||
memset(&s->current_picture, 0, sizeof(s->current_picture));
|
||||
memset(&s->new_picture, 0, sizeof(s->new_picture));
|
||||
s->next_picture.f = av_frame_alloc();
|
||||
if (!s->next_picture.f)
|
||||
goto fail;
|
||||
|
||||
@@ -164,6 +164,16 @@ typedef struct ChannelMap {
|
||||
|
||||
typedef struct OpusContext {
|
||||
OpusStreamContext *streams;
|
||||
|
||||
/* current output buffers for each streams */
|
||||
float **out;
|
||||
int *out_size;
|
||||
/* Buffers for synchronizing the streams when they have different
|
||||
* resampling delays */
|
||||
AVAudioFifo **sync_buffers;
|
||||
/* number of decoded samples for each stream */
|
||||
int *decoded_samples;
|
||||
|
||||
int nb_streams;
|
||||
int nb_stereo_streams;
|
||||
|
||||
|
||||
+85
-15
@@ -366,12 +366,17 @@ static int opus_decode_frame(OpusStreamContext *s, const uint8_t *data, int size
|
||||
|
||||
static int opus_decode_subpacket(OpusStreamContext *s,
|
||||
const uint8_t *buf, int buf_size,
|
||||
float **out, int out_size,
|
||||
int nb_samples)
|
||||
{
|
||||
int output_samples = 0;
|
||||
int flush_needed = 0;
|
||||
int i, j, ret;
|
||||
|
||||
s->out[0] = out[0];
|
||||
s->out[1] = out[1];
|
||||
s->out_size = out_size;
|
||||
|
||||
/* check if we need to flush the resampler */
|
||||
if (swr_is_initialized(s->swr)) {
|
||||
if (buf) {
|
||||
@@ -449,15 +454,17 @@ static int opus_decode_packet(AVCodecContext *avctx, void *data,
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
int coded_samples = 0;
|
||||
int decoded_samples = 0;
|
||||
int i, ret;
|
||||
int decoded_samples = INT_MAX;
|
||||
int delayed_samples = 0;
|
||||
int i, ret;
|
||||
|
||||
/* calculate the number of delayed samples */
|
||||
for (i = 0; i < c->nb_streams; i++) {
|
||||
OpusStreamContext *s = &c->streams[i];
|
||||
s->out[0] =
|
||||
s->out[1] = NULL;
|
||||
delayed_samples = FFMAX(delayed_samples, s->delayed_samples);
|
||||
delayed_samples = FFMAX(delayed_samples,
|
||||
s->delayed_samples + av_audio_fifo_size(c->sync_buffers[i]));
|
||||
}
|
||||
|
||||
/* decode the header of the first sub-packet to find out the sample count */
|
||||
@@ -488,14 +495,43 @@ static int opus_decode_packet(AVCodecContext *avctx, void *data,
|
||||
}
|
||||
frame->nb_samples = 0;
|
||||
|
||||
memset(c->out, 0, c->nb_streams * 2 * sizeof(*c->out));
|
||||
for (i = 0; i < avctx->channels; i++) {
|
||||
ChannelMap *map = &c->channel_maps[i];
|
||||
if (!map->copy)
|
||||
c->streams[map->stream_idx].out[map->channel_idx] = (float*)frame->extended_data[i];
|
||||
c->out[2 * map->stream_idx + map->channel_idx] = (float*)frame->extended_data[i];
|
||||
}
|
||||
|
||||
for (i = 0; i < c->nb_streams; i++)
|
||||
c->streams[i].out_size = frame->linesize[0];
|
||||
/* read the data from the sync buffers */
|
||||
for (i = 0; i < c->nb_streams; i++) {
|
||||
float **out = c->out + 2 * i;
|
||||
int sync_size = av_audio_fifo_size(c->sync_buffers[i]);
|
||||
|
||||
float sync_dummy[32];
|
||||
int out_dummy = (!out[0]) | ((!out[1]) << 1);
|
||||
|
||||
if (!out[0])
|
||||
out[0] = sync_dummy;
|
||||
if (!out[1])
|
||||
out[1] = sync_dummy;
|
||||
if (out_dummy && sync_size > FF_ARRAY_ELEMS(sync_dummy))
|
||||
return AVERROR_BUG;
|
||||
|
||||
ret = av_audio_fifo_read(c->sync_buffers[i], (void**)out, sync_size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (out_dummy & 1)
|
||||
out[0] = NULL;
|
||||
else
|
||||
out[0] += ret;
|
||||
if (out_dummy & 2)
|
||||
out[1] = NULL;
|
||||
else
|
||||
out[1] += ret;
|
||||
|
||||
c->out_size[i] = frame->linesize[0] - ret * sizeof(float);
|
||||
}
|
||||
|
||||
/* decode each sub-packet */
|
||||
for (i = 0; i < c->nb_streams; i++) {
|
||||
@@ -516,20 +552,31 @@ static int opus_decode_packet(AVCodecContext *avctx, void *data,
|
||||
s->silk_samplerate = get_silk_samplerate(s->packet.config);
|
||||
}
|
||||
|
||||
ret = opus_decode_subpacket(&c->streams[i], buf,
|
||||
s->packet.data_size, coded_samples);
|
||||
ret = opus_decode_subpacket(&c->streams[i], buf, s->packet.data_size,
|
||||
c->out + 2 * i, c->out_size[i], coded_samples);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (decoded_samples && ret != decoded_samples) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Different numbers of decoded samples "
|
||||
"in a multi-channel stream\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
decoded_samples = ret;
|
||||
c->decoded_samples[i] = ret;
|
||||
decoded_samples = FFMIN(decoded_samples, ret);
|
||||
|
||||
buf += s->packet.packet_size;
|
||||
buf_size -= s->packet.packet_size;
|
||||
}
|
||||
|
||||
/* buffer the extra samples */
|
||||
for (i = 0; i < c->nb_streams; i++) {
|
||||
int buffer_samples = c->decoded_samples[i] - decoded_samples;
|
||||
if (buffer_samples) {
|
||||
float *buf[2] = { c->out[2 * i + 0] ? c->out[2 * i + 0] : (float*)frame->extended_data[0],
|
||||
c->out[2 * i + 1] ? c->out[2 * i + 1] : (float*)frame->extended_data[0] };
|
||||
buf[0] += buffer_samples;
|
||||
buf[1] += buffer_samples;
|
||||
ret = av_audio_fifo_write(c->sync_buffers[i], (void**)buf, buffer_samples);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < avctx->channels; i++) {
|
||||
ChannelMap *map = &c->channel_maps[i];
|
||||
|
||||
@@ -570,6 +617,8 @@ static av_cold void opus_decode_flush(AVCodecContext *ctx)
|
||||
av_audio_fifo_drain(s->celt_delay, av_audio_fifo_size(s->celt_delay));
|
||||
swr_close(s->swr);
|
||||
|
||||
av_audio_fifo_drain(c->sync_buffers[i], av_audio_fifo_size(c->sync_buffers[i]));
|
||||
|
||||
ff_silk_flush(s->silk);
|
||||
ff_celt_flush(s->celt);
|
||||
}
|
||||
@@ -594,6 +643,16 @@ static av_cold int opus_decode_close(AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
av_freep(&c->streams);
|
||||
|
||||
if (c->sync_buffers) {
|
||||
for (i = 0; i < c->nb_streams; i++)
|
||||
av_audio_fifo_free(c->sync_buffers[i]);
|
||||
}
|
||||
av_freep(&c->sync_buffers);
|
||||
av_freep(&c->decoded_samples);
|
||||
av_freep(&c->out);
|
||||
av_freep(&c->out_size);
|
||||
|
||||
c->nb_streams = 0;
|
||||
|
||||
av_freep(&c->channel_maps);
|
||||
@@ -618,7 +677,11 @@ static av_cold int opus_decode_init(AVCodecContext *avctx)
|
||||
|
||||
/* allocate and init each independent decoder */
|
||||
c->streams = av_mallocz_array(c->nb_streams, sizeof(*c->streams));
|
||||
if (!c->streams) {
|
||||
c->out = av_mallocz_array(c->nb_streams, 2 * sizeof(*c->out));
|
||||
c->out_size = av_mallocz_array(c->nb_streams, sizeof(*c->out_size));
|
||||
c->sync_buffers = av_mallocz_array(c->nb_streams, sizeof(*c->sync_buffers));
|
||||
c->decoded_samples = av_mallocz_array(c->nb_streams, sizeof(*c->decoded_samples));
|
||||
if (!c->streams || !c->sync_buffers || !c->decoded_samples || !c->out || !c->out_size) {
|
||||
c->nb_streams = 0;
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
@@ -666,6 +729,13 @@ static av_cold int opus_decode_init(AVCodecContext *avctx)
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
c->sync_buffers[i] = av_audio_fifo_alloc(avctx->sample_fmt,
|
||||
s->output_channels, 32);
|
||||
if (!c->sync_buffers[i]) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -588,6 +588,11 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (s->state & PNG_IHDR) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Multiple IHDR\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
s->width = bytestream2_get_be32(&s->gb);
|
||||
s->height = bytestream2_get_be32(&s->gb);
|
||||
if (av_image_check_size(s->width, s->height, 0, avctx)) {
|
||||
|
||||
@@ -573,7 +573,7 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
|
||||
pthread_join(p->thread, NULL);
|
||||
p->thread_init=0;
|
||||
|
||||
if (codec->close)
|
||||
if (codec->close && p->avctx)
|
||||
codec->close(p->avctx);
|
||||
|
||||
avctx->codec = NULL;
|
||||
@@ -593,12 +593,13 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
|
||||
av_packet_unref(&p->avpkt);
|
||||
av_freep(&p->released_buffers);
|
||||
|
||||
if (i) {
|
||||
if (i && p->avctx) {
|
||||
av_freep(&p->avctx->priv_data);
|
||||
av_freep(&p->avctx->slice_offset);
|
||||
}
|
||||
|
||||
av_freep(&p->avctx->internal);
|
||||
if (p->avctx)
|
||||
av_freep(&p->avctx->internal);
|
||||
av_freep(&p->avctx);
|
||||
}
|
||||
|
||||
@@ -670,6 +671,7 @@ int ff_frame_thread_init(AVCodecContext *avctx)
|
||||
|
||||
copy->internal = av_malloc(sizeof(AVCodecInternal));
|
||||
if (!copy->internal) {
|
||||
copy->priv_data = NULL;
|
||||
err = AVERROR(ENOMEM);
|
||||
goto error;
|
||||
}
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ static int raw_encode(AVCodecContext *avctx, AVPacket *pkt,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if ((ret = ff_alloc_packet2(avctx, pkt, ret)) < 0)
|
||||
if ((ret = ff_alloc_packet(pkt, ret)) < 0)
|
||||
return ret;
|
||||
if ((ret = avpicture_layout((const AVPicture *)frame, avctx->pix_fmt, avctx->width,
|
||||
avctx->height, pkt->data, pkt->size)) < 0)
|
||||
|
||||
@@ -1534,7 +1534,14 @@ int ff_rv34_decode_init_thread_copy(AVCodecContext *avctx)
|
||||
|
||||
if (avctx->internal->is_copy) {
|
||||
r->tmp_b_block_base = NULL;
|
||||
r->cbp_chroma = NULL;
|
||||
r->cbp_luma = NULL;
|
||||
r->deblock_coefs = NULL;
|
||||
r->intra_types_hist = NULL;
|
||||
r->mb_type = NULL;
|
||||
|
||||
ff_mpv_idct_init(&r->s);
|
||||
|
||||
if ((err = ff_mpv_common_init(&r->s)) < 0)
|
||||
return err;
|
||||
if ((err = rv34_decoder_alloc(r)) < 0) {
|
||||
|
||||
@@ -457,6 +457,7 @@ static void destroy_buffers(SANMVideoContext *ctx)
|
||||
ctx->frm0_size =
|
||||
ctx->frm1_size =
|
||||
ctx->frm2_size = 0;
|
||||
init_sizes(ctx, 0, 0);
|
||||
}
|
||||
|
||||
static av_cold int init_buffers(SANMVideoContext *ctx)
|
||||
|
||||
@@ -137,6 +137,7 @@ typedef struct AACSBRContext {
|
||||
struct SpectralBandReplication {
|
||||
int sample_rate;
|
||||
int start;
|
||||
int id_aac;
|
||||
int reset;
|
||||
SpectrumParameters spectrum_params;
|
||||
int bs_amp_res_header;
|
||||
|
||||
@@ -900,6 +900,7 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
|
||||
av_log(avctx, AV_LOG_ERROR, "Only mono and stereo streams are supported by now\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
avctx->channels = s->channels;
|
||||
|
||||
s->lossless = get_bits1(&gb);
|
||||
if (!s->lossless)
|
||||
|
||||
@@ -514,6 +514,11 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx)
|
||||
SVQ1EncContext *const s = avctx->priv_data;
|
||||
int ret;
|
||||
|
||||
if (avctx->width >= 4096 || avctx->height >= 4096) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Dimensions too large, maximum is 4095x4095\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
ff_hpeldsp_init(&s->hdsp, avctx->flags);
|
||||
ff_me_cmp_init(&s->mecc, avctx);
|
||||
ff_mpegvideoencdsp_init(&s->m.mpvencdsp, avctx);
|
||||
|
||||
@@ -799,6 +799,12 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if (s->mcdparams[i].present) {
|
||||
s->mcdparams[i].index = get_bits(gb, 2);
|
||||
s->mcdparams[i].chan2 = get_bits(gb, 4);
|
||||
if (s->mcdparams[i].chan2 >= avctx->channels) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"invalid channel 2 (%d) for %d channel(s)\n",
|
||||
s->mcdparams[i].chan2, avctx->channels);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (s->mcdparams[i].index == 1) {
|
||||
if ((nbit == s->mcdparams[i].chan2) ||
|
||||
(ch_mask & 1 << s->mcdparams[i].chan2))
|
||||
|
||||
+3
-1
@@ -424,10 +424,12 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||
|
||||
*width = FFALIGN(*width, w_align);
|
||||
*height = FFALIGN(*height, h_align);
|
||||
if (s->codec_id == AV_CODEC_ID_H264 || s->lowres)
|
||||
if (s->codec_id == AV_CODEC_ID_H264 || s->lowres) {
|
||||
// some of the optimized chroma MC reads one line too much
|
||||
// which is also done in mpeg decoders with lowres > 0
|
||||
*height += 2;
|
||||
*width = FFMAX(*width, 32);
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
linesize_align[i] = STRIDE_ALIGN;
|
||||
|
||||
+12
-2
@@ -633,6 +633,11 @@ static int vp8_decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_si
|
||||
int width = s->avctx->width;
|
||||
int height = s->avctx->height;
|
||||
|
||||
if (buf_size < 3) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Insufficent data (%d) for header\n", buf_size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
s->keyframe = !(buf[0] & 1);
|
||||
s->profile = (buf[0]>>1) & 7;
|
||||
s->invisible = !(buf[0] & 0x10);
|
||||
@@ -750,8 +755,10 @@ static int vp8_decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_si
|
||||
static av_always_inline
|
||||
void clamp_mv(VP8Context *s, VP56mv *dst, const VP56mv *src)
|
||||
{
|
||||
dst->x = av_clip(src->x, s->mv_min.x, s->mv_max.x);
|
||||
dst->y = av_clip(src->y, s->mv_min.y, s->mv_max.y);
|
||||
dst->x = av_clip(src->x, av_clip(s->mv_min.x, INT16_MIN, INT16_MAX),
|
||||
av_clip(s->mv_max.x, INT16_MIN, INT16_MAX));
|
||||
dst->y = av_clip(src->y, av_clip(s->mv_min.y, INT16_MIN, INT16_MAX),
|
||||
av_clip(s->mv_max.y, INT16_MIN, INT16_MAX));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2673,6 +2680,9 @@ av_cold int ff_vp8_decode_free(AVCodecContext *avctx)
|
||||
VP8Context *s = avctx->priv_data;
|
||||
int i;
|
||||
|
||||
if (!s)
|
||||
return 0;
|
||||
|
||||
vp8_decode_flush_impl(avctx, 1);
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(s->frames); i++)
|
||||
av_frame_free(&s->frames[i].tf.f);
|
||||
|
||||
+7
-2
@@ -134,6 +134,11 @@ typedef struct VP8Frame {
|
||||
AVBufferRef *seg_map;
|
||||
} VP8Frame;
|
||||
|
||||
typedef struct VP8intmv {
|
||||
int x;
|
||||
int y;
|
||||
} VP8intmv;
|
||||
|
||||
#define MAX_THREADS 8
|
||||
typedef struct VP8Context {
|
||||
VP8ThreadData *thread_data;
|
||||
@@ -152,8 +157,8 @@ typedef struct VP8Context {
|
||||
uint8_t deblock_filter;
|
||||
uint8_t mbskip_enabled;
|
||||
uint8_t profile;
|
||||
VP56mv mv_min;
|
||||
VP56mv mv_max;
|
||||
VP8intmv mv_min;
|
||||
VP8intmv mv_max;
|
||||
|
||||
int8_t sign_bias[4]; ///< one state [0, 1] per ref frame type
|
||||
int ref_count[3];
|
||||
|
||||
+4
-3
@@ -409,7 +409,7 @@ static av_always_inline int inv_recenter_nonneg(int v, int m)
|
||||
// differential forward probability updates
|
||||
static int update_prob(VP56RangeCoder *c, int p)
|
||||
{
|
||||
static const int inv_map_table[254] = {
|
||||
static const int inv_map_table[255] = {
|
||||
7, 20, 33, 46, 59, 72, 85, 98, 111, 124, 137, 150, 163, 176,
|
||||
189, 202, 215, 228, 241, 254, 1, 2, 3, 4, 5, 6, 8, 9,
|
||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24,
|
||||
@@ -428,7 +428,7 @@ static int update_prob(VP56RangeCoder *c, int p)
|
||||
207, 208, 209, 210, 211, 212, 213, 214, 216, 217, 218, 219, 220, 221,
|
||||
222, 223, 224, 225, 226, 227, 229, 230, 231, 232, 233, 234, 235, 236,
|
||||
237, 238, 239, 240, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251,
|
||||
252, 253,
|
||||
252, 253, 253,
|
||||
};
|
||||
int d;
|
||||
|
||||
@@ -458,6 +458,7 @@ static int update_prob(VP56RangeCoder *c, int p)
|
||||
if (d >= 65)
|
||||
d = (d << 1) - 65 + vp8_rac_get(c);
|
||||
d += 64;
|
||||
av_assert2(d < FF_ARRAY_ELEMS(inv_map_table));
|
||||
}
|
||||
|
||||
return p <= 128 ? 1 + inv_recenter_nonneg(inv_map_table[d], p - 1) :
|
||||
@@ -3841,7 +3842,7 @@ static int vp9_decode_frame(AVCodecContext *ctx, void *frame,
|
||||
tile_row, s->tiling.log2_tile_rows, s->sb_rows);
|
||||
if (s->pass != 2) {
|
||||
for (tile_col = 0; tile_col < s->tiling.tile_cols; tile_col++) {
|
||||
unsigned tile_size;
|
||||
int64_t tile_size;
|
||||
|
||||
if (tile_col == s->tiling.tile_cols - 1 &&
|
||||
tile_row == s->tiling.tile_rows - 1) {
|
||||
|
||||
@@ -487,7 +487,7 @@ static int decode_cdlms(WmallDecodeCtx *s)
|
||||
if ((1 << cbits) < s->cdlms[c][i].scaling + 1)
|
||||
cbits++;
|
||||
|
||||
s->cdlms[c][i].bitsend = get_bits(&s->gb, cbits) + 2;
|
||||
s->cdlms[c][i].bitsend = (cbits ? get_bits(&s->gb, cbits) : 0) + 2;
|
||||
shift_l = 32 - s->cdlms[c][i].bitsend;
|
||||
shift_r = 32 - s->cdlms[c][i].scaling - 2;
|
||||
for (j = 0; j < s->cdlms[c][i].coefsend; j++)
|
||||
@@ -1029,6 +1029,7 @@ static int decode_frame(WmallDecodeCtx *s)
|
||||
if ((ret = ff_get_buffer(s->avctx, s->frame, 0)) < 0) {
|
||||
/* return an error if no frame could be decoded at all */
|
||||
s->packet_loss = 1;
|
||||
s->frame->nb_samples = 0;
|
||||
return ret;
|
||||
}
|
||||
for (i = 0; i < s->num_channels; i++) {
|
||||
|
||||
+16
-2
@@ -1982,7 +1982,14 @@ static int wmavoice_decode_packet(AVCodecContext *ctx, void *data,
|
||||
*got_frame_ptr) {
|
||||
cnt += s->spillover_nbits;
|
||||
s->skip_bits_next = cnt & 7;
|
||||
return cnt >> 3;
|
||||
res = cnt >> 3;
|
||||
if (res > avpkt->size) {
|
||||
av_log(ctx, AV_LOG_ERROR,
|
||||
"Trying to skip %d bytes in packet of size %d\n",
|
||||
res, avpkt->size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
return res;
|
||||
} else
|
||||
skip_bits_long (gb, s->spillover_nbits - cnt +
|
||||
get_bits_count(gb)); // resync
|
||||
@@ -2001,7 +2008,14 @@ static int wmavoice_decode_packet(AVCodecContext *ctx, void *data,
|
||||
} else if (*got_frame_ptr) {
|
||||
int cnt = get_bits_count(gb);
|
||||
s->skip_bits_next = cnt & 7;
|
||||
return cnt >> 3;
|
||||
res = cnt >> 3;
|
||||
if (res > avpkt->size) {
|
||||
av_log(ctx, AV_LOG_ERROR,
|
||||
"Trying to skip %d bytes in packet of size %d\n",
|
||||
res, avpkt->size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
return res;
|
||||
} else if ((s->sframe_cache_size = pos) > 0) {
|
||||
/* rewind bit reader to start of last (incomplete) superframe... */
|
||||
init_get_bits(gb, avpkt->data, size << 3);
|
||||
|
||||
@@ -135,8 +135,11 @@ WEIGHT_FUNC_HALF_MM 8, 8
|
||||
add off_regd, 1
|
||||
or off_regd, 1
|
||||
add r4, 1
|
||||
cmp r6d, 128
|
||||
je .nonnormal
|
||||
cmp r5, 128
|
||||
jne .normal
|
||||
.nonnormal
|
||||
sar r5, 1
|
||||
sar r6, 1
|
||||
sar off_regd, 1
|
||||
|
||||
+1
-1
@@ -339,7 +339,7 @@ static int lavfi_read_packet(AVFormatContext *avctx, AVPacket *pkt)
|
||||
continue;
|
||||
} else if (ret < 0)
|
||||
return ret;
|
||||
d = av_rescale_q(frame->pts, tb, AV_TIME_BASE_Q);
|
||||
d = av_rescale_q_rnd(frame->pts, tb, AV_TIME_BASE_Q, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
|
||||
av_dlog(avctx, "sink_idx:%d time:%f\n", i, d);
|
||||
av_frame_unref(frame);
|
||||
|
||||
|
||||
@@ -86,15 +86,24 @@ static int query_formats(AVFilterContext *ctx)
|
||||
AVFilterLink *inlink = ctx->inputs[0];
|
||||
AVFilterLink *outlink = ctx->outputs[0];
|
||||
|
||||
AVFilterFormats *in_formats = ff_all_formats(AVMEDIA_TYPE_AUDIO);
|
||||
AVFilterFormats *out_formats;
|
||||
AVFilterFormats *in_samplerates = ff_all_samplerates();
|
||||
AVFilterFormats *out_samplerates;
|
||||
AVFilterChannelLayouts *in_layouts = ff_all_channel_counts();
|
||||
AVFilterChannelLayouts *out_layouts;
|
||||
AVFilterFormats *in_formats, *out_formats;
|
||||
AVFilterFormats *in_samplerates, *out_samplerates;
|
||||
AVFilterChannelLayouts *in_layouts, *out_layouts;
|
||||
|
||||
|
||||
in_formats = ff_all_formats(AVMEDIA_TYPE_AUDIO);
|
||||
if (!in_formats)
|
||||
return AVERROR(ENOMEM);
|
||||
ff_formats_ref (in_formats, &inlink->out_formats);
|
||||
|
||||
in_samplerates = ff_all_samplerates();
|
||||
if (!in_samplerates)
|
||||
return AVERROR(ENOMEM);
|
||||
ff_formats_ref (in_samplerates, &inlink->out_samplerates);
|
||||
|
||||
in_layouts = ff_all_channel_counts();
|
||||
if (!in_layouts)
|
||||
return AVERROR(ENOMEM);
|
||||
ff_channel_layouts_ref(in_layouts, &inlink->out_channel_layouts);
|
||||
|
||||
if(out_rate > 0) {
|
||||
|
||||
@@ -152,7 +152,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr,
|
||||
int hsub = plane == 1 || plane == 2 ? trans->hsub : 0;
|
||||
int vsub = plane == 1 || plane == 2 ? trans->vsub : 0;
|
||||
int pixstep = trans->pixsteps[plane];
|
||||
int inh = in->height >> vsub;
|
||||
int inh = FF_CEIL_RSHIFT(in->height, vsub);
|
||||
int outw = FF_CEIL_RSHIFT(out->width, hsub);
|
||||
int outh = FF_CEIL_RSHIFT(out->height, vsub);
|
||||
int start = (outh * jobnr ) / nb_jobs;
|
||||
|
||||
@@ -27,8 +27,8 @@ SECTION .text
|
||||
%if lut_bits != 8
|
||||
sar %1q, 8-lut_bits
|
||||
%endif
|
||||
movsx %1d, word [%3q+%1q*2]
|
||||
add %1d, %2d
|
||||
movsx %1q, word [%3q+%1q*2]
|
||||
add %1q, %2q
|
||||
%endmacro
|
||||
|
||||
%macro LOAD 3 ; dstreg, x, bitdepth
|
||||
|
||||
@@ -783,6 +783,7 @@ int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
|
||||
int max_buffer_size = s->max_packet_size ?
|
||||
s->max_packet_size : IO_BUFFER_SIZE;
|
||||
int filled = s->buf_end - s->buffer;
|
||||
ptrdiff_t checksum_ptr_offset = s->checksum_ptr ? s->checksum_ptr - s->buffer : -1;
|
||||
|
||||
buf_size += s->buf_ptr - s->buffer + max_buffer_size;
|
||||
|
||||
@@ -800,6 +801,8 @@ int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
|
||||
s->buf_end = buffer + (s->buf_end - s->buffer);
|
||||
s->buffer = buffer;
|
||||
s->buffer_size = buf_size;
|
||||
if (checksum_ptr_offset >= 0)
|
||||
s->checksum_ptr = s->buffer + checksum_ptr_offset;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,9 @@ static int ffm_read_data(AVFormatContext *s,
|
||||
retry_read:
|
||||
if (pb->buffer_size != ffm->packet_size) {
|
||||
int64_t tell = avio_tell(pb);
|
||||
ffio_set_buf_size(pb, ffm->packet_size);
|
||||
int ret = ffio_set_buf_size(pb, ffm->packet_size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
avio_seek(pb, tell, SEEK_SET);
|
||||
}
|
||||
id = avio_rb16(pb); /* PACKET_ID */
|
||||
|
||||
+7
-3
@@ -449,7 +449,7 @@ static int parse_rps(GetBitContext *gb, unsigned int rps_idx,
|
||||
*
|
||||
* NumDeltaPocs[RefRpsIdx]: num_delta_pocs[rps_idx - 1]
|
||||
*/
|
||||
for (i = 0; i < num_delta_pocs[rps_idx - 1]; i++) {
|
||||
for (i = 0; i <= num_delta_pocs[rps_idx - 1]; i++) {
|
||||
uint8_t use_delta_flag = 0;
|
||||
uint8_t used_by_curr_pic_flag = get_bits1(gb);
|
||||
if (!used_by_curr_pic_flag)
|
||||
@@ -565,7 +565,10 @@ static int hvcc_parse_sps(GetBitContext *gb,
|
||||
}
|
||||
|
||||
if (get_bits1(gb)) { // long_term_ref_pics_present_flag
|
||||
for (i = 0; i < get_ue_golomb_long(gb); i++) { // num_long_term_ref_pics_sps
|
||||
unsigned num_long_term_ref_pics_sps = get_ue_golomb_long(gb);
|
||||
if (num_long_term_ref_pics_sps > 31U)
|
||||
return AVERROR_INVALIDDATA;
|
||||
for (i = 0; i < num_long_term_ref_pics_sps; i++) { // num_long_term_ref_pics_sps
|
||||
int len = FFMIN(log2_max_pic_order_cnt_lsb_minus4 + 4, 16);
|
||||
skip_bits (gb, len); // lt_ref_pic_poc_lsb_sps[i]
|
||||
skip_bits1(gb); // used_by_curr_pic_lt_sps_flag[i]
|
||||
@@ -616,11 +619,12 @@ static int hvcc_parse_pps(GetBitContext *gb,
|
||||
get_se_golomb_long(gb); // pps_cr_qp_offset
|
||||
|
||||
/*
|
||||
* pps_slice_chroma_qp_offsets_present_flag u(1)
|
||||
* weighted_pred_flag u(1)
|
||||
* weighted_bipred_flag u(1)
|
||||
* transquant_bypass_enabled_flag u(1)
|
||||
*/
|
||||
skip_bits(gb, 3);
|
||||
skip_bits(gb, 4);
|
||||
|
||||
tiles_enabled_flag = get_bits1(gb);
|
||||
entropy_coding_sync_enabled_flag = get_bits1(gb);
|
||||
|
||||
@@ -1602,6 +1602,14 @@ static int matroska_parse_tracks(AVFormatContext *s)
|
||||
if (!track->codec_id)
|
||||
continue;
|
||||
|
||||
if (track->audio.samplerate < 0 || track->audio.samplerate > INT_MAX ||
|
||||
isnan(track->audio.samplerate)) {
|
||||
av_log(matroska->ctx, AV_LOG_WARNING,
|
||||
"Invalid sample rate %f, defaulting to 8000 instead.\n",
|
||||
track->audio.samplerate);
|
||||
track->audio.samplerate = 8000;
|
||||
}
|
||||
|
||||
if (track->type == MATROSKA_TRACK_TYPE_VIDEO) {
|
||||
if (!track->default_duration && track->video.frame_rate > 0)
|
||||
track->default_duration = 1000000000 / track->video.frame_rate;
|
||||
@@ -1797,6 +1805,18 @@ static int matroska_parse_tracks(AVFormatContext *s)
|
||||
NULL, NULL, NULL, NULL);
|
||||
avio_write(&b, "TTA1", 4);
|
||||
avio_wl16(&b, 1);
|
||||
if (track->audio.channels > UINT16_MAX ||
|
||||
track->audio.bitdepth > UINT16_MAX) {
|
||||
av_log(matroska->ctx, AV_LOG_WARNING,
|
||||
"Too large audio channel number %"PRIu64
|
||||
" or bitdepth %"PRIu64". Skipping track.\n",
|
||||
track->audio.channels, track->audio.bitdepth);
|
||||
av_freep(&extradata);
|
||||
if (matroska->ctx->error_recognition & AV_EF_EXPLODE)
|
||||
return AVERROR_INVALIDDATA;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
avio_wl16(&b, track->audio.channels);
|
||||
avio_wl16(&b, track->audio.bitdepth);
|
||||
if (track->audio.out_samplerate < 0 || track->audio.out_samplerate > INT_MAX)
|
||||
|
||||
@@ -2987,6 +2987,7 @@ static int mov_read_cmov(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
goto free_and_return;
|
||||
if (ffio_init_context(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL, NULL) != 0)
|
||||
goto free_and_return;
|
||||
ctx.seekable = AVIO_SEEKABLE_NORMAL;
|
||||
atom.type = MKTAG('m','o','o','v');
|
||||
atom.size = moov_len;
|
||||
ret = mov_read_default(c, &ctx, atom);
|
||||
@@ -3516,6 +3517,9 @@ static int mov_read_close(AVFormatContext *s)
|
||||
AVStream *st = s->streams[i];
|
||||
MOVStreamContext *sc = st->priv_data;
|
||||
|
||||
if (!sc)
|
||||
continue;
|
||||
|
||||
av_freep(&sc->ctts_data);
|
||||
for (j = 0; j < sc->drefs_count; j++) {
|
||||
av_freep(&sc->drefs[j].path);
|
||||
|
||||
@@ -566,6 +566,11 @@ int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st,
|
||||
label_mask = 0;
|
||||
for (i = 0; i < num_descr; i++) {
|
||||
uint32_t label;
|
||||
if (pb->eof_reached) {
|
||||
av_log(s, AV_LOG_ERROR,
|
||||
"reached EOF while reading channel layout\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
label = avio_rb32(pb); // mChannelLabel
|
||||
avio_rb32(pb); // mChannelFlags
|
||||
avio_rl32(pb); // mCoordinates[0]
|
||||
|
||||
@@ -991,6 +991,8 @@ int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt,
|
||||
if (interleave) ret = av_interleaved_write_frame(dst, &local_pkt);
|
||||
else ret = av_write_frame(dst, &local_pkt);
|
||||
pkt->buf = local_pkt.buf;
|
||||
pkt->side_data = local_pkt.side_data;
|
||||
pkt->side_data_elems = local_pkt.side_data_elems;
|
||||
pkt->destruct = local_pkt.destruct;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1730,9 +1730,10 @@ static int mxf_write_header(AVFormatContext *s)
|
||||
return ret;
|
||||
sc->video_bit_rate = st->codec->bit_rate ? st->codec->bit_rate : st->codec->rc_max_rate;
|
||||
if (s->oformat == &ff_mxf_d10_muxer) {
|
||||
if (sc->video_bit_rate == 50000000) {
|
||||
if (mxf->time_base.den == 25) sc->index = 3;
|
||||
else sc->index = 5;
|
||||
if ((sc->video_bit_rate == 50000000) && (mxf->time_base.den == 25)) {
|
||||
sc->index = 3;
|
||||
} else if ((sc->video_bit_rate == 49999840 || sc->video_bit_rate == 50000000) && (mxf->time_base.den != 25)) {
|
||||
sc->index = 5;
|
||||
} else if (sc->video_bit_rate == 40000000) {
|
||||
if (mxf->time_base.den == 25) sc->index = 7;
|
||||
else sc->index = 9;
|
||||
|
||||
@@ -31,14 +31,19 @@ static int dirac_header(AVFormatContext *s, int idx)
|
||||
AVStream *st = s->streams[idx];
|
||||
dirac_source_params source;
|
||||
GetBitContext gb;
|
||||
int ret;
|
||||
|
||||
// already parsed the header
|
||||
if (st->codec->codec_id == AV_CODEC_ID_DIRAC)
|
||||
return 0;
|
||||
|
||||
init_get_bits(&gb, os->buf + os->pstart + 13, (os->psize - 13) * 8);
|
||||
if (avpriv_dirac_parse_sequence_header(st->codec, &gb, &source) < 0)
|
||||
return -1;
|
||||
ret = init_get_bits8(&gb, os->buf + os->pstart + 13, (os->psize - 13));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = avpriv_dirac_parse_sequence_header(st->codec, &gb, &source);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
|
||||
st->codec->codec_id = AV_CODEC_ID_DIRAC;
|
||||
|
||||
@@ -186,10 +186,10 @@ static int mjpeg_probe(AVProbeData *p)
|
||||
}
|
||||
|
||||
if (nb_invalid*4 + 1 < nb_frames) {
|
||||
static const char ct_jpeg[] = "\r\nContent-Type: image/jpeg\r\n\r\n";
|
||||
static const char ct_jpeg[] = "\r\nContent-Type: image/jpeg\r\n";
|
||||
int i;
|
||||
|
||||
for (i=0; i<FFMIN(p->buf_size - sizeof(ct_jpeg), 100); i++)
|
||||
for (i=0; i<FFMIN(p->buf_size - (int)sizeof(ct_jpeg), 100); i++)
|
||||
if (!memcmp(p->buf + i, ct_jpeg, sizeof(ct_jpeg) - 1))
|
||||
return AVPROBE_SCORE_EXTENSION;
|
||||
|
||||
|
||||
@@ -566,10 +566,6 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
|
||||
const uint8_t *mb_info =
|
||||
av_packet_get_side_data(pkt, AV_PKT_DATA_H263_MB_INFO,
|
||||
&mb_info_size);
|
||||
if (!mb_info) {
|
||||
av_log(s1, AV_LOG_ERROR, "failed to allocate side data\n");
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
ff_rtp_send_h263_rfc2190(s1, pkt->data, size, mb_info, mb_info_size);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -390,10 +390,8 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
}
|
||||
if (st->codec->pix_fmt != AV_PIX_FMT_NONE && st->codec->pix_fmt != pix_fmt) {
|
||||
av_log(s, AV_LOG_ERROR, "pixel format change unsupported\n");
|
||||
res = AVERROR_PATCHWELCOME;
|
||||
goto bitmap_end;
|
||||
}
|
||||
st->codec->pix_fmt = pix_fmt;
|
||||
}else
|
||||
st->codec->pix_fmt = pix_fmt;
|
||||
|
||||
if (linesize * height > pkt->size) {
|
||||
res = AVERROR_INVALIDDATA;
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@ int ff_get_cpu_flags_arm(void)
|
||||
trickle down. */
|
||||
if (flags & (AV_CPU_FLAG_VFPV3 | AV_CPU_FLAG_NEON))
|
||||
flags |= AV_CPU_FLAG_ARMV6T2;
|
||||
else
|
||||
else if (flags & (AV_CPU_FLAG_ARMV6T2 | AV_CPU_FLAG_ARMV6))
|
||||
/* Some functions use the 'setend' instruction which is deprecated on ARMv8
|
||||
* and serializing on some ARMv7 cores. This ensures such functions
|
||||
* are only enabled on ARMv6. */
|
||||
|
||||
@@ -138,8 +138,8 @@ static uint64_t get_channel_layout_single(const char *name, int name_len)
|
||||
"switch to the syntax '%.*sc' otherwise it will be interpreted as a "
|
||||
"channel layout number in a later version\n",
|
||||
name_len, name, name_len, name);
|
||||
return layout;
|
||||
}
|
||||
return layout;
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
|
||||
+2
-1
@@ -129,7 +129,8 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size,
|
||||
do {
|
||||
int len = FFMIN(f->end - wptr, size);
|
||||
if (func) {
|
||||
if (func(src, wptr, len) <= 0)
|
||||
len = func(src, wptr, len);
|
||||
if (len <= 0)
|
||||
break;
|
||||
} else {
|
||||
memcpy(wptr, src, len);
|
||||
|
||||
@@ -76,6 +76,7 @@ try to unroll inner for(x=0 ... loop to avoid these damn if(x ... checks
|
||||
#include "config.h"
|
||||
#include "libavutil/avutil.h"
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -1009,7 +1010,7 @@ void pp_postprocess(const uint8_t * src[3], const int srcStride[3],
|
||||
int i;
|
||||
const int count= FFMAX(mbHeight * QPStride, mbWidth);
|
||||
for(i=0; i<(count>>2); i++){
|
||||
((uint32_t*)c->nonBQPTable)[i] = ((const uint32_t*)QP_store)[i] & 0x3F3F3F3F;
|
||||
AV_WN32(c->nonBQPTable + (i<<2), AV_RN32(QP_store + (i<<2)) & 0x3F3F3F3F);
|
||||
}
|
||||
for(i<<=2; i<count; i++){
|
||||
c->nonBQPTable[i] = QP_store[i] & 0x3F;
|
||||
|
||||
@@ -23,12 +23,15 @@
|
||||
|
||||
#include "noise_shaping_data.c"
|
||||
|
||||
void swri_get_dither(SwrContext *s, void *dst, int len, unsigned seed, enum AVSampleFormat noise_fmt) {
|
||||
int swri_get_dither(SwrContext *s, void *dst, int len, unsigned seed, enum AVSampleFormat noise_fmt) {
|
||||
double scale = s->dither.noise_scale;
|
||||
#define TMP_EXTRA 2
|
||||
double *tmp = av_malloc_array(len + TMP_EXTRA, sizeof(double));
|
||||
int i;
|
||||
|
||||
if (!tmp)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
for(i=0; i<len + TMP_EXTRA; i++){
|
||||
double v;
|
||||
seed = seed* 1664525 + 1013904223;
|
||||
@@ -70,6 +73,7 @@ void swri_get_dither(SwrContext *s, void *dst, int len, unsigned seed, enum AVSa
|
||||
}
|
||||
|
||||
av_free(tmp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int swri_dither_init(SwrContext *s, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt)
|
||||
|
||||
@@ -49,8 +49,8 @@ static const AVOption options[]={
|
||||
{"in_sample_fmt" , "set input sample format" , OFFSET( in_sample_fmt ), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1 , INT_MAX, PARAM},
|
||||
{"osf" , "set output sample format" , OFFSET(out_sample_fmt ), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1 , INT_MAX, PARAM},
|
||||
{"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},
|
||||
{"tsf" , "set internal sample format" , OFFSET(user_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(user_int_sample_fmt), AV_OPT_TYPE_SAMPLE_FMT , {.i64=AV_SAMPLE_FMT_NONE}, -1 , INT_MAX, PARAM},
|
||||
{"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"},
|
||||
|
||||
+28
-11
@@ -173,6 +173,8 @@ av_cold int swr_init(struct SwrContext *s){
|
||||
s-> in_ch_layout = s-> user_in_ch_layout;
|
||||
s->out_ch_layout = s->user_out_ch_layout;
|
||||
|
||||
s->int_sample_fmt= s->user_int_sample_fmt;
|
||||
|
||||
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;
|
||||
@@ -267,7 +269,8 @@ av_cold int swr_init(struct SwrContext *s){
|
||||
&& s->int_sample_fmt != AV_SAMPLE_FMT_DBLP
|
||||
&& s->resample){
|
||||
av_log(s, AV_LOG_ERROR, "Resampling only supported with internal s16/s32/flt/dbl\n");
|
||||
return -1;
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
#define RSC 1 //FIXME finetune
|
||||
@@ -281,24 +284,28 @@ av_cold int swr_init(struct SwrContext *s){
|
||||
if(!s-> in.ch_count){
|
||||
av_assert0(!s->in_ch_layout);
|
||||
av_log(s, AV_LOG_ERROR, "Input channel count and layout are unset\n");
|
||||
return -1;
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
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);
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
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);
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if ((!s->out_ch_layout || !s->in_ch_layout) && s->used_ch_count != s->out.ch_count && !s->rematrix_custom) {
|
||||
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;
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
av_assert0(s->used_ch_count);
|
||||
@@ -320,8 +327,10 @@ av_assert0(s->out.ch_count);
|
||||
s->out_convert= swri_audio_convert_alloc(s->out_sample_fmt,
|
||||
s->int_sample_fmt, s->out.ch_count, NULL, 0);
|
||||
|
||||
if (!s->in_convert || !s->out_convert)
|
||||
return AVERROR(ENOMEM);
|
||||
if (!s->in_convert || !s->out_convert) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
s->postin= s->in;
|
||||
s->preout= s->out;
|
||||
@@ -348,12 +357,19 @@ av_assert0(s->out.ch_count);
|
||||
}
|
||||
|
||||
if ((ret = swri_dither_init(s, s->out_sample_fmt, s->int_sample_fmt)) < 0)
|
||||
return ret;
|
||||
goto fail;
|
||||
|
||||
if(s->rematrix || s->dither.method)
|
||||
return swri_rematrix_init(s);
|
||||
if(s->rematrix || s->dither.method) {
|
||||
ret = swri_rematrix_init(s);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
return 0;
|
||||
fail:
|
||||
swr_close(s);
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
int swri_realloc_audio(AudioData *a, int count){
|
||||
@@ -622,7 +638,8 @@ static int swr_convert_internal(struct SwrContext *s, AudioData *out, int out_co
|
||||
return ret;
|
||||
if(ret)
|
||||
for(ch=0; ch<s->dither.noise.ch_count; ch++)
|
||||
swri_get_dither(s, s->dither.noise.ch[ch], s->dither.noise.count, 12345678913579<<ch, s->dither.noise.fmt);
|
||||
if((ret=swri_get_dither(s, s->dither.noise.ch[ch], s->dither.noise.count, 12345678913579<<ch, s->dither.noise.fmt))<0)
|
||||
return ret;
|
||||
av_assert0(s->dither.noise.ch_count == preout->ch_count);
|
||||
|
||||
if(s->dither.noise_pos + out_count > s->dither.noise.count)
|
||||
|
||||
@@ -95,6 +95,7 @@ struct SwrContext {
|
||||
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
|
||||
enum AVSampleFormat user_int_sample_fmt; ///< User set internal sample format
|
||||
|
||||
struct DitherContext dither;
|
||||
|
||||
@@ -191,7 +192,7 @@ void swri_rematrix_free(SwrContext *s);
|
||||
int swri_rematrix(SwrContext *s, AudioData *out, AudioData *in, int len, int mustcopy);
|
||||
void swri_rematrix_init_x86(struct SwrContext *s);
|
||||
|
||||
void swri_get_dither(SwrContext *s, void *dst, int len, unsigned seed, enum AVSampleFormat noise_fmt);
|
||||
int swri_get_dither(SwrContext *s, void *dst, int len, unsigned seed, enum AVSampleFormat noise_fmt);
|
||||
int swri_dither_init(SwrContext *s, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt);
|
||||
|
||||
void swri_audio_convert_init_aarch64(struct AudioConvert *ac,
|
||||
|
||||
@@ -51,6 +51,7 @@ void (*rgb16to15)(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
void (*rgb15to16)(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
void (*rgb15to32)(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
|
||||
void (*shuffle_bytes_0321)(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
void (*shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
|
||||
void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc,
|
||||
@@ -333,7 +334,6 @@ void shuffle_bytes_ ## a ## b ## c ## d(const uint8_t *src, \
|
||||
} \
|
||||
}
|
||||
|
||||
DEFINE_SHUFFLE_BYTES(0, 3, 2, 1)
|
||||
DEFINE_SHUFFLE_BYTES(1, 2, 3, 0)
|
||||
DEFINE_SHUFFLE_BYTES(3, 0, 1, 2)
|
||||
DEFINE_SHUFFLE_BYTES(3, 2, 1, 0)
|
||||
|
||||
@@ -50,6 +50,7 @@ extern void (*rgb24to15)(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
extern void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
extern void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
|
||||
extern void (*shuffle_bytes_0321)(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
extern void (*shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
|
||||
void rgb64tobgr48_nobswap(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
@@ -71,7 +72,6 @@ void rgb15tobgr15(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
void rgb12to15(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
|
||||
void shuffle_bytes_0321(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
void shuffle_bytes_1230(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
void shuffle_bytes_3012(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
void shuffle_bytes_3210(const uint8_t *src, uint8_t *dst, int src_size);
|
||||
|
||||
@@ -322,12 +322,26 @@ static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst,
|
||||
uint8_t *d = dst - idx;
|
||||
|
||||
for (; idx < 15; idx += 4) {
|
||||
register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
|
||||
register unsigned v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
|
||||
v &= 0xff00ff;
|
||||
*(uint32_t *)&d[idx] = (v >> 16) + g + (v << 16);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void shuffle_bytes_0321_c(const uint8_t *src, uint8_t *dst,
|
||||
int src_size)
|
||||
{
|
||||
int idx = 15 - src_size;
|
||||
const uint8_t *s = src - idx;
|
||||
uint8_t *d = dst - idx;
|
||||
|
||||
for (; idx < 15; idx += 4) {
|
||||
register unsigned v = *(const uint32_t *)&s[idx], g = v & 0x00ff00ff;
|
||||
v &= 0xff00ff00;
|
||||
*(uint32_t *)&d[idx] = (v >> 16) + g + (v << 16);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void rgb24tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size)
|
||||
{
|
||||
unsigned i;
|
||||
@@ -929,7 +943,13 @@ static av_cold void rgb2rgb_init_c(void)
|
||||
rgb24to15 = rgb24to15_c;
|
||||
rgb24to16 = rgb24to16_c;
|
||||
rgb24tobgr24 = rgb24tobgr24_c;
|
||||
#if HAVE_BIGENDIAN
|
||||
shuffle_bytes_0321 = shuffle_bytes_2103_c;
|
||||
shuffle_bytes_2103 = shuffle_bytes_0321_c;
|
||||
#else
|
||||
shuffle_bytes_0321 = shuffle_bytes_0321_c;
|
||||
shuffle_bytes_2103 = shuffle_bytes_2103_c;
|
||||
#endif
|
||||
rgb32tobgr16 = rgb32tobgr16_c;
|
||||
rgb32tobgr15 = rgb32tobgr15_c;
|
||||
yv12toyuy2 = yv12toyuy2_c;
|
||||
|
||||
@@ -1242,6 +1242,11 @@ static rgbConvFn findRgbConvFn(SwsContext *c)
|
||||
if ((dstFormat == AV_PIX_FMT_RGB32_1 || dstFormat == AV_PIX_FMT_BGR32_1) && !isRGBA32(srcFormat) && ALT32_CORR<0)
|
||||
return NULL;
|
||||
|
||||
// Maintain symmetry between endianness
|
||||
if (c->flags & SWS_BITEXACT)
|
||||
if ((dstFormat == AV_PIX_FMT_RGB32 || dstFormat == AV_PIX_FMT_BGR32 ) && !isRGBA32(srcFormat) && ALT32_CORR>0)
|
||||
return NULL;
|
||||
|
||||
return conv;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -1421,9 +1421,9 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
|
||||
|
||||
/* Allocate pixbufs (we use dynamic allocation because otherwise we would
|
||||
* need to allocate several megabytes to handle all possible cases) */
|
||||
FF_ALLOC_OR_GOTO(c, c->lumPixBuf, c->vLumBufSize * 3 * sizeof(int16_t *), fail);
|
||||
FF_ALLOC_OR_GOTO(c, c->chrUPixBuf, c->vChrBufSize * 3 * sizeof(int16_t *), fail);
|
||||
FF_ALLOC_OR_GOTO(c, c->chrVPixBuf, c->vChrBufSize * 3 * sizeof(int16_t *), fail);
|
||||
FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf, c->vLumBufSize * 3 * sizeof(int16_t *), fail);
|
||||
FF_ALLOCZ_OR_GOTO(c, c->chrUPixBuf, c->vChrBufSize * 3 * sizeof(int16_t *), fail);
|
||||
FF_ALLOCZ_OR_GOTO(c, c->chrVPixBuf, c->vChrBufSize * 3 * sizeof(int16_t *), fail);
|
||||
if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat) && isALPHA(c->dstFormat))
|
||||
FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf, c->vLumBufSize * 3 * sizeof(int16_t *), fail);
|
||||
/* Note we need at least one pixel more at the end because of the MMX code
|
||||
|
||||
@@ -1090,7 +1090,7 @@ static inline void RENAME(shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst,
|
||||
: "r" (s), "r" (d), "m" (mask32b), "m" (mask32r), "m" (mmx_one)
|
||||
: "memory");
|
||||
for (; idx<15; idx+=4) {
|
||||
register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
|
||||
register unsigned v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
|
||||
v &= 0xff00ff;
|
||||
*(uint32_t *)&d[idx] = (v>>16) + g + (v<<16);
|
||||
}
|
||||
@@ -1905,7 +1905,7 @@ static void RENAME(interleaveBytes)(const uint8_t *src1, const uint8_t *src2, ui
|
||||
"cmp %3, %%"REG_a" \n\t"
|
||||
" jb 1b \n\t"
|
||||
::"r"(dest), "r"(src1), "r"(src2), "r" ((x86_reg)width-15)
|
||||
: "memory", "%"REG_a""
|
||||
: "memory", XMM_CLOBBERS("xmm0", "xmm1", "xmm2",) "%"REG_a
|
||||
);
|
||||
#else
|
||||
__asm__(
|
||||
|
||||
@@ -103,7 +103,7 @@ fate-acodec-dca: tests/data/asynth-44100-2.wav
|
||||
fate-acodec-dca: SRC = tests/data/asynth-44100-2.wav
|
||||
fate-acodec-dca: CMD = md5 -i $(TARGET_PATH)/$(SRC) -c:a dca -strict -2 -f dts -flags +bitexact
|
||||
fate-acodec-dca: CMP = oneline
|
||||
fate-acodec-dca: REF = fe28cef432ed88de4ee01b87537fd2bd
|
||||
fate-acodec-dca: REF = c54ca9a13711755ef90fa143a9b38386
|
||||
|
||||
FATE_ACODEC-$(call ENCDEC, DCA, WAV) += fate-acodec-dca2
|
||||
fate-acodec-dca2: CMD = enc_dec_pcm dts wav s16le $(SRC) -c:a dca -strict -2 -flags +bitexact
|
||||
|
||||
Reference in New Issue
Block a user