mirror of
https://github.com/jellyfin/jellyfin-ffmpeg.git
synced 2024-11-27 08:00:32 +00:00
Imported Upstream version 2.8.6
This commit is contained in:
parent
00c203d724
commit
788abe4bd5
45
Changelog
45
Changelog
@ -2,6 +2,51 @@ Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
|
||||
version 2.8.6
|
||||
- avcodec/jpeg2000dec: More completely check cdef
|
||||
- avutil/opt: check for and handle errors in av_opt_set_dict2()
|
||||
- avcodec/flacenc: fix calculation of bits required in case of custom sample rate
|
||||
- avformat: Document urls a bit
|
||||
- avformat/libquvi: Set default demuxer and protocol limitations
|
||||
- avformat/concat: Check protocol prefix
|
||||
- doc/demuxers: Document enable_drefs and use_absolute_path
|
||||
- avcodec/mjpegdec: Check for end for both bytes in unescaping
|
||||
- avcodec/mpegvideo_enc: Check for integer overflow in ff_mpv_reallocate_putbitbuffer()
|
||||
- avformat/avformat: Replace some references to filenames by urls
|
||||
- avcodec/wmaenc: Check ff_wma_init() for failure
|
||||
- avcodec/mpeg12enc: Move high resolution thread check to before initializing threads
|
||||
- avformat/img2dec: Use AVOpenCallback
|
||||
- avformat/avio: Limit url option parsing to the documented cases
|
||||
- avformat/img2dec: do not interpret the filename by default if a IO context has been opened
|
||||
- avcodec/ass_split: Fix null pointer dereference in ff_ass_style_get()
|
||||
- mov: Add an option to toggle dref opening
|
||||
- avcodec/gif: Fix lzw buffer size
|
||||
- avcodec/put_bits: Assert buf_ptr in flush_put_bits()
|
||||
- avcodec/tiff: Check subsample & rps values more completely
|
||||
- swscale/swscale: Add some sanity checks for srcSlice* parameters
|
||||
- swscale/x86/rgb2rgb_template: Fix planar2x() for short width
|
||||
- swscale/swscale_unscaled: Fix odd height inputs for bayer_to_yv12_wrapper()
|
||||
- swscale/swscale_unscaled: Fix odd height inputs for bayer_to_rgb24_wrapper()
|
||||
- avcodec/aacenc: Check both channels for finiteness
|
||||
- asfdec_o: check for too small size in asf_read_unknown
|
||||
- asfdec_o: break if EOF is reached after asf_read_packet_header
|
||||
- asfdec_o: make sure packet_size is non-zero before seeking
|
||||
- asfdec_o: prevent overflow causing seekback
|
||||
- asfdec_o: check avio_skip in asf_read_simple_index
|
||||
- asfdec_o: reject size > INT64_MAX in asf_read_unknown
|
||||
- asfdec_o: only set asf_pkt->data_size after sanity checks
|
||||
- Merge commit '8375dc1dd101d51baa430f34c0bcadfa37873896'
|
||||
- dca: fix misaligned access in avpriv_dca_convert_bitstream
|
||||
- brstm: fix missing closing brace
|
||||
- brstm: also allocate b->table in read_packet
|
||||
- brstm: make sure an ADPC chunk was read for adpcm_thp
|
||||
- vorbisdec: reject rangebits 0 with non-0 partitions
|
||||
- vorbisdec: reject channel mapping with less than two channels
|
||||
- ffmdec: reset packet_end in case of failure
|
||||
- avformat/ipmovie: put video decoding_map_size into packet and use it in decoder
|
||||
- avformat/brstm: fix overflow
|
||||
|
||||
|
||||
version 2.8.5
|
||||
- avformat/hls: Even stricter URL checks
|
||||
- avformat/hls: More strict url checks
|
||||
|
@ -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.8.5
|
||||
PROJECT_NUMBER = 2.8.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
|
||||
|
@ -416,6 +416,23 @@ ffmpeg -framerate 10 -pattern_type glob -i "*.png" out.mkv
|
||||
@end example
|
||||
@end itemize
|
||||
|
||||
@section mov/mp4/3gp/Quicktme
|
||||
|
||||
Quicktime / MP4 demuxer.
|
||||
|
||||
This demuxer accepts the following options:
|
||||
@table @option
|
||||
@item enable_drefs
|
||||
Enable loading of external tracks, disabled by default.
|
||||
Enabling this can theoretically leak information in some use cases.
|
||||
|
||||
@item use_absolute_path
|
||||
Allows loading of external tracks via absolute paths, disabled by default.
|
||||
Enabling this poses a security risk. It should only be enabled if the source
|
||||
is known to be non malicious.
|
||||
|
||||
@end table
|
||||
|
||||
@section mpegts
|
||||
|
||||
MPEG-2 transport stream demuxer.
|
||||
|
@ -572,8 +572,16 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
}
|
||||
|
||||
apply_window_and_mdct(s, &cpe->ch[ch], overlap);
|
||||
if (isnan(cpe->ch->coeffs[0])) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Input contains NaN\n");
|
||||
|
||||
if (isnan(cpe->ch[ch].coeffs[ 0]) || isinf(cpe->ch[ch].coeffs[ 0]) ||
|
||||
isnan(cpe->ch[ch].coeffs[ 128]) || isinf(cpe->ch[ch].coeffs[ 128]) ||
|
||||
isnan(cpe->ch[ch].coeffs[2*128]) || isinf(cpe->ch[ch].coeffs[2*128]) ||
|
||||
isnan(cpe->ch[ch].coeffs[3*128]) || isinf(cpe->ch[ch].coeffs[3*128]) ||
|
||||
isnan(cpe->ch[ch].coeffs[4*128]) || isinf(cpe->ch[ch].coeffs[4*128]) ||
|
||||
isnan(cpe->ch[ch].coeffs[5*128]) || isinf(cpe->ch[ch].coeffs[5*128]) ||
|
||||
isnan(cpe->ch[ch].coeffs[6*128]) || isinf(cpe->ch[ch].coeffs[6*128]) ||
|
||||
isnan(cpe->ch[ch].coeffs[7*128]) || isinf(cpe->ch[ch].coeffs[7*128])) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Input contains NaN/+-Inf\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
avoid_clipping(s, &cpe->ch[ch]);
|
||||
|
@ -525,7 +525,7 @@ ASSStyle *ff_ass_style_get(ASSSplitContext *ctx, const char *style)
|
||||
if (!style || !*style)
|
||||
style = "Default";
|
||||
for (i=0; i<ass->styles_count; i++)
|
||||
if (!strcmp(ass->styles[i].name, style))
|
||||
if (ass->styles[i].name && !strcmp(ass->styles[i].name, style))
|
||||
return ass->styles + i;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -41,8 +41,6 @@ int avpriv_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst,
|
||||
{
|
||||
uint32_t mrk;
|
||||
int i, tmp;
|
||||
const uint16_t *ssrc = (const uint16_t *) src;
|
||||
uint16_t *sdst = (uint16_t *) dst;
|
||||
PutBitContext pb;
|
||||
|
||||
if ((unsigned) src_size > (unsigned) max_size)
|
||||
@ -54,8 +52,11 @@ int avpriv_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst,
|
||||
memcpy(dst, src, src_size);
|
||||
return src_size;
|
||||
case DCA_SYNCWORD_CORE_LE:
|
||||
for (i = 0; i < (src_size + 1) >> 1; i++)
|
||||
*sdst++ = av_bswap16(*ssrc++);
|
||||
for (i = 0; i < (src_size + 1) >> 1; i++) {
|
||||
AV_WB16(dst, AV_RL16(src));
|
||||
src += 2;
|
||||
dst += 2;
|
||||
}
|
||||
return src_size;
|
||||
case DCA_SYNCWORD_CORE_14B_BE:
|
||||
case DCA_SYNCWORD_CORE_14B_LE:
|
||||
|
@ -1021,7 +1021,7 @@ static int count_frame_header(FlacEncodeContext *s)
|
||||
count += 16;
|
||||
|
||||
/* explicit sample rate */
|
||||
count += ((s->sr_code[0] == 12) + (s->sr_code[0] > 12)) * 8;
|
||||
count += ((s->sr_code[0] == 12) + (s->sr_code[0] > 12) * 2) * 8;
|
||||
|
||||
/* frame header CRC-8 */
|
||||
count += 8;
|
||||
|
@ -43,6 +43,7 @@ typedef struct GIFContext {
|
||||
const AVClass *class;
|
||||
LZWState *lzw;
|
||||
uint8_t *buf;
|
||||
int buf_size;
|
||||
AVFrame *last_frame;
|
||||
int flags;
|
||||
uint32_t palette[AVPALETTE_COUNT]; ///< local reference palette for !pal8
|
||||
@ -174,7 +175,7 @@ static int gif_image_write_image(AVCodecContext *avctx,
|
||||
|
||||
bytestream_put_byte(bytestream, 0x08);
|
||||
|
||||
ff_lzw_encode_init(s->lzw, s->buf, 2 * width * height,
|
||||
ff_lzw_encode_init(s->lzw, s->buf, s->buf_size,
|
||||
12, FF_LZW_GIF, put_bits);
|
||||
|
||||
ptr = buf + y_start*linesize + x_start;
|
||||
@ -231,7 +232,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
s->transparent_index = -1;
|
||||
|
||||
s->lzw = av_mallocz(ff_lzw_encode_state_size);
|
||||
s->buf = av_malloc(avctx->width*avctx->height*2);
|
||||
s->buf_size = avctx->width*avctx->height*2 + 1000;
|
||||
s->buf = av_malloc(s->buf_size);
|
||||
s->tmpl = av_malloc(avctx->width);
|
||||
if (!s->tmpl || !s->buf || !s->lzw)
|
||||
return AVERROR(ENOMEM);
|
||||
@ -321,6 +323,7 @@ static int gif_encode_close(AVCodecContext *avctx)
|
||||
|
||||
av_freep(&s->lzw);
|
||||
av_freep(&s->buf);
|
||||
s->buf_size = 0;
|
||||
av_frame_free(&s->last_frame);
|
||||
av_freep(&s->tmpl);
|
||||
return 0;
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "avcodec.h"
|
||||
#include "bytestream.h"
|
||||
#include "hpeldsp.h"
|
||||
@ -949,7 +950,7 @@ static void ipvideo_decode_opcodes(IpvideoContext *s, AVFrame *frame)
|
||||
}
|
||||
}
|
||||
if (bytestream2_get_bytes_left(&s->stream_ptr) > 1) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
av_log(s->avctx, AV_LOG_DEBUG,
|
||||
"decode finished with %d bytes left over\n",
|
||||
bytestream2_get_bytes_left(&s->stream_ptr));
|
||||
}
|
||||
@ -987,12 +988,15 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
|
||||
AVFrame *frame = data;
|
||||
int ret;
|
||||
|
||||
if (buf_size < 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* decoding map contains 4 bits of information per 8x8 block */
|
||||
s->decoding_map_size = avctx->width * avctx->height / (8 * 8 * 2);
|
||||
s->decoding_map_size = AV_RL16(avpkt->data);
|
||||
|
||||
/* compressed buffer needs to be large enough to at least hold an entire
|
||||
* decoding map */
|
||||
if (buf_size < s->decoding_map_size)
|
||||
if (buf_size < s->decoding_map_size + 2)
|
||||
return buf_size;
|
||||
|
||||
if (av_packet_get_side_data(avpkt, AV_PKT_DATA_PARAM_CHANGE, NULL)) {
|
||||
@ -1000,8 +1004,8 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
|
||||
av_frame_unref(s->second_last_frame);
|
||||
}
|
||||
|
||||
s->decoding_map = buf;
|
||||
bytestream2_init(&s->stream_ptr, buf + s->decoding_map_size,
|
||||
s->decoding_map = buf + 2;
|
||||
bytestream2_init(&s->stream_ptr, buf + 2 + s->decoding_map_size,
|
||||
buf_size - s->decoding_map_size);
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
|
||||
|
@ -1695,11 +1695,15 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
|
||||
if (tile->codsty[0].mct)
|
||||
mct_decode(s, tile);
|
||||
|
||||
if (s->cdef[0] < 0) {
|
||||
for (x = 0; x < s->ncomponents; x++)
|
||||
s->cdef[x] = x + 1;
|
||||
if ((s->ncomponents & 1) == 0)
|
||||
s->cdef[s->ncomponents-1] = 0;
|
||||
for (x = 0; x < s->ncomponents; x++) {
|
||||
if (s->cdef[x] < 0) {
|
||||
for (x = 0; x < s->ncomponents; x++) {
|
||||
s->cdef[x] = x + 1;
|
||||
}
|
||||
if ((s->ncomponents & 1) == 0)
|
||||
s->cdef[s->ncomponents-1] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (s->precision <= 8) {
|
||||
|
@ -1968,7 +1968,7 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
|
||||
while (b < t) {
|
||||
uint8_t x = src[b++];
|
||||
put_bits(&pb, 8, x);
|
||||
if (x == 0xFF) {
|
||||
if (x == 0xFF && b < t) {
|
||||
x = src[b++];
|
||||
if (x & 0x80) {
|
||||
av_log(s->avctx, AV_LOG_WARNING, "Invalid escape sequence\n");
|
||||
|
@ -145,9 +145,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
{
|
||||
MpegEncContext *s = avctx->priv_data;
|
||||
|
||||
if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO && avctx->height > 2800)
|
||||
avctx->thread_count = 1;
|
||||
|
||||
if (ff_mpv_encode_init(avctx) < 0)
|
||||
return -1;
|
||||
|
||||
|
@ -2783,6 +2783,11 @@ int ff_mpv_reallocate_putbitbuffer(MpegEncContext *s, size_t threshold, size_t s
|
||||
uint8_t *new_buffer = NULL;
|
||||
int new_buffer_size = 0;
|
||||
|
||||
if ((s->avctx->internal->byte_buffer_size + size_increase) >= INT_MAX/8) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Cannot reallocate putbit buffer\n");
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
av_fast_padded_malloc(&new_buffer, &new_buffer_size,
|
||||
s->avctx->internal->byte_buffer_size + size_increase);
|
||||
if (!new_buffer)
|
||||
|
@ -193,6 +193,12 @@ int ff_slice_thread_init(AVCodecContext *avctx)
|
||||
w32thread_init();
|
||||
#endif
|
||||
|
||||
// We cannot do this in the encoder init as the threads are created before
|
||||
if (av_codec_is_encoder(avctx->codec) &&
|
||||
avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO &&
|
||||
avctx->height > 2800)
|
||||
thread_count = avctx->thread_count = 1;
|
||||
|
||||
if (!thread_count) {
|
||||
int nb_cpus = av_cpu_count();
|
||||
if (avctx->height)
|
||||
|
@ -105,7 +105,7 @@ static inline void flush_put_bits(PutBitContext *s)
|
||||
s->bit_buf <<= s->bit_left;
|
||||
#endif
|
||||
while (s->bit_left < 32) {
|
||||
/* XXX: should test end of buffer */
|
||||
av_assert0(s->buf_ptr < s->buf_end);
|
||||
#ifdef BITSTREAM_WRITER_LE
|
||||
*s->buf_ptr++ = s->bit_buf;
|
||||
s->bit_buf >>= 8;
|
||||
|
@ -1004,8 +1004,13 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
|
||||
av_log(s->avctx, AV_LOG_ERROR, "subsample count invalid\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
for (i = 0; i < count; i++)
|
||||
for (i = 0; i < count; i++) {
|
||||
s->subsampling[i] = ff_tget(&s->gb, type, s->le);
|
||||
if (s->subsampling[i] <= 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "subsampling %d is invalid\n", s->subsampling[i]);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TIFF_T4OPTIONS:
|
||||
if (s->compr == TIFF_G3)
|
||||
@ -1253,7 +1258,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
avpkt->size - s->strippos);
|
||||
}
|
||||
|
||||
if (s->rps <= 0) {
|
||||
if (s->rps <= 0 || s->rps % s->subsampling[1]) {
|
||||
av_log(avctx, AV_LOG_ERROR, "rps %d invalid\n", s->rps);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
@ -573,6 +573,11 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
rangebits = get_bits(gb, 4);
|
||||
if (!rangebits && floor_setup->data.t1.partitions) {
|
||||
av_log(vc->avctx, AV_LOG_ERROR,
|
||||
"A rangebits value of 0 is not compliant with the Vorbis I specification.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
rangemax = (1 << rangebits);
|
||||
if (rangemax > vc->blocksize[1] / 2) {
|
||||
av_log(vc->avctx, AV_LOG_ERROR,
|
||||
@ -789,6 +794,11 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc)
|
||||
|
||||
if (get_bits1(gb)) {
|
||||
mapping_setup->coupling_steps = get_bits(gb, 8) + 1;
|
||||
if (vc->audio_channels < 2) {
|
||||
av_log(vc->avctx, AV_LOG_ERROR,
|
||||
"Square polar channel mapping with less than two channels is not compliant with the Vorbis I specification.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
mapping_setup->magnitude = av_mallocz(mapping_setup->coupling_steps *
|
||||
sizeof(*mapping_setup->magnitude));
|
||||
mapping_setup->angle = av_mallocz(mapping_setup->coupling_steps *
|
||||
|
@ -32,6 +32,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
WMACodecContext *s = avctx->priv_data;
|
||||
int i, flags1, flags2, block_align;
|
||||
uint8_t *extradata;
|
||||
int ret;
|
||||
|
||||
s->avctx = avctx;
|
||||
|
||||
@ -82,7 +83,8 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
if (avctx->channels == 2)
|
||||
s->ms_stereo = 1;
|
||||
|
||||
ff_wma_init(avctx, flags2);
|
||||
if ((ret = ff_wma_init(avctx, flags2)) < 0)
|
||||
return ret;
|
||||
|
||||
/* init MDCT */
|
||||
for (i = 0; i < s->nb_block_sizes; i++)
|
||||
|
@ -167,7 +167,7 @@ static void swap_guid(ff_asf_guid guid)
|
||||
|
||||
static void align_position(AVIOContext *pb, int64_t offset, uint64_t size)
|
||||
{
|
||||
if (avio_tell(pb) != offset + size)
|
||||
if (size < INT64_MAX - offset && avio_tell(pb) != offset + size)
|
||||
avio_seek(pb, offset + size, SEEK_SET);
|
||||
}
|
||||
|
||||
@ -178,6 +178,9 @@ static int asf_read_unknown(AVFormatContext *s, const GUIDParseTable *g)
|
||||
uint64_t size = avio_rl64(pb);
|
||||
int ret;
|
||||
|
||||
if (size > INT64_MAX)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (asf->is_header)
|
||||
asf->unknown_size = size;
|
||||
asf->is_header = 0;
|
||||
@ -187,8 +190,13 @@ static int asf_read_unknown(AVFormatContext *s, const GUIDParseTable *g)
|
||||
if ((ret = detect_unknown_subobject(s, asf->unknown_offset,
|
||||
asf->unknown_size)) < 0)
|
||||
return ret;
|
||||
} else
|
||||
} else {
|
||||
if (size < 24) {
|
||||
av_log(s, AV_LOG_ERROR, "Too small size %"PRIu64" (< 24).\n", size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
avio_skip(pb, size - 24);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -967,7 +975,7 @@ static int asf_read_simple_index(AVFormatContext *s, const GUIDParseTable *g)
|
||||
uint64_t interval; // index entry time interval in 100 ns units, usually it's 1s
|
||||
uint32_t pkt_num, nb_entries;
|
||||
int32_t prev_pkt_num = -1;
|
||||
int i;
|
||||
int i, ret;
|
||||
uint64_t size = avio_rl64(pb);
|
||||
|
||||
// simple index objects should be ordered by stream number, this loop tries to find
|
||||
@ -989,7 +997,11 @@ static int asf_read_simple_index(AVFormatContext *s, const GUIDParseTable *g)
|
||||
nb_entries = avio_rl32(pb);
|
||||
for (i = 0; i < nb_entries; i++) {
|
||||
pkt_num = avio_rl32(pb);
|
||||
avio_skip(pb, 2);
|
||||
ret = avio_skip(pb, 2);
|
||||
if (ret < 0) {
|
||||
av_log(s, AV_LOG_ERROR, "Skipping failed in asf_read_simple_index.\n");
|
||||
return ret;
|
||||
}
|
||||
if (prev_pkt_num != pkt_num) {
|
||||
av_add_index_entry(st, asf->first_packet_offset + asf->packet_size *
|
||||
pkt_num, av_rescale(interval, i, 10000),
|
||||
@ -1136,14 +1148,15 @@ static int asf_read_replicated_data(AVFormatContext *s, ASFPacket *asf_pkt)
|
||||
{
|
||||
ASFContext *asf = s->priv_data;
|
||||
AVIOContext *pb = s->pb;
|
||||
int ret;
|
||||
int ret, data_size;
|
||||
|
||||
if (!asf_pkt->data_size) {
|
||||
asf_pkt->data_size = asf_pkt->size_left = avio_rl32(pb); // read media object size
|
||||
if (asf_pkt->data_size <= 0)
|
||||
data_size = avio_rl32(pb); // read media object size
|
||||
if (data_size <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if ((ret = av_new_packet(&asf_pkt->avpkt, asf_pkt->data_size)) < 0)
|
||||
if ((ret = av_new_packet(&asf_pkt->avpkt, data_size)) < 0)
|
||||
return ret;
|
||||
asf_pkt->data_size = asf_pkt->size_left = data_size;
|
||||
} else
|
||||
avio_skip(pb, 4); // reading of media object size is already done
|
||||
asf_pkt->dts = avio_rl32(pb); // read presentation time
|
||||
@ -1212,14 +1225,15 @@ static int asf_read_single_payload(AVFormatContext *s, AVPacket *pkt,
|
||||
int64_t offset;
|
||||
uint64_t size;
|
||||
unsigned char *p;
|
||||
int ret;
|
||||
int ret, data_size;
|
||||
|
||||
if (!asf_pkt->data_size) {
|
||||
asf_pkt->data_size = asf_pkt->size_left = avio_rl32(pb); // read media object size
|
||||
if (asf_pkt->data_size <= 0)
|
||||
data_size = avio_rl32(pb); // read media object size
|
||||
if (data_size <= 0)
|
||||
return AVERROR_EOF;
|
||||
if ((ret = av_new_packet(&asf_pkt->avpkt, asf_pkt->data_size)) < 0)
|
||||
if ((ret = av_new_packet(&asf_pkt->avpkt, data_size)) < 0)
|
||||
return ret;
|
||||
asf_pkt->data_size = asf_pkt->size_left = data_size;
|
||||
} else
|
||||
avio_skip(pb, 4); // skip media object size
|
||||
asf_pkt->dts = avio_rl32(pb); // read presentation time
|
||||
@ -1276,8 +1290,20 @@ static int asf_read_payload(AVFormatContext *s, AVPacket *pkt)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!asf_pkt)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (!asf_pkt) {
|
||||
if (asf->packet_offset + asf->packet_size <= asf->data_offset + asf->data_size) {
|
||||
if (!asf->packet_size) {
|
||||
av_log(s, AV_LOG_ERROR, "Invalid packet size 0.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
avio_seek(pb, asf->packet_offset + asf->packet_size, SEEK_SET);
|
||||
av_log(s, AV_LOG_WARNING, "Skipping the stream with the invalid stream index %d.\n",
|
||||
asf->stream_index);
|
||||
return AVERROR(EAGAIN);
|
||||
} else
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (stream_num >> 7)
|
||||
asf_pkt->flags |= AV_PKT_FLAG_KEY;
|
||||
READ_LEN(asf->prop_flags & ASF_PL_MASK_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_SIZE,
|
||||
@ -1413,13 +1439,21 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
while (!pb->eof_reached) {
|
||||
if (asf->state == PARSE_PACKET_HEADER) {
|
||||
asf_read_packet_header(s);
|
||||
if (pb->eof_reached)
|
||||
break;
|
||||
if (!asf->nb_mult_left)
|
||||
asf->state = READ_SINGLE;
|
||||
else
|
||||
asf->state = READ_MULTI;
|
||||
}
|
||||
if ((ret = asf_read_payload(s, pkt)) < 0)
|
||||
ret = asf_read_payload(s, pkt);
|
||||
if (ret == AVERROR(EAGAIN)) {
|
||||
asf->state = PARSE_PACKET_HEADER;
|
||||
continue;
|
||||
}
|
||||
else if (ret < 0)
|
||||
return ret;
|
||||
|
||||
switch (asf->state) {
|
||||
case READ_SINGLE:
|
||||
if (!asf->sub_left)
|
||||
|
@ -78,6 +78,18 @@
|
||||
* if its AVClass is non-NULL, and the protocols layer. See the discussion on
|
||||
* nesting in @ref avoptions documentation to learn how to access those.
|
||||
*
|
||||
* @section urls
|
||||
* URL strings in libavformat are made of a scheme/protocol, a ':', and a
|
||||
* scheme specific string. URLs without a scheme and ':' used for local files
|
||||
* are supported but deprecated. "file:" should be used for local files.
|
||||
*
|
||||
* It is important that the scheme string is not taken from untrusted
|
||||
* sources without checks.
|
||||
*
|
||||
* Note that some schemes/protocols are quite powerful, allowing access to
|
||||
* both local and remote files, parts of them, concatenations of them, local
|
||||
* audio and video devices and so on.
|
||||
*
|
||||
* @defgroup lavf_decoding Demuxing
|
||||
* @{
|
||||
* Demuxers read a media file and split it into chunks of data (@em packets). A
|
||||
@ -88,10 +100,10 @@
|
||||
* cleanup.
|
||||
*
|
||||
* @section lavf_decoding_open Opening a media file
|
||||
* The minimum information required to open a file is its URL or filename, which
|
||||
* The minimum information required to open a file is its URL, which
|
||||
* is passed to avformat_open_input(), as in the following code:
|
||||
* @code
|
||||
* const char *url = "in.mp3";
|
||||
* const char *url = "file:in.mp3";
|
||||
* AVFormatContext *s = NULL;
|
||||
* int ret = avformat_open_input(&s, url, NULL, NULL);
|
||||
* if (ret < 0)
|
||||
@ -2044,7 +2056,7 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score
|
||||
*
|
||||
* @param pb the bytestream to probe
|
||||
* @param fmt the input format is put here
|
||||
* @param filename the filename of the stream
|
||||
* @param url the url of the stream
|
||||
* @param logctx the log context
|
||||
* @param offset the offset within the bytestream to probe from
|
||||
* @param max_probe_size the maximum probe buffer size (zero for default)
|
||||
@ -2053,14 +2065,14 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score
|
||||
* AVERROR code otherwise
|
||||
*/
|
||||
int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt,
|
||||
const char *filename, void *logctx,
|
||||
const char *url, void *logctx,
|
||||
unsigned int offset, unsigned int max_probe_size);
|
||||
|
||||
/**
|
||||
* Like av_probe_input_buffer2() but returns 0 on success
|
||||
*/
|
||||
int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
|
||||
const char *filename, void *logctx,
|
||||
const char *url, void *logctx,
|
||||
unsigned int offset, unsigned int max_probe_size);
|
||||
|
||||
/**
|
||||
@ -2071,7 +2083,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
|
||||
* May be a pointer to NULL, in which case an AVFormatContext is allocated by this
|
||||
* function and written into ps.
|
||||
* Note that a user-supplied AVFormatContext will be freed on failure.
|
||||
* @param filename Name of the stream to open.
|
||||
* @param url URL of the stream to open.
|
||||
* @param fmt If non-NULL, this parameter forces a specific input format.
|
||||
* Otherwise the format is autodetected.
|
||||
* @param options A dictionary filled with AVFormatContext and demuxer-private options.
|
||||
@ -2082,7 +2094,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
|
||||
*
|
||||
* @note If you want to use custom IO, preallocate the format context and set its pb field.
|
||||
*/
|
||||
int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options);
|
||||
int avformat_open_input(AVFormatContext **ps, const char *url, AVInputFormat *fmt, AVDictionary **options);
|
||||
|
||||
attribute_deprecated
|
||||
int av_demuxer_open(AVFormatContext *ic);
|
||||
|
@ -156,9 +156,16 @@ static int url_alloc_for_protocol(URLContext **puc, struct URLProtocol *up,
|
||||
char sep= *++p;
|
||||
char *key, *val;
|
||||
p++;
|
||||
|
||||
if (strcmp(up->name, "subfile"))
|
||||
ret = AVERROR(EINVAL);
|
||||
|
||||
while(ret >= 0 && (key= strchr(p, sep)) && p<key && (val = strchr(key+1, sep))){
|
||||
*val= *key= 0;
|
||||
ret= av_opt_set(uc->priv_data, p, key+1, 0);
|
||||
if (strcmp(p, "start") && strcmp(p, "end")) {
|
||||
ret = AVERROR_OPTION_NOT_FOUND;
|
||||
} else
|
||||
ret= av_opt_set(uc->priv_data, p, key+1, 0);
|
||||
if (ret == AVERROR_OPTION_NOT_FOUND)
|
||||
av_log(uc, AV_LOG_ERROR, "Key '%s' not found.\n", p);
|
||||
*val= *key= sep;
|
||||
@ -243,7 +250,7 @@ static struct URLProtocol *url_find_protocol(const char *filename)
|
||||
size_t proto_len = strspn(filename, URL_SCHEME_CHARS);
|
||||
|
||||
if (filename[proto_len] != ':' &&
|
||||
(filename[proto_len] != ',' || !strchr(filename + proto_len + 1, ':')) ||
|
||||
(strncmp(filename, "subfile,", 8) || !strchr(filename + proto_len + 1, ':')) ||
|
||||
is_dos_path(filename))
|
||||
strcpy(proto_str, "file");
|
||||
else
|
||||
|
@ -389,6 +389,20 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
codec->codec_id == AV_CODEC_ID_ADPCM_THP_LE) {
|
||||
uint8_t *dst;
|
||||
|
||||
if (!b->adpc) {
|
||||
av_log(s, AV_LOG_ERROR, "adpcm_thp requires ADPC chunk, but none was found.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (!b->table) {
|
||||
b->table = av_mallocz(32 * codec->channels);
|
||||
if (!b->table)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
if (size > (INT_MAX - 32 - 4) ||
|
||||
(32 + 4 + size) > (INT_MAX / codec->channels) ||
|
||||
(32 + 4 + size) * codec->channels > INT_MAX - 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (av_new_packet(pkt, 8 + (32 + 4 + size) * codec->channels) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
dst = pkt->data;
|
||||
|
@ -65,7 +65,10 @@ static av_cold int concat_open(URLContext *h, const char *uri, int flags)
|
||||
struct concat_data *data = h->priv_data;
|
||||
struct concat_nodes *nodes;
|
||||
|
||||
av_strstart(uri, "concat:", &uri);
|
||||
if (!av_strstart(uri, "concat:", &uri)) {
|
||||
av_log(h, AV_LOG_ERROR, "URL %s lacks prefix\n", uri);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
for (i = 0, len = 1; uri[i]; i++) {
|
||||
if (uri[i] == *AV_CAT_SEPARATOR) {
|
||||
|
@ -114,9 +114,10 @@ static int ffm_read_data(AVFormatContext *s,
|
||||
ffm->dts = avio_rb64(pb);
|
||||
frame_offset = avio_rb16(pb);
|
||||
avio_read(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE);
|
||||
ffm->packet_end = ffm->packet + (ffm->packet_size - FFM_HEADER_SIZE - fill_size);
|
||||
if (ffm->packet_end < ffm->packet || frame_offset < 0)
|
||||
if (ffm->packet_size < FFM_HEADER_SIZE + fill_size || frame_offset < 0) {
|
||||
return -1;
|
||||
}
|
||||
ffm->packet_end = ffm->packet + (ffm->packet_size - FFM_HEADER_SIZE - fill_size);
|
||||
/* if first packet or resynchronization packet, we must
|
||||
handle it specifically */
|
||||
if (ffm->first_packet || (frame_offset & 0x8000)) {
|
||||
@ -132,8 +133,10 @@ static int ffm_read_data(AVFormatContext *s,
|
||||
return 0;
|
||||
}
|
||||
ffm->first_packet = 0;
|
||||
if ((frame_offset & 0x7fff) < FFM_HEADER_SIZE)
|
||||
if ((frame_offset & 0x7fff) < FFM_HEADER_SIZE) {
|
||||
ffm->packet_end = ffm->packet_ptr;
|
||||
return -1;
|
||||
}
|
||||
ffm->packet_ptr = ffm->packet + (frame_offset & 0x7fff) - FFM_HEADER_SIZE;
|
||||
if (!header)
|
||||
break;
|
||||
|
@ -34,7 +34,8 @@ enum PatternType {
|
||||
PT_GLOB_SEQUENCE,
|
||||
PT_GLOB,
|
||||
PT_SEQUENCE,
|
||||
PT_NONE
|
||||
PT_NONE,
|
||||
PT_DEFAULT
|
||||
};
|
||||
|
||||
typedef struct VideoDemuxData {
|
||||
|
@ -224,6 +224,13 @@ int ff_img_read_header(AVFormatContext *s1)
|
||||
}
|
||||
|
||||
if (!s->is_pipe) {
|
||||
if (s->pattern_type == PT_DEFAULT) {
|
||||
if (s1->pb) {
|
||||
s->pattern_type = PT_NONE;
|
||||
} else
|
||||
s->pattern_type = PT_GLOB_SEQUENCE;
|
||||
}
|
||||
|
||||
if (s->pattern_type == PT_GLOB_SEQUENCE) {
|
||||
s->use_glob = is_glob(s->path);
|
||||
if (s->use_glob) {
|
||||
@ -369,6 +376,10 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
|
||||
int size[3] = { 0 }, ret[3] = { 0 };
|
||||
AVIOContext *f[3] = { NULL };
|
||||
AVCodecContext *codec = s1->streams[0]->codec;
|
||||
AVOpenCallback open_func = s1->open_cb;
|
||||
|
||||
if (!open_func)
|
||||
open_func = ffio_open2_wrapper;
|
||||
|
||||
if (!s->is_pipe) {
|
||||
/* loop over input */
|
||||
@ -390,7 +401,7 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
|
||||
return AVERROR(EIO);
|
||||
}
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (avio_open2(&f[i], filename, AVIO_FLAG_READ,
|
||||
if (open_func(s1, &f[i], filename, AVIO_FLAG_READ,
|
||||
&s1->interrupt_callback, NULL) < 0) {
|
||||
if (i >= 1)
|
||||
break;
|
||||
@ -550,7 +561,7 @@ const AVOption ff_img_options[] = {
|
||||
{ "framerate", "set the video framerate", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0, DEC },
|
||||
{ "loop", "force loop over input file sequence", OFFSET(loop), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, DEC },
|
||||
|
||||
{ "pattern_type", "set pattern type", OFFSET(pattern_type), AV_OPT_TYPE_INT, {.i64=PT_GLOB_SEQUENCE}, 0, INT_MAX, DEC, "pattern_type"},
|
||||
{ "pattern_type", "set pattern type", OFFSET(pattern_type), AV_OPT_TYPE_INT, {.i64=PT_DEFAULT}, 0, INT_MAX, DEC, "pattern_type"},
|
||||
{ "glob_sequence","select glob/sequence pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_GLOB_SEQUENCE}, INT_MIN, INT_MAX, DEC, "pattern_type" },
|
||||
{ "glob", "select glob pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_GLOB }, INT_MIN, INT_MAX, DEC, "pattern_type" },
|
||||
{ "sequence", "select sequence pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_SEQUENCE }, INT_MIN, INT_MAX, DEC, "pattern_type" },
|
||||
|
@ -156,7 +156,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
|
||||
|
||||
/* send both the decode map and the video data together */
|
||||
|
||||
if (av_new_packet(pkt, s->decode_map_chunk_size + s->video_chunk_size))
|
||||
if (av_new_packet(pkt, 2 + s->decode_map_chunk_size + s->video_chunk_size))
|
||||
return CHUNK_NOMEM;
|
||||
|
||||
if (s->has_palette) {
|
||||
@ -178,7 +178,8 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
|
||||
avio_seek(pb, s->decode_map_chunk_offset, SEEK_SET);
|
||||
s->decode_map_chunk_offset = 0;
|
||||
|
||||
if (avio_read(pb, pkt->data, s->decode_map_chunk_size) !=
|
||||
AV_WL16(pkt->data, s->decode_map_chunk_size);
|
||||
if (avio_read(pb, pkt->data + 2, s->decode_map_chunk_size) !=
|
||||
s->decode_map_chunk_size) {
|
||||
av_free_packet(pkt);
|
||||
return CHUNK_EOF;
|
||||
@ -187,7 +188,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
|
||||
avio_seek(pb, s->video_chunk_offset, SEEK_SET);
|
||||
s->video_chunk_offset = 0;
|
||||
|
||||
if (avio_read(pb, pkt->data + s->decode_map_chunk_size,
|
||||
if (avio_read(pb, pkt->data + 2 + s->decode_map_chunk_size,
|
||||
s->video_chunk_size) != s->video_chunk_size) {
|
||||
av_free_packet(pkt);
|
||||
return CHUNK_EOF;
|
||||
|
@ -209,6 +209,7 @@ typedef struct MOVContext {
|
||||
void *audible_fixed_key;
|
||||
int audible_fixed_key_size;
|
||||
struct AVAES *aes_decrypt;
|
||||
int enable_drefs;
|
||||
} MOVContext;
|
||||
|
||||
int ff_mp4_read_descr_len(AVIOContext *pb);
|
||||
|
@ -95,6 +95,20 @@ static int libquvi_read_header(AVFormatContext *s)
|
||||
goto err_quvi_cleanup;
|
||||
}
|
||||
|
||||
if (!qc->fmtctx->format_whitelist) {
|
||||
qc->fmtctx->format_whitelist = av_strdup("avi,asf,flv,mov,mpeg,mpegts,aac,h264,hevc,mp3,ogg,matroska,mxf,mp2");
|
||||
if (!qc->fmtctx->format_whitelist) {
|
||||
avformat_free_context(qc->fmtctx);
|
||||
qc->fmtctx = NULL;
|
||||
goto err_quvi_cleanup;
|
||||
}
|
||||
}
|
||||
if (strncmp(media_url, "http:", 5) && strncmp(media_url, "https:", 6)) {
|
||||
avformat_free_context(qc->fmtctx);
|
||||
qc->fmtctx = NULL;
|
||||
goto err_quvi_cleanup;
|
||||
}
|
||||
|
||||
ret = avformat_open_input(&qc->fmtctx, media_url, NULL, NULL);
|
||||
if (ret < 0)
|
||||
goto err_quvi_cleanup;
|
||||
|
@ -3002,13 +3002,23 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
|
||||
if (sc->dref_id-1 < sc->drefs_count && sc->drefs[sc->dref_id-1].path) {
|
||||
MOVDref *dref = &sc->drefs[sc->dref_id - 1];
|
||||
if (mov_open_dref(c, &sc->pb, c->fc->filename, dref,
|
||||
&c->fc->interrupt_callback) < 0)
|
||||
av_log(c->fc, AV_LOG_ERROR,
|
||||
"stream %d, error opening alias: path='%s', dir='%s', "
|
||||
"filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d\n",
|
||||
if (c->enable_drefs) {
|
||||
if (mov_open_dref(c, &sc->pb, c->fc->filename, dref,
|
||||
&c->fc->interrupt_callback) < 0)
|
||||
av_log(c->fc, AV_LOG_ERROR,
|
||||
"stream %d, error opening alias: path='%s', dir='%s', "
|
||||
"filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d\n",
|
||||
st->index, dref->path, dref->dir, dref->filename,
|
||||
dref->volume, dref->nlvl_from, dref->nlvl_to);
|
||||
} else {
|
||||
av_log(c->fc, AV_LOG_WARNING,
|
||||
"Skipped opening external track: "
|
||||
"stream %d, alias: path='%s', dir='%s', "
|
||||
"filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d."
|
||||
"Set enable_drefs to allow this.\n",
|
||||
st->index, dref->path, dref->dir, dref->filename,
|
||||
dref->volume, dref->nlvl_from, dref->nlvl_to);
|
||||
}
|
||||
} else {
|
||||
sc->pb = c->fc->pb;
|
||||
sc->pb_is_copied = 1;
|
||||
@ -4925,6 +4935,8 @@ static const AVOption mov_options[] = {
|
||||
"Fixed key used for handling Audible AAX files", OFFSET(audible_fixed_key),
|
||||
AV_OPT_TYPE_BINARY, {.str="77214d4b196a87cd520045fd20a51d67"},
|
||||
.flags = AV_OPT_FLAG_DECODING_PARAM },
|
||||
{ "enable_drefs", "Enable external track support.", OFFSET(enable_drefs), AV_OPT_TYPE_INT,
|
||||
{.i64 = 0}, 0, 1, FLAGS },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
|
@ -1461,10 +1461,11 @@ int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
|
||||
while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) {
|
||||
ret = av_opt_set(obj, t->key, t->value, search_flags);
|
||||
if (ret == AVERROR_OPTION_NOT_FOUND)
|
||||
av_dict_set(&tmp, t->key, t->value, 0);
|
||||
else if (ret < 0) {
|
||||
ret = av_dict_set(&tmp, t->key, t->value, 0);
|
||||
if (ret < 0) {
|
||||
av_log(obj, AV_LOG_ERROR, "Error setting option %s to value %s.\n", t->key, t->value);
|
||||
break;
|
||||
av_dict_free(&tmp);
|
||||
return ret;
|
||||
}
|
||||
ret = 0;
|
||||
}
|
||||
|
@ -1044,12 +1044,20 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
|
||||
const uint8_t *src2[4];
|
||||
uint8_t *dst2[4];
|
||||
uint8_t *rgb0_tmp = NULL;
|
||||
int macro_height = isBayer(c->srcFormat) ? 2 : (1 << c->chrSrcVSubSample);
|
||||
|
||||
if (!srcStride || !dstStride || !dst || !srcSlice) {
|
||||
av_log(c, AV_LOG_ERROR, "One of the input parameters to sws_scale() is NULL, please check the calling code\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((srcSliceY & (macro_height-1)) ||
|
||||
((srcSliceH& (macro_height-1)) && srcSliceY + srcSliceH != c->srcH) ||
|
||||
srcSliceY + srcSliceH > c->srcH) {
|
||||
av_log(c, AV_LOG_ERROR, "Slice parameters %d, %d are invalid\n", srcSliceY, srcSliceH);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if (c->gamma_flag && c->cascaded_context[0]) {
|
||||
|
||||
|
||||
|
@ -1059,6 +1059,8 @@ static int bayer_to_rgb24_wrapper(SwsContext *c, const uint8_t* src[], int srcSt
|
||||
default: return 0;
|
||||
}
|
||||
|
||||
av_assert0(srcSliceH > 1);
|
||||
|
||||
copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW);
|
||||
srcPtr += 2 * srcStride[0];
|
||||
dstPtr += 2 * dstStride[0];
|
||||
@ -1069,7 +1071,10 @@ static int bayer_to_rgb24_wrapper(SwsContext *c, const uint8_t* src[], int srcSt
|
||||
dstPtr += 2 * dstStride[0];
|
||||
}
|
||||
|
||||
copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW);
|
||||
if (i + 1 == srcSliceH) {
|
||||
copy(srcPtr, -srcStride[0], dstPtr, -dstStride[0], c->srcW);
|
||||
} else if (i < srcSliceH)
|
||||
copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW);
|
||||
return srcSliceH;
|
||||
}
|
||||
|
||||
@ -1105,6 +1110,8 @@ static int bayer_to_yv12_wrapper(SwsContext *c, const uint8_t* src[], int srcStr
|
||||
default: return 0;
|
||||
}
|
||||
|
||||
av_assert0(srcSliceH > 1);
|
||||
|
||||
copy(srcPtr, srcStride[0], dstY, dstU, dstV, dstStride[0], c->srcW, c->input_rgb2yuv_table);
|
||||
srcPtr += 2 * srcStride[0];
|
||||
dstY += 2 * dstStride[0];
|
||||
@ -1119,7 +1126,10 @@ static int bayer_to_yv12_wrapper(SwsContext *c, const uint8_t* src[], int srcStr
|
||||
dstV += dstStride[1];
|
||||
}
|
||||
|
||||
copy(srcPtr, srcStride[0], dstY, dstU, dstV, dstStride[0], c->srcW, c->input_rgb2yuv_table);
|
||||
if (i + 1 == srcSliceH) {
|
||||
copy(srcPtr, -srcStride[0], dstY, dstU, dstV, -dstStride[0], c->srcW, c->input_rgb2yuv_table);
|
||||
} else if (i < srcSliceH)
|
||||
copy(srcPtr, srcStride[0], dstY, dstU, dstV, dstStride[0], c->srcW, c->input_rgb2yuv_table);
|
||||
return srcSliceH;
|
||||
}
|
||||
|
||||
|
@ -1434,7 +1434,9 @@ static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, int srcWid
|
||||
dst+= dstStride;
|
||||
|
||||
for (y=1; y<srcHeight; y++) {
|
||||
const x86_reg mmxSize= srcWidth&~15;
|
||||
x86_reg mmxSize= srcWidth&~15;
|
||||
|
||||
if (mmxSize) {
|
||||
__asm__ volatile(
|
||||
"mov %4, %%"REG_a" \n\t"
|
||||
"movq "MANGLE(mmx_ff)", %%mm0 \n\t"
|
||||
@ -1481,6 +1483,11 @@ static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, int srcWid
|
||||
NAMED_CONSTRAINTS_ADD(mmx_ff)
|
||||
: "%"REG_a
|
||||
);
|
||||
} else {
|
||||
mmxSize = 1;
|
||||
dst[0] = (src[0] * 3 + src[srcStride]) >> 2;
|
||||
dst[dstStride] = (src[0] + 3 * src[srcStride]) >> 2;
|
||||
}
|
||||
|
||||
for (x=mmxSize-1; x<srcWidth-1; x++) {
|
||||
dst[2*x +1]= (3*src[x+0] + src[x+srcStride+1])>>2;
|
||||
|
Loading…
Reference in New Issue
Block a user