Compare commits
196 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3c63503792 | ||
![]() |
a78b7c504a | ||
![]() |
d66d5d6188 | ||
![]() |
cb7d72ed18 | ||
![]() |
74c7273b5d | ||
![]() |
416501da1a | ||
![]() |
43924a8e99 | ||
![]() |
d705125b94 | ||
![]() |
1a263f0dd9 | ||
![]() |
492818d724 | ||
![]() |
ca98c016cd | ||
![]() |
6005f375aa | ||
![]() |
4d5beea7a1 | ||
![]() |
2073ab266e | ||
![]() |
7b213e88b5 | ||
![]() |
b250375e77 | ||
![]() |
1cc419eae8 | ||
![]() |
9dc8f44829 | ||
![]() |
724c79276a | ||
![]() |
3e46e3a33c | ||
![]() |
0c125519ec | ||
![]() |
076b98c9b7 | ||
![]() |
8413ddcd39 | ||
![]() |
0882212298 | ||
![]() |
3531ff8db3 | ||
![]() |
ee8e48d386 | ||
![]() |
600c6ebc7d | ||
![]() |
2515de3b15 | ||
![]() |
e2e835f017 | ||
![]() |
a31fdcef55 | ||
![]() |
8a16b27de9 | ||
![]() |
b8546aee84 | ||
![]() |
84e5b314f3 | ||
![]() |
1497f355c7 | ||
![]() |
096fd2698a | ||
![]() |
1ecce1c6a7 | ||
![]() |
01b5e61845 | ||
![]() |
05a8114c71 | ||
![]() |
5080ab26d3 | ||
![]() |
2029acb667 | ||
![]() |
0a878d0c94 | ||
![]() |
92595faab9 | ||
![]() |
9d1e775b89 | ||
![]() |
2c1d5f43cf | ||
![]() |
532c96a215 | ||
![]() |
891de4b27a | ||
![]() |
fa1ca88cb6 | ||
![]() |
2b95572b10 | ||
![]() |
f5dd1270d9 | ||
![]() |
6feb72a094 | ||
![]() |
02d979d007 | ||
![]() |
fb62580fb6 | ||
![]() |
55c6a482d4 | ||
![]() |
faa67e9777 | ||
![]() |
98ba288737 | ||
![]() |
baef2736b0 | ||
![]() |
65b2973a54 | ||
![]() |
a0bad45cd8 | ||
![]() |
d48d2f166d | ||
![]() |
e82140b09b | ||
![]() |
4e251b23c3 | ||
![]() |
9b669f9b14 | ||
![]() |
099e0178bf | ||
![]() |
dc84cf241c | ||
![]() |
206ca5c7c8 | ||
![]() |
375c1050bf | ||
![]() |
c2b658c0e7 | ||
![]() |
f251409adc | ||
![]() |
e3ce2a8773 | ||
![]() |
4f72aef342 | ||
![]() |
6f14434218 | ||
![]() |
49f477071d | ||
![]() |
5b965a508c | ||
![]() |
6cb8e40f43 | ||
![]() |
b5b36e45b3 | ||
![]() |
f038623d53 | ||
![]() |
6aece62b50 | ||
![]() |
c7831e55b5 | ||
![]() |
6f9bb83dbb | ||
![]() |
97a55f00d3 | ||
![]() |
b6cd6da173 | ||
![]() |
d3316c3f85 | ||
![]() |
324797eb83 | ||
![]() |
298f7f1fac | ||
![]() |
fefb152cd9 | ||
![]() |
275cd55a0f | ||
![]() |
749fadaa65 | ||
![]() |
8120061be2 | ||
![]() |
34b28d3823 | ||
![]() |
153a012384 | ||
![]() |
d6f4e475a1 | ||
![]() |
a299d93928 | ||
![]() |
39f2e53a24 | ||
![]() |
adfb4661d9 | ||
![]() |
b400412443 | ||
![]() |
158cf1d52d | ||
![]() |
6fd7456f85 | ||
![]() |
ee025a0c61 | ||
![]() |
679c3d210f | ||
![]() |
1da83d52bc | ||
![]() |
564d943b27 | ||
![]() |
aded1110a3 | ||
![]() |
365e0652f9 | ||
![]() |
1dc53463d9 | ||
![]() |
705e0e0513 | ||
![]() |
85d05fdc80 | ||
![]() |
c8a2b1ac3c | ||
![]() |
12d6bbf7cb | ||
![]() |
0d801c0bfd | ||
![]() |
9d43e51eec | ||
![]() |
73046fa195 | ||
![]() |
0295615f0a | ||
![]() |
c69fff3790 | ||
![]() |
3c33983b74 | ||
![]() |
e7b8fa2c00 | ||
![]() |
0afeb76e75 | ||
![]() |
98d4a07ccf | ||
![]() |
3cc8822c93 | ||
![]() |
05b1ac2470 | ||
![]() |
cc598bf7dc | ||
![]() |
dd4adba811 | ||
![]() |
ee910aef38 | ||
![]() |
cdf37f2548 | ||
![]() |
b96163f055 | ||
![]() |
4039f11ed8 | ||
![]() |
5f6f241221 | ||
![]() |
ff77fa754b | ||
![]() |
431f57f046 | ||
![]() |
88411b87b4 | ||
![]() |
3f09d4f6d4 | ||
![]() |
3aba00b1b3 | ||
![]() |
796bd81835 | ||
![]() |
9e0a38d32b | ||
![]() |
39e07ac9fc | ||
![]() |
21aeae9c67 | ||
![]() |
dd195c2c58 | ||
![]() |
29e720da76 | ||
![]() |
61fdbf7ff6 | ||
![]() |
93bf4a74de | ||
![]() |
5276174859 | ||
![]() |
32701252af | ||
![]() |
4d11e4b47d | ||
![]() |
5891fd017a | ||
![]() |
e9aeaa6441 | ||
![]() |
cce99f72d1 | ||
![]() |
fbc20c3b85 | ||
![]() |
484e015dc8 | ||
![]() |
b82170336f | ||
![]() |
12e1a7013a | ||
![]() |
e7ee74485b | ||
![]() |
4edbb0955e | ||
![]() |
2a75c0b1ca | ||
![]() |
34e7f70f9f | ||
![]() |
242fc6394f | ||
![]() |
bae05e5326 | ||
![]() |
26ba78adac | ||
![]() |
8a982092cc | ||
![]() |
19fc283dbb | ||
![]() |
b9b689550e | ||
![]() |
7c710c38f6 | ||
![]() |
a7e79f6a43 | ||
![]() |
556a5090f2 | ||
![]() |
1551602b42 | ||
![]() |
4cd0041d38 | ||
![]() |
d1ad85fc02 | ||
![]() |
6cf27b550d | ||
![]() |
5aceced0a0 | ||
![]() |
27487944ef | ||
![]() |
51f76e4e93 | ||
![]() |
c246b0b4c3 | ||
![]() |
daef7feb09 | ||
![]() |
2496dbd68b | ||
![]() |
608e8d8dd7 | ||
![]() |
4d48691622 | ||
![]() |
bb823e26b1 | ||
![]() |
b31bb39bdd | ||
![]() |
036f5c5420 | ||
![]() |
da35008c31 | ||
![]() |
4baee1124b | ||
![]() |
bbb86717b3 | ||
![]() |
1fd55ec507 | ||
![]() |
20f9cf744a | ||
![]() |
20d6ae4626 | ||
![]() |
23fe589e19 | ||
![]() |
9bd4561d74 | ||
![]() |
cbf31d5f15 | ||
![]() |
21683549ed | ||
![]() |
cbfdbba58e | ||
![]() |
1411f073fd | ||
![]() |
76e9a17f33 | ||
![]() |
3d0752d82f | ||
![]() |
bfe18be88a | ||
![]() |
f6c82b34a3 | ||
![]() |
3280b86c85 | ||
![]() |
61335ab33e | ||
![]() |
932caa50a5 |
26
Changelog
26
Changelog
@@ -3,6 +3,32 @@ releases are sorted from youngest to oldest.
|
||||
|
||||
version <next>:
|
||||
|
||||
version 2.4.7:
|
||||
- avcodec/flac_parser: fix handling EOF if no headers are found
|
||||
- avfilter/vf_framepack: Check and update frame_rate
|
||||
- avcodec/hevc: Fix handling of skipped_bytes() reallocation failures
|
||||
- qpeg: avoid pointless invalid memcpy()
|
||||
- avcodec/arm/videodsp_armv5te: Fix linking failure with "g++ -shared -D__STDC_CONSTANT_MACROS -o test.so ... libavcodec.a"
|
||||
- avcodec/mjpegdec: Skip blocks which are outside the visible area
|
||||
- lavc/aarch64: Do not use the neon horizontal chroma loop filter for H.264 4:2:2. (cherry picked from commit 4faea46bd906b3897018736208123aa36c3f45d5)
|
||||
- avcodec/h264_slice: assert that reinit does not occur after the first slice
|
||||
- avcodec/h264_slice: ignore SAR changes in slices after the first
|
||||
- avcodec/h264_slice: Check picture structure before setting the related fields
|
||||
- avcodec/h264_slice: Do not change frame_num after the first slice
|
||||
- avutil/opt: Fix type used to access AV_OPT_TYPE_SAMPLE_FMT
|
||||
- avutil/opt: Fix types used to access AV_OPT_TYPE_PIXEL_FMT
|
||||
- avcodec/h264: Be more strict on rejecting pps/sps changes
|
||||
- avcodec/h264: Be more strict on rejecting pps_id changes
|
||||
- avcodec/h264_ps: More completely check the bit depths
|
||||
- avformat/thp: Check av_get_packet() for failure not only for partial output
|
||||
- swscale/utils: Limit filter shifting so as not to read from prior the array
|
||||
- avcodec/mpegvideo_motion: Fix gmc chroma dimensions
|
||||
- avcodec/mjpegdec: Check number of components for JPEG-LS
|
||||
- avcodec/mjpegdec: Check escape sequence validity
|
||||
- avformat/mpc8: Use uint64_t in *_get_v() to avoid undefined behavior
|
||||
- avformat/mpc8: fix broken pointer math
|
||||
- avformat/mpc8: fix hang with fuzzed file
|
||||
- avformat/tta: fix crash with corrupted files
|
||||
|
||||
version 2.4.6:
|
||||
- doc/examples: fix lib math dep for decoding_encoding
|
||||
|
34
cmdutils.c
34
cmdutils.c
@@ -444,7 +444,7 @@ int locate_option(int argc, char **argv, const OptionDef *options,
|
||||
(po->name && !strcmp(optname, po->name)))
|
||||
return i;
|
||||
|
||||
if (po->flags & HAS_ARG)
|
||||
if (!po->name || po->flags & HAS_ARG)
|
||||
i++;
|
||||
}
|
||||
return 0;
|
||||
@@ -1865,19 +1865,31 @@ int cmdutils_read_file(const char *filename, char **bufptr, size_t *size)
|
||||
strerror(errno));
|
||||
return AVERROR(errno);
|
||||
}
|
||||
fseek(f, 0, SEEK_END);
|
||||
*size = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
if (*size == (size_t)-1) {
|
||||
av_log(NULL, AV_LOG_ERROR, "IO error: %s\n", strerror(errno));
|
||||
fclose(f);
|
||||
return AVERROR(errno);
|
||||
|
||||
ret = fseek(f, 0, SEEK_END);
|
||||
if (ret == -1) {
|
||||
ret = AVERROR(errno);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = ftell(f);
|
||||
if (ret < 0) {
|
||||
ret = AVERROR(errno);
|
||||
goto out;
|
||||
}
|
||||
*size = ret;
|
||||
|
||||
ret = fseek(f, 0, SEEK_SET);
|
||||
if (ret == -1) {
|
||||
ret = AVERROR(errno);
|
||||
goto out;
|
||||
}
|
||||
|
||||
*bufptr = av_malloc(*size + 1);
|
||||
if (!*bufptr) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Could not allocate file buffer\n");
|
||||
fclose(f);
|
||||
return AVERROR(ENOMEM);
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto out;
|
||||
}
|
||||
ret = fread(*bufptr, 1, *size, f);
|
||||
if (ret < *size) {
|
||||
@@ -1893,6 +1905,8 @@ int cmdutils_read_file(const char *filename, char **bufptr, size_t *size)
|
||||
(*bufptr)[(*size)++] = '\0';
|
||||
}
|
||||
|
||||
out:
|
||||
av_log(NULL, AV_LOG_ERROR, "IO error: %s\n", av_err2str(ret));
|
||||
fclose(f);
|
||||
return ret;
|
||||
}
|
||||
|
2
configure
vendored
2
configure
vendored
@@ -1620,7 +1620,6 @@ HEADERS_LIST="
|
||||
asm_types_h
|
||||
cdio_paranoia_h
|
||||
cdio_paranoia_paranoia_h
|
||||
CL_cl_h
|
||||
dev_bktr_ioctl_bt848_h
|
||||
dev_bktr_ioctl_meteor_h
|
||||
dev_ic_bt8xx_h
|
||||
@@ -4710,7 +4709,6 @@ check_func_headers glob.h glob
|
||||
enabled xlib &&
|
||||
check_func_headers "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext
|
||||
|
||||
check_header cl/cl.h
|
||||
check_header direct.h
|
||||
check_header dlfcn.h
|
||||
check_header dxva.h
|
||||
|
@@ -148,7 +148,7 @@ API changes, most recent first:
|
||||
Increase FF_INPUT_BUFFER_PADDING_SIZE to 32 due to some corner cases needing
|
||||
it
|
||||
|
||||
2014-06-10 - xxxxxxx - lavf 55.43.100 - avformat.h
|
||||
2014-06-10 - 5482780 - lavf 55.43.100 - avformat.h
|
||||
New field int64_t max_analyze_duration2 instead of deprecated
|
||||
int max_analyze_duration.
|
||||
|
||||
@@ -172,7 +172,7 @@ API changes, most recent first:
|
||||
Add strict_std_compliance and related AVOptions to support experimental
|
||||
muxing.
|
||||
|
||||
2014-05-26 - xxxxxxx - lavu 52.87.100 - threadmessage.h
|
||||
2014-05-26 - 55cc60c - lavu 52.87.100 - threadmessage.h
|
||||
Add thread message queue API.
|
||||
|
||||
2014-05-26 - c37d179 - lavf 55.41.100 - avformat.h
|
||||
@@ -182,7 +182,7 @@ API changes, most recent first:
|
||||
Add av_stream_get_side_data() to access stream-level side data
|
||||
in the same way as av_packet_get_side_data().
|
||||
|
||||
2014-05-xx - xxxxxxx - lavu 52.86.100 - fifo.h
|
||||
2014-05-20 - 7336e39 - lavu 52.86.100 - fifo.h
|
||||
Add av_fifo_alloc_array() function.
|
||||
|
||||
2014-05-19 - ef1d4ee / bddd8cb - lavu 52.85.100 / 53.15.0 - frame.h, display.h
|
||||
@@ -214,7 +214,7 @@ API changes, most recent first:
|
||||
2014-05-11 - 14aef38 / 66e6c8a - lavu 52.83.100 / 53.14.0 - pixfmt.h
|
||||
Add AV_PIX_FMT_VDA for new-style VDA acceleration.
|
||||
|
||||
2014-05-xx - xxxxxxx - lavu 52.82.100 - fifo.h
|
||||
2014-05-07 - 351f611 - lavu 52.82.100 - fifo.h
|
||||
Add av_fifo_freep() function.
|
||||
|
||||
2014-05-02 - ba52fb11 - lavu 52.81.100 - opt.h
|
||||
@@ -236,10 +236,14 @@ API changes, most recent first:
|
||||
Deprecate CODEC_FLAG_INPUT_PRESERVED. Its functionality is replaced by passing
|
||||
reference-counted frames to encoders.
|
||||
|
||||
2014-04-30 - 617e866 - lavu 52.81.100 - pixdesc.h
|
||||
Add av_find_best_pix_fmt_of_2(), av_get_pix_fmt_loss()
|
||||
Deprecate avcodec_get_pix_fmt_loss(), avcodec_find_best_pix_fmt_of_2()
|
||||
|
||||
2014-04-29 - 1bf6396 - lavc 55.60.100 - avcodec.h
|
||||
Add AVCodecDescriptor.mime_types field.
|
||||
|
||||
2014-04-29 - xxxxxxx - lavu 52.80.0 - hash.h
|
||||
2014-04-29 - b804eb4 - lavu 52.80.100 - hash.h
|
||||
Add av_hash_final_bin(), av_hash_final_hex() and av_hash_final_b64().
|
||||
|
||||
2014-03-07 - 8b2a130 - lavc 55.50.0 / 55.53.100 - dxva2.h
|
||||
@@ -251,7 +255,7 @@ API changes, most recent first:
|
||||
2014-04-17 - a8d01a7 / 0983d48 - lavu 53.12.0 / 52.77.100 - crc.h
|
||||
Add AV_CRC_16_ANSI_LE crc variant.
|
||||
|
||||
2014-04-XX - xxxxxxx - lavf xx.xx.1xx - avformat.h
|
||||
2014-04-15 - ef818d8 - lavf 55.37.101 - avformat.h
|
||||
Add av_format_inject_global_side_data()
|
||||
|
||||
2014-04-12 - 4f698be - lavu 52.76.100 - log.h
|
||||
@@ -331,7 +335,7 @@ API changes, most recent first:
|
||||
2014-02-19 - f4c8d00 / 6bb8720 - lavu 52.64.101 / 53.3.1 - opt.h
|
||||
Deprecate unused AV_OPT_FLAG_METADATA.
|
||||
|
||||
2014-02-xx - xxxxxxx - lavd 55.10.100 - avdevice.h
|
||||
2014-02-16 - 81c3f81 - lavd 55.10.100 - avdevice.h
|
||||
Add avdevice_list_devices() and avdevice_free_list_devices()
|
||||
|
||||
2014-02-16 - db3c970 - lavf 55.33.100 - avio.h
|
||||
@@ -372,7 +376,7 @@ API changes, most recent first:
|
||||
2014-01-19 - 1a193c4 - lavf 55.25.100 - avformat.h
|
||||
Add avformat_get_mov_video_tags() and avformat_get_mov_audio_tags().
|
||||
|
||||
2014-01-19 - xxxxxxx - lavu 52.63.100 - rational.h
|
||||
2014-01-19 - 3532dd5 - lavu 52.63.100 - rational.h
|
||||
Add av_make_q() function.
|
||||
|
||||
2014-01-05 - 4cf4da9 / 5b4797a - lavu 52.62.100 / 53.2.0 - frame.h
|
||||
|
@@ -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.6
|
||||
PROJECT_NUMBER = 2.4.7
|
||||
|
||||
# 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
|
||||
|
@@ -651,7 +651,7 @@ OBJS-$(CONFIG_VAAPI) += vaapi.o
|
||||
OBJS-$(CONFIG_VDA) += vda.o
|
||||
OBJS-$(CONFIG_VDPAU) += vdpau.o
|
||||
|
||||
OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o vaapi_mpeg.o
|
||||
OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o
|
||||
OBJS-$(CONFIG_H263_VDPAU_HWACCEL) += vdpau_mpeg4.o
|
||||
OBJS-$(CONFIG_H264_DXVA2_HWACCEL) += dxva2_h264.o
|
||||
OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o
|
||||
@@ -660,13 +660,13 @@ OBJS-$(CONFIG_H264_VDPAU_HWACCEL) += vdpau_h264.o
|
||||
OBJS-$(CONFIG_MPEG1_VDPAU_HWACCEL) += vdpau_mpeg12.o
|
||||
OBJS-$(CONFIG_MPEG1_XVMC_HWACCEL) += mpegvideo_xvmc.o
|
||||
OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL) += dxva2_mpeg2.o
|
||||
OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL) += vaapi_mpeg2.o vaapi_mpeg.o
|
||||
OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL) += vaapi_mpeg2.o
|
||||
OBJS-$(CONFIG_MPEG2_VDPAU_HWACCEL) += vdpau_mpeg12.o
|
||||
OBJS-$(CONFIG_MPEG2_XVMC_HWACCEL) += mpegvideo_xvmc.o
|
||||
OBJS-$(CONFIG_MPEG4_VAAPI_HWACCEL) += vaapi_mpeg4.o vaapi_mpeg.o
|
||||
OBJS-$(CONFIG_MPEG4_VAAPI_HWACCEL) += vaapi_mpeg4.o
|
||||
OBJS-$(CONFIG_MPEG4_VDPAU_HWACCEL) += vdpau_mpeg4.o
|
||||
OBJS-$(CONFIG_VC1_DXVA2_HWACCEL) += dxva2_vc1.o
|
||||
OBJS-$(CONFIG_VC1_VAAPI_HWACCEL) += vaapi_vc1.o vaapi_mpeg.o
|
||||
OBJS-$(CONFIG_VC1_VAAPI_HWACCEL) += vaapi_vc1.o
|
||||
OBJS-$(CONFIG_VC1_VDPAU_HWACCEL) += vdpau_vc1.o
|
||||
|
||||
# libavformat dependencies
|
||||
|
@@ -746,10 +746,10 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
|
||||
|
||||
s->chan_map = aac_chan_configs[s->channels-1];
|
||||
|
||||
if (ret = dsp_init(avctx, s))
|
||||
if ((ret = dsp_init(avctx, s)) < 0)
|
||||
goto fail;
|
||||
|
||||
if (ret = alloc_buffers(avctx, s))
|
||||
if ((ret = alloc_buffers(avctx, s)) < 0)
|
||||
goto fail;
|
||||
|
||||
avctx->extradata_size = 5;
|
||||
@@ -761,7 +761,8 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
|
||||
lengths[1] = ff_aac_num_swb_128[i];
|
||||
for (i = 0; i < s->chan_map[0]; i++)
|
||||
grouping[i] = s->chan_map[i + 1] == TYPE_CPE;
|
||||
if (ret = ff_psy_init(&s->psy, avctx, 2, sizes, lengths, s->chan_map[0], grouping))
|
||||
if ((ret = ff_psy_init(&s->psy, avctx, 2, sizes, lengths,
|
||||
s->chan_map[0], grouping)) < 0)
|
||||
goto fail;
|
||||
s->psypp = ff_psy_preprocess_init(avctx);
|
||||
s->coder = &ff_aac_coders[s->options.aac_coder];
|
||||
|
@@ -556,7 +556,8 @@ static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
|
||||
k = sbr->n_master;
|
||||
} while (sb != sbr->kx[1] + sbr->m[1]);
|
||||
|
||||
if (sbr->num_patches > 1 && sbr->patch_num_subbands[sbr->num_patches-1] < 3)
|
||||
if (sbr->num_patches > 1 &&
|
||||
sbr->patch_num_subbands[sbr->num_patches - 1] < 3)
|
||||
sbr->num_patches--;
|
||||
|
||||
return 0;
|
||||
|
@@ -78,6 +78,7 @@ av_cold void ff_h264dsp_init_aarch64(H264DSPContext *c, const int bit_depth,
|
||||
c->h264_v_loop_filter_luma = ff_h264_v_loop_filter_luma_neon;
|
||||
c->h264_h_loop_filter_luma = ff_h264_h_loop_filter_luma_neon;
|
||||
c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon;
|
||||
if (chroma_format_idc <= 1)
|
||||
c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon;
|
||||
|
||||
c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16_neon;
|
||||
|
@@ -90,9 +90,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
s->fg = DEFAULT_FG_COLOR;
|
||||
s->bg = DEFAULT_BG_COLOR;
|
||||
|
||||
if (!avctx->width || !avctx->height)
|
||||
ff_set_dimensions(avctx, 80 << 3, 25 << 4);
|
||||
|
||||
if (!avctx->width || !avctx->height) {
|
||||
int ret = ff_set_dimensions(avctx, 80 << 3, 25 << 4);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -23,9 +23,10 @@
|
||||
#include "libavutil/arm/asm.S"
|
||||
|
||||
function ff_prefetch_arm, export=1
|
||||
1:
|
||||
subs r2, r2, #1
|
||||
pld [r0]
|
||||
add r0, r0, r1
|
||||
bne X(ff_prefetch_arm)
|
||||
bne 1b
|
||||
bx lr
|
||||
endfunc
|
||||
|
@@ -165,9 +165,8 @@ static av_cold int avs_decode_init(AVCodecContext * avctx)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
avctx->pix_fmt = AV_PIX_FMT_PAL8;
|
||||
ff_set_dimensions(avctx, 318, 198);
|
||||
|
||||
return 0;
|
||||
return ff_set_dimensions(avctx, 318, 198);
|
||||
}
|
||||
|
||||
static av_cold int avs_decode_end(AVCodecContext *avctx)
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "golomb.h"
|
||||
#include "h264chroma.h"
|
||||
#include "idctdsp.h"
|
||||
#include "internal.h"
|
||||
#include "mathops.h"
|
||||
#include "qpeldsp.h"
|
||||
#include "cavs.h"
|
||||
@@ -539,8 +540,8 @@ static inline void scale_mv(AVSContext *h, int *d_x, int *d_y,
|
||||
{
|
||||
int den = h->scale_den[FFMAX(src->ref, 0)];
|
||||
|
||||
*d_x = (src->x * distp * den + 256 + (src->x >> 31)) >> 9;
|
||||
*d_y = (src->y * distp * den + 256 + (src->y >> 31)) >> 9;
|
||||
*d_x = (src->x * distp * den + 256 + FF_SIGNBIT(src->x)) >> 9;
|
||||
*d_y = (src->y * distp * den + 256 + FF_SIGNBIT(src->y)) >> 9;
|
||||
}
|
||||
|
||||
static inline void mv_pred_median(AVSContext *h,
|
||||
|
@@ -467,7 +467,7 @@ static inline void mv_pred_direct(AVSContext *h, cavs_vector *pmv_fw,
|
||||
{
|
||||
cavs_vector *pmv_bw = pmv_fw + MV_BWD_OFFS;
|
||||
int den = h->direct_den[col_mv->ref];
|
||||
int m = col_mv->x >> 31;
|
||||
int m = FF_SIGNBIT(col_mv->x);
|
||||
|
||||
pmv_fw->dist = h->dist[1];
|
||||
pmv_bw->dist = h->dist[0];
|
||||
@@ -476,7 +476,7 @@ static inline void mv_pred_direct(AVSContext *h, cavs_vector *pmv_fw,
|
||||
/* scale the co-located motion vector according to its temporal span */
|
||||
pmv_fw->x = (((den + (den * col_mv->x * pmv_fw->dist ^ m) - m - 1) >> 14) ^ m) - m;
|
||||
pmv_bw->x = m - (((den + (den * col_mv->x * pmv_bw->dist ^ m) - m - 1) >> 14) ^ m);
|
||||
m = col_mv->y >> 31;
|
||||
m = FF_SIGNBIT(col_mv->y);
|
||||
pmv_fw->y = (((den + (den * col_mv->y * pmv_fw->dist ^ m) - m - 1) >> 14) ^ m) - m;
|
||||
pmv_bw->y = m - (((den + (den * col_mv->y * pmv_bw->dist ^ m) - m - 1) >> 14) ^ m);
|
||||
}
|
||||
|
@@ -1058,7 +1058,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
|
||||
q->avctx = avctx;
|
||||
|
||||
/* Take care of the codec specific extradata. */
|
||||
if (extradata_size <= 0) {
|
||||
if (extradata_size < 8) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Necessary extradata missing!\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
@@ -117,7 +117,7 @@ static int dnxhd_10bit_dct_quantize(MpegEncContext *ctx, int16_t *block,
|
||||
|
||||
for (i = 1; i < 64; ++i) {
|
||||
int j = scantable[i];
|
||||
int sign = block[j] >> 31;
|
||||
int sign = FF_SIGNBIT(block[j]);
|
||||
int level = (block[j] ^ sign) - sign;
|
||||
level = level * qmat[j] >> DNX10BIT_QMAT_SHIFT;
|
||||
block[j] = (level ^ sign) - sign;
|
||||
|
@@ -586,6 +586,7 @@ static int dvdsub_parse_extradata(AVCodecContext *avctx)
|
||||
{
|
||||
DVDSubContext *ctx = (DVDSubContext*) avctx->priv_data;
|
||||
char *dataorig, *data;
|
||||
int ret = 1;
|
||||
|
||||
if (!avctx->extradata || !avctx->extradata_size)
|
||||
return 1;
|
||||
@@ -606,11 +607,9 @@ static int dvdsub_parse_extradata(AVCodecContext *avctx)
|
||||
} else if (strncmp("size:", data, 5) == 0) {
|
||||
int w, h;
|
||||
if (sscanf(data + 5, "%dx%d", &w, &h) == 2) {
|
||||
int ret = ff_set_dimensions(avctx, w, h);
|
||||
if (ret < 0) {
|
||||
av_free(dataorig);
|
||||
return ret;
|
||||
}
|
||||
ret = ff_set_dimensions(avctx, w, h);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -618,8 +617,9 @@ static int dvdsub_parse_extradata(AVCodecContext *avctx)
|
||||
data += strspn(data, "\n\r");
|
||||
}
|
||||
|
||||
fail:
|
||||
av_free(dataorig);
|
||||
return 1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static av_cold int dvdsub_init(AVCodecContext *avctx)
|
||||
|
@@ -65,7 +65,7 @@ static int dxtory_decode_v1_410(AVCodecContext *avctx, AVFrame *pic,
|
||||
uint8_t *Y1, *Y2, *Y3, *Y4, *U, *V;
|
||||
int ret;
|
||||
|
||||
if (src_size < avctx->width * avctx->height * 9L / 8) {
|
||||
if (src_size < avctx->width * avctx->height * 9LL / 8) {
|
||||
av_log(avctx, AV_LOG_ERROR, "packet too small\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ static int dxtory_decode_v1_420(AVCodecContext *avctx, AVFrame *pic,
|
||||
uint8_t *Y1, *Y2, *U, *V;
|
||||
int ret;
|
||||
|
||||
if (src_size < avctx->width * avctx->height * 3L / 2) {
|
||||
if (src_size < avctx->width * avctx->height * 3LL / 2) {
|
||||
av_log(avctx, AV_LOG_ERROR, "packet too small\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ static int dxtory_decode_v1_444(AVCodecContext *avctx, AVFrame *pic,
|
||||
uint8_t *Y, *U, *V;
|
||||
int ret;
|
||||
|
||||
if (src_size < avctx->width * avctx->height * 3L) {
|
||||
if (src_size < avctx->width * avctx->height * 3LL) {
|
||||
av_log(avctx, AV_LOG_ERROR, "packet too small\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
@@ -166,7 +166,7 @@ static void find_best_state(uint8_t best_state[256][256],
|
||||
best_len[k] = len;
|
||||
best_state[i][k] = j;
|
||||
}
|
||||
for (m = 0; m < 256; m++)
|
||||
for (m = 1; m < 256; m++)
|
||||
if (occ[m]) {
|
||||
newocc[ one_state[ m]] += occ[m] * p;
|
||||
newocc[256 - one_state[256 - m]] += occ[m] * (1 - p);
|
||||
|
@@ -697,7 +697,7 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||
handle_error:
|
||||
*poutbuf = NULL;
|
||||
*poutbuf_size = 0;
|
||||
return read_end - buf;
|
||||
return buf_size ? read_end - buf : 0;
|
||||
}
|
||||
|
||||
static av_cold int flac_parse_init(AVCodecParserContext *c)
|
||||
|
@@ -878,7 +878,7 @@ static void decode_postinit(H264Context *h, int setup_finished)
|
||||
if (rotation) {
|
||||
av_display_rotation_set((int32_t *)rotation->data, angle);
|
||||
av_display_matrix_flip((int32_t *)rotation->data,
|
||||
h->sei_vflip, h->sei_hflip);
|
||||
h->sei_hflip, h->sei_vflip);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1515,8 +1515,8 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size,
|
||||
continue;
|
||||
|
||||
again:
|
||||
if ( !(avctx->active_thread_type & FF_THREAD_FRAME)
|
||||
|| nals_needed >= nal_index)
|
||||
if ( (!(avctx->active_thread_type & FF_THREAD_FRAME) || nals_needed >= nal_index)
|
||||
&& !h->current_slice)
|
||||
h->au_pps_id = -1;
|
||||
/* Ignore per frame NAL unit type during extradata
|
||||
* parsing. Decoding slices is not possible in codec init
|
||||
|
@@ -1281,7 +1281,7 @@ void ff_h264_init_cabac_states(H264Context *h) {
|
||||
}
|
||||
|
||||
static int decode_cabac_field_decoding_flag(H264Context *h) {
|
||||
const long mbb_xy = h->mb_xy - 2L*h->mb_stride;
|
||||
const int mbb_xy = h->mb_xy - 2*h->mb_stride;
|
||||
|
||||
unsigned long ctx = 0;
|
||||
|
||||
|
@@ -391,7 +391,8 @@ int ff_h264_decode_seq_parameter_set(H264Context *h)
|
||||
"Different chroma and luma bit depth");
|
||||
goto fail;
|
||||
}
|
||||
if (sps->bit_depth_luma > 14U || sps->bit_depth_chroma > 14U) {
|
||||
if (sps->bit_depth_luma < 8 || sps->bit_depth_luma > 14 ||
|
||||
sps->bit_depth_chroma < 8 || sps->bit_depth_chroma > 14) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "illegal bit depth value (%d, %d)\n",
|
||||
sps->bit_depth_luma, sps->bit_depth_chroma);
|
||||
goto fail;
|
||||
|
@@ -1305,6 +1305,9 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
||||
int must_reinit;
|
||||
int needs_reinit = 0;
|
||||
int field_pic_flag, bottom_field_flag;
|
||||
int first_slice = h == h0 && !h0->current_slice;
|
||||
int frame_num, picture_structure, droppable;
|
||||
PPS *pps;
|
||||
|
||||
h->qpel_put = h->h264qpel.put_h264_qpel_pixels_tab;
|
||||
h->qpel_avg = h->h264qpel.avg_h264_qpel_pixels_tab;
|
||||
@@ -1378,18 +1381,27 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
||||
h0->au_pps_id, pps_id);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
h->pps = *h0->pps_buffers[pps_id];
|
||||
|
||||
if (!h0->sps_buffers[h->pps.sps_id]) {
|
||||
pps = h0->pps_buffers[pps_id];
|
||||
|
||||
if (!h0->sps_buffers[pps->sps_id]) {
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"non-existing SPS %u referenced\n",
|
||||
h->pps.sps_id);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (first_slice)
|
||||
h->pps = *h0->pps_buffers[pps_id];
|
||||
|
||||
if (h->pps.sps_id != h->sps.sps_id ||
|
||||
h->pps.sps_id != h->current_sps_id ||
|
||||
h0->sps_buffers[h->pps.sps_id]->new) {
|
||||
if (pps->sps_id != h->sps.sps_id ||
|
||||
pps->sps_id != h->current_sps_id ||
|
||||
h0->sps_buffers[pps->sps_id]->new) {
|
||||
|
||||
if (!first_slice) {
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"SPS changed in the middle of the frame\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
h->sps = *h0->sps_buffers[h->pps.sps_id];
|
||||
|
||||
@@ -1419,13 +1431,15 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
||||
|| 16*h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag) != h->avctx->coded_height
|
||||
|| h->avctx->bits_per_raw_sample != h->sps.bit_depth_luma
|
||||
|| h->cur_chroma_format_idc != h->sps.chroma_format_idc
|
||||
|| av_cmp_q(h->sps.sar, h->avctx->sample_aspect_ratio)
|
||||
|| h->mb_width != h->sps.mb_width
|
||||
|| h->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag)
|
||||
));
|
||||
if (non_j_pixfmt(h0->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h0, 0)))
|
||||
must_reinit = 1;
|
||||
|
||||
if (first_slice && av_cmp_q(h->sps.sar, h->avctx->sample_aspect_ratio))
|
||||
must_reinit = 1;
|
||||
|
||||
h->mb_width = h->sps.mb_width;
|
||||
h->mb_height = h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag);
|
||||
h->mb_num = h->mb_width * h->mb_height;
|
||||
@@ -1466,6 +1480,8 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
av_assert1(first_slice);
|
||||
|
||||
ff_h264_flush_change(h);
|
||||
|
||||
if ((ret = get_pixel_format(h, 1)) < 0)
|
||||
@@ -1504,39 +1520,43 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
||||
h264_init_dequant_tables(h);
|
||||
}
|
||||
|
||||
h->frame_num = get_bits(&h->gb, h->sps.log2_max_frame_num);
|
||||
frame_num = get_bits(&h->gb, h->sps.log2_max_frame_num);
|
||||
if (!first_slice) {
|
||||
if (h0->frame_num != frame_num) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "Frame num change from %d to %d\n",
|
||||
h0->frame_num, frame_num);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
||||
h->mb_mbaff = 0;
|
||||
h->mb_aff_frame = 0;
|
||||
last_pic_structure = h0->picture_structure;
|
||||
last_pic_droppable = h0->droppable;
|
||||
h->droppable = h->nal_ref_idc == 0;
|
||||
droppable = h->nal_ref_idc == 0;
|
||||
if (h->sps.frame_mbs_only_flag) {
|
||||
h->picture_structure = PICT_FRAME;
|
||||
picture_structure = PICT_FRAME;
|
||||
} else {
|
||||
if (!h->sps.direct_8x8_inference_flag && slice_type == AV_PICTURE_TYPE_B) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "This stream was generated by a broken encoder, invalid 8x8 inference\n");
|
||||
return -1;
|
||||
}
|
||||
field_pic_flag = get_bits1(&h->gb);
|
||||
|
||||
if (field_pic_flag) {
|
||||
bottom_field_flag = get_bits1(&h->gb);
|
||||
h->picture_structure = PICT_TOP_FIELD + bottom_field_flag;
|
||||
picture_structure = PICT_TOP_FIELD + bottom_field_flag;
|
||||
} else {
|
||||
h->picture_structure = PICT_FRAME;
|
||||
picture_structure = PICT_FRAME;
|
||||
h->mb_aff_frame = h->sps.mb_aff;
|
||||
}
|
||||
}
|
||||
h->mb_field_decoding_flag = h->picture_structure != PICT_FRAME;
|
||||
|
||||
if (h0->current_slice != 0) {
|
||||
if (last_pic_structure != h->picture_structure ||
|
||||
last_pic_droppable != h->droppable) {
|
||||
if (h0->current_slice) {
|
||||
if (last_pic_structure != picture_structure ||
|
||||
last_pic_droppable != droppable) {
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"Changing field mode (%d -> %d) between slices is not allowed\n",
|
||||
last_pic_structure, h->picture_structure);
|
||||
h->picture_structure = last_pic_structure;
|
||||
h->droppable = last_pic_droppable;
|
||||
return AVERROR_INVALIDDATA;
|
||||
} else if (!h0->cur_pic_ptr) {
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
@@ -1544,7 +1564,14 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
||||
h0->current_slice + 1);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
h->picture_structure = picture_structure;
|
||||
h->droppable = droppable;
|
||||
h->frame_num = frame_num;
|
||||
h->mb_field_decoding_flag = picture_structure != PICT_FRAME;
|
||||
|
||||
if (h0->current_slice == 0) {
|
||||
/* Shorten frame num gaps so we don't have to allocate reference
|
||||
* frames just to throw them away */
|
||||
if (h->frame_num != h->prev_frame_num) {
|
||||
|
@@ -144,7 +144,7 @@ static void pred_weight_table(HEVCContext *s, GetBitContext *gb)
|
||||
uint8_t luma_weight_l1_flag[16];
|
||||
uint8_t chroma_weight_l1_flag[16];
|
||||
|
||||
s->sh.luma_log2_weight_denom = get_ue_golomb_long(gb);
|
||||
s->sh.luma_log2_weight_denom = av_clip_c(get_ue_golomb_long(gb), 0, 7);
|
||||
if (s->sps->chroma_format_idc != 0) {
|
||||
int delta = get_se_golomb(gb);
|
||||
s->sh.chroma_log2_weight_denom = av_clip(s->sh.luma_log2_weight_denom + delta, 0, 7);
|
||||
@@ -2532,7 +2532,7 @@ static int set_side_data(HEVCContext *s)
|
||||
|
||||
av_display_rotation_set((int32_t *)rotation->data, angle);
|
||||
av_display_matrix_flip((int32_t *)rotation->data,
|
||||
s->sei_vflip, s->sei_hflip);
|
||||
s->sei_hflip, s->sei_vflip);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -2888,17 +2888,30 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
|
||||
|
||||
if (s->nals_allocated < s->nb_nals + 1) {
|
||||
int new_size = s->nals_allocated + 1;
|
||||
HEVCNAL *tmp = av_realloc_array(s->nals, new_size, sizeof(*tmp));
|
||||
void *tmp = av_realloc_array(s->nals, new_size, sizeof(*s->nals));
|
||||
ret = AVERROR(ENOMEM);
|
||||
if (!tmp) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
s->nals = tmp;
|
||||
memset(s->nals + s->nals_allocated, 0,
|
||||
(new_size - s->nals_allocated) * sizeof(*tmp));
|
||||
av_reallocp_array(&s->skipped_bytes_nal, new_size, sizeof(*s->skipped_bytes_nal));
|
||||
av_reallocp_array(&s->skipped_bytes_pos_size_nal, new_size, sizeof(*s->skipped_bytes_pos_size_nal));
|
||||
av_reallocp_array(&s->skipped_bytes_pos_nal, new_size, sizeof(*s->skipped_bytes_pos_nal));
|
||||
(new_size - s->nals_allocated) * sizeof(*s->nals));
|
||||
|
||||
tmp = av_realloc_array(s->skipped_bytes_nal, new_size, sizeof(*s->skipped_bytes_nal));
|
||||
if (!tmp)
|
||||
goto fail;
|
||||
s->skipped_bytes_nal = tmp;
|
||||
|
||||
tmp = av_realloc_array(s->skipped_bytes_pos_size_nal, new_size, sizeof(*s->skipped_bytes_pos_size_nal));
|
||||
if (!tmp)
|
||||
goto fail;
|
||||
s->skipped_bytes_pos_size_nal = tmp;
|
||||
|
||||
tmp = av_realloc_array(s->skipped_bytes_pos_nal, new_size, sizeof(*s->skipped_bytes_pos_nal));
|
||||
if (!tmp)
|
||||
goto fail;
|
||||
s->skipped_bytes_pos_nal = tmp;
|
||||
|
||||
s->skipped_bytes_pos_size_nal[s->nals_allocated] = 1024; // initial buffer size
|
||||
s->skipped_bytes_pos_nal[s->nals_allocated] = av_malloc_array(s->skipped_bytes_pos_size_nal[s->nals_allocated], sizeof(*s->skipped_bytes_pos));
|
||||
s->nals_allocated = new_size;
|
||||
|
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/internal.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/mem.h"
|
||||
@@ -453,6 +454,7 @@ static int hnm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
static av_cold int hnm_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
Hnm4VideoContext *hnm = avctx->priv_data;
|
||||
int ret;
|
||||
|
||||
if (avctx->extradata_size < 1) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
@@ -460,6 +462,10 @@ static av_cold int hnm_decode_init(AVCodecContext *avctx)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
hnm->version = avctx->extradata[0];
|
||||
avctx->pix_fmt = AV_PIX_FMT_PAL8;
|
||||
hnm->width = avctx->width;
|
||||
|
@@ -35,6 +35,8 @@
|
||||
|
||||
#define FF_SANE_NB_CHANNELS 63U
|
||||
|
||||
#define FF_SIGNBIT(x) (x >> CHAR_BIT * sizeof(x) - 1)
|
||||
|
||||
#if HAVE_AVX
|
||||
# define STRIDE_ALIGN 32
|
||||
#elif HAVE_SIMD_ALIGN_16
|
||||
|
@@ -170,10 +170,11 @@ static av_cold int libopus_encode_init(AVCodecContext *avctx)
|
||||
|
||||
/* FIXME: Opus can handle up to 255 channels. However, the mapping for
|
||||
* anything greater than 8 is undefined. */
|
||||
if (avctx->channels > 8)
|
||||
av_log(avctx, AV_LOG_WARNING,
|
||||
if (avctx->channels > 8) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Channel layout undefined for %d channels.\n", avctx->channels);
|
||||
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
if (!avctx->bit_rate) {
|
||||
/* Sane default copied from opusenc */
|
||||
avctx->bit_rate = 64000 * opus->stream_count +
|
||||
|
@@ -152,8 +152,8 @@ static int twolame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
if (ret < 0) // twolame error
|
||||
return AVERROR_UNKNOWN;
|
||||
|
||||
avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples);
|
||||
if (frame) {
|
||||
avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples);
|
||||
if (frame->pts != AV_NOPTS_VALUE)
|
||||
avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay);
|
||||
} else {
|
||||
|
@@ -536,9 +536,12 @@ unk_pixfmt:
|
||||
}
|
||||
if (s->ls) {
|
||||
s->upscale_h = s->upscale_v = 0;
|
||||
if (s->nb_components > 1)
|
||||
if (s->nb_components == 3) {
|
||||
s->avctx->pix_fmt = AV_PIX_FMT_RGB24;
|
||||
else if (s->palette_index && s->bits <= 8)
|
||||
} else if (s->nb_components != 1) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Unsupported number of components %d\n", s->nb_components);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
} else if (s->palette_index && s->bits <= 8)
|
||||
s->avctx->pix_fmt = AV_PIX_FMT_PAL8;
|
||||
else if (s->bits <= 8)
|
||||
s->avctx->pix_fmt = AV_PIX_FMT_GRAY8;
|
||||
@@ -1223,13 +1226,18 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
|
||||
|
||||
if (s->interlaced && s->bottom_field)
|
||||
block_offset += linesize[c] >> 1;
|
||||
ptr = data[c] + block_offset;
|
||||
if ( 8*(h * mb_x + x) < s->width
|
||||
&& 8*(v * mb_y + y) < s->height) {
|
||||
ptr = data[c] + block_offset;
|
||||
} else
|
||||
ptr = NULL;
|
||||
if (!s->progressive) {
|
||||
if (copy_mb)
|
||||
mjpeg_copy_block(s, ptr, reference_data[c] + block_offset,
|
||||
linesize[c], s->avctx->lowres);
|
||||
if (copy_mb) {
|
||||
if (ptr)
|
||||
mjpeg_copy_block(s, ptr, reference_data[c] + block_offset,
|
||||
linesize[c], s->avctx->lowres);
|
||||
|
||||
else {
|
||||
} else {
|
||||
s->bdsp.clear_block(s->block);
|
||||
if (decode_block(s, s->block, i,
|
||||
s->dc_index[i], s->ac_index[i],
|
||||
@@ -1238,9 +1246,11 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
|
||||
"error y=%d x=%d\n", mb_y, mb_x);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->idsp.idct_put(ptr, linesize[c], s->block);
|
||||
if (s->bits & 7)
|
||||
shift_output(s, ptr, linesize[c]);
|
||||
if (ptr) {
|
||||
s->idsp.idct_put(ptr, linesize[c], s->block);
|
||||
if (s->bits & 7)
|
||||
shift_output(s, ptr, linesize[c]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int block_idx = s->block_stride[c] * (v * mb_y + y) +
|
||||
@@ -1877,6 +1887,10 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
|
||||
put_bits(&pb, 8, x);
|
||||
if (x == 0xFF) {
|
||||
x = src[b++];
|
||||
if (x & 0x80) {
|
||||
av_log(s->avctx, AV_LOG_WARNING, "Invalid escape sequence\n");
|
||||
x &= 0x7f;
|
||||
}
|
||||
put_bits(&pb, 7, x);
|
||||
bit_count--;
|
||||
}
|
||||
|
@@ -82,10 +82,15 @@ int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf,
|
||||
int bit_size, int sync_extension)
|
||||
{
|
||||
GetBitContext gb;
|
||||
int specific_config_bitindex;
|
||||
int specific_config_bitindex, ret;
|
||||
|
||||
if (bit_size <= 0 || init_get_bits(&gb, buf, bit_size) < 0)
|
||||
if (bit_size <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
ret = init_get_bits(&gb, buf, bit_size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
c->object_type = get_object_type(&gb);
|
||||
c->sample_rate = get_sample_rate(&gb, &c->sampling_index);
|
||||
c->chan_config = get_bits(&gb, 4);
|
||||
|
@@ -389,18 +389,18 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
|
||||
switch(avctx->codec_id) {
|
||||
case AV_CODEC_ID_MPEG1VIDEO:
|
||||
case AV_CODEC_ID_MPEG2VIDEO:
|
||||
avctx->rc_buffer_size = FFMAX(avctx->rc_max_rate, 15000000) * 112L / 15000000 * 16384;
|
||||
avctx->rc_buffer_size = FFMAX(avctx->rc_max_rate, 15000000) * 112LL / 15000000 * 16384;
|
||||
break;
|
||||
case AV_CODEC_ID_MPEG4:
|
||||
case AV_CODEC_ID_MSMPEG4V1:
|
||||
case AV_CODEC_ID_MSMPEG4V2:
|
||||
case AV_CODEC_ID_MSMPEG4V3:
|
||||
if (avctx->rc_max_rate >= 15000000) {
|
||||
avctx->rc_buffer_size = 320 + (avctx->rc_max_rate - 15000000L) * (760-320) / (38400000 - 15000000);
|
||||
avctx->rc_buffer_size = 320 + (avctx->rc_max_rate - 15000000LL) * (760-320) / (38400000 - 15000000);
|
||||
} else if(avctx->rc_max_rate >= 2000000) {
|
||||
avctx->rc_buffer_size = 80 + (avctx->rc_max_rate - 2000000L) * (320- 80) / (15000000 - 2000000);
|
||||
avctx->rc_buffer_size = 80 + (avctx->rc_max_rate - 2000000LL) * (320- 80) / (15000000 - 2000000);
|
||||
} else if(avctx->rc_max_rate >= 384000) {
|
||||
avctx->rc_buffer_size = 40 + (avctx->rc_max_rate - 384000L) * ( 80- 40) / ( 2000000 - 384000);
|
||||
avctx->rc_buffer_size = 40 + (avctx->rc_max_rate - 384000LL) * ( 80- 40) / ( 2000000 - 384000);
|
||||
} else
|
||||
avctx->rc_buffer_size = 40;
|
||||
avctx->rc_buffer_size *= 16384;
|
||||
|
@@ -178,7 +178,7 @@ static void gmc_motion(MpegEncContext *s,
|
||||
s->sprite_delta[0][0], s->sprite_delta[0][1],
|
||||
s->sprite_delta[1][0], s->sprite_delta[1][1],
|
||||
a + 1, (1 << (2 * a + 1)) - s->no_rounding,
|
||||
s->h_edge_pos >> 1, s->v_edge_pos >> 1);
|
||||
(s->h_edge_pos + 1) >> 1, (s->v_edge_pos + 1) >> 1);
|
||||
|
||||
ptr = ref_picture[2];
|
||||
s->mdsp.gmc(dest_cr, ptr, uvlinesize, 8,
|
||||
@@ -186,7 +186,7 @@ static void gmc_motion(MpegEncContext *s,
|
||||
s->sprite_delta[0][0], s->sprite_delta[0][1],
|
||||
s->sprite_delta[1][0], s->sprite_delta[1][1],
|
||||
a + 1, (1 << (2 * a + 1)) - s->no_rounding,
|
||||
s->h_edge_pos >> 1, s->v_edge_pos >> 1);
|
||||
(s->h_edge_pos + 1) >> 1, (s->v_edge_pos + 1) >> 1);
|
||||
}
|
||||
|
||||
static inline int hpel_motion(MpegEncContext *s,
|
||||
|
@@ -824,10 +824,9 @@ static int find_slice_quant(AVCodecContext *avctx, const AVFrame *pic,
|
||||
if (ctx->alpha_bits)
|
||||
bits += estimate_alpha_plane(ctx, &error, src, linesize[3],
|
||||
mbs_per_slice, q, td->blocks[3]);
|
||||
if (bits > 65000 * 8) {
|
||||
if (bits > 65000 * 8)
|
||||
error = SCORE_LIMIT;
|
||||
break;
|
||||
}
|
||||
|
||||
slice_bits[q] = bits;
|
||||
slice_score[q] = error;
|
||||
}
|
||||
|
@@ -120,12 +120,13 @@ static void av_noinline qpeg_decode_inter(QpegContext *qctx, uint8_t *dst,
|
||||
int filled = 0;
|
||||
int orig_height;
|
||||
|
||||
if(!refdata)
|
||||
refdata= dst;
|
||||
|
||||
/* copy prev frame */
|
||||
for(i = 0; i < height; i++)
|
||||
memcpy(dst + (i * stride), refdata + (i * stride), width);
|
||||
if (refdata) {
|
||||
/* copy prev frame */
|
||||
for (i = 0; i < height; i++)
|
||||
memcpy(dst + (i * stride), refdata + (i * stride), width);
|
||||
} else {
|
||||
refdata = dst;
|
||||
}
|
||||
|
||||
orig_height = height;
|
||||
height--;
|
||||
|
@@ -148,9 +148,8 @@ static int roq_dpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (context->input_frames < 8) {
|
||||
if (context->input_frames < 8)
|
||||
in = context->frame_buffer;
|
||||
}
|
||||
|
||||
if (stereo) {
|
||||
context->lastSample[0] &= 0xFF00;
|
||||
|
@@ -636,8 +636,9 @@ static int svq1_decode_frame(AVCodecContext *avctx, void *data,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
av_fast_padded_malloc(&s->pkt_swapped, &s->pkt_swapped_allocated,
|
||||
buf_size);
|
||||
av_fast_padded_malloc(&s->pkt_swapped,
|
||||
&s->pkt_swapped_allocated,
|
||||
buf_size);
|
||||
if (!s->pkt_swapped)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
|
@@ -123,8 +123,8 @@ static void tnput(uint8_t **p, int n, const uint8_t *val, enum TiffTypes type,
|
||||
* @param count the number of values
|
||||
* @param ptr_val pointer to values
|
||||
*/
|
||||
static void add_entry(TiffEncoderContext *s, enum TiffTags tag,
|
||||
enum TiffTypes type, int count, const void *ptr_val)
|
||||
static int add_entry(TiffEncoderContext *s, enum TiffTags tag,
|
||||
enum TiffTypes type, int count, const void *ptr_val)
|
||||
{
|
||||
uint8_t *entries_ptr = s->entries + 12 * s->num_entries;
|
||||
|
||||
@@ -138,19 +138,22 @@ static void add_entry(TiffEncoderContext *s, enum TiffTags tag,
|
||||
tnput(&entries_ptr, count, ptr_val, type, 0);
|
||||
} else {
|
||||
bytestream_put_le32(&entries_ptr, *s->buf - s->buf_start);
|
||||
check_size(s, count * (int64_t)type_sizes2[type]);
|
||||
if (check_size(s, count * (int64_t)type_sizes2[type]))
|
||||
return AVERROR_INVALIDDATA;
|
||||
tnput(s->buf, count, ptr_val, type, 0);
|
||||
}
|
||||
|
||||
s->num_entries++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void add_entry1(TiffEncoderContext *s,
|
||||
enum TiffTags tag, enum TiffTypes type, int val)
|
||||
static int add_entry1(TiffEncoderContext *s,
|
||||
enum TiffTags tag, enum TiffTypes type, int val)
|
||||
{
|
||||
uint16_t w = val;
|
||||
uint32_t dw = val;
|
||||
add_entry(s, tag, type, 1, type == TIFF_SHORT ? (void *)&w : (void *)&dw);
|
||||
return add_entry(s, tag, type, 1,
|
||||
type == TIFF_SHORT ? (void *)&w : (void *)&dw);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -222,6 +225,20 @@ static void pack_yuv(TiffEncoderContext *s, const AVFrame *p,
|
||||
}
|
||||
}
|
||||
|
||||
#define ADD_ENTRY(s, tag, type, count, ptr_val) \
|
||||
do { \
|
||||
ret = add_entry(s, tag, type, count, ptr_val); \
|
||||
if (ret < 0) \
|
||||
goto fail; \
|
||||
} while(0);
|
||||
|
||||
#define ADD_ENTRY1(s, tag, type, val) \
|
||||
do { \
|
||||
ret = add_entry1(s, tag, type, val); \
|
||||
if (ret < 0) \
|
||||
goto fail; \
|
||||
} while(0);
|
||||
|
||||
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
const AVFrame *pict, int *got_packet)
|
||||
{
|
||||
@@ -235,7 +252,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
int bytes_per_row;
|
||||
uint32_t res[2] = { s->dpi, 1 }; // image resolution (72/1)
|
||||
uint16_t bpp_tab[4];
|
||||
int ret = -1;
|
||||
int ret = 0;
|
||||
int is_yuv = 0, alpha = 0;
|
||||
int shift_h, shift_v;
|
||||
int packet_size;
|
||||
@@ -421,23 +438,23 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
|
||||
s->num_entries = 0;
|
||||
|
||||
add_entry1(s, TIFF_SUBFILE, TIFF_LONG, 0);
|
||||
add_entry1(s, TIFF_WIDTH, TIFF_LONG, s->width);
|
||||
add_entry1(s, TIFF_HEIGHT, TIFF_LONG, s->height);
|
||||
ADD_ENTRY1(s, TIFF_SUBFILE, TIFF_LONG, 0);
|
||||
ADD_ENTRY1(s, TIFF_WIDTH, TIFF_LONG, s->width);
|
||||
ADD_ENTRY1(s, TIFF_HEIGHT, TIFF_LONG, s->height);
|
||||
|
||||
if (s->bpp_tab_size)
|
||||
add_entry(s, TIFF_BPP, TIFF_SHORT, s->bpp_tab_size, bpp_tab);
|
||||
ADD_ENTRY(s, TIFF_BPP, TIFF_SHORT, s->bpp_tab_size, bpp_tab);
|
||||
|
||||
add_entry1(s, TIFF_COMPR, TIFF_SHORT, s->compr);
|
||||
add_entry1(s, TIFF_PHOTOMETRIC, TIFF_SHORT, s->photometric_interpretation);
|
||||
add_entry(s, TIFF_STRIP_OFFS, TIFF_LONG, strips, s->strip_offsets);
|
||||
ADD_ENTRY1(s, TIFF_COMPR, TIFF_SHORT, s->compr);
|
||||
ADD_ENTRY1(s, TIFF_PHOTOMETRIC, TIFF_SHORT, s->photometric_interpretation);
|
||||
ADD_ENTRY(s, TIFF_STRIP_OFFS, TIFF_LONG, strips, s->strip_offsets);
|
||||
|
||||
if (s->bpp_tab_size)
|
||||
add_entry1(s, TIFF_SAMPLES_PER_PIXEL, TIFF_SHORT, s->bpp_tab_size);
|
||||
ADD_ENTRY1(s, TIFF_SAMPLES_PER_PIXEL, TIFF_SHORT, s->bpp_tab_size);
|
||||
|
||||
add_entry1(s, TIFF_ROWSPERSTRIP, TIFF_LONG, s->rps);
|
||||
add_entry(s, TIFF_STRIP_SIZE, TIFF_LONG, strips, s->strip_sizes);
|
||||
add_entry(s, TIFF_XRES, TIFF_RATIONAL, 1, res);
|
||||
ADD_ENTRY1(s, TIFF_ROWSPERSTRIP, TIFF_LONG, s->rps);
|
||||
ADD_ENTRY(s, TIFF_STRIP_SIZE, TIFF_LONG, strips, s->strip_sizes);
|
||||
ADD_ENTRY(s, TIFF_XRES, TIFF_RATIONAL, 1, res);
|
||||
if (avctx->sample_aspect_ratio.num > 0 &&
|
||||
avctx->sample_aspect_ratio.den > 0) {
|
||||
AVRational y = av_mul_q(av_make_q(s->dpi, 1),
|
||||
@@ -445,11 +462,11 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
res[0] = y.num;
|
||||
res[1] = y.den;
|
||||
}
|
||||
add_entry(s, TIFF_YRES, TIFF_RATIONAL, 1, res);
|
||||
add_entry1(s, TIFF_RES_UNIT, TIFF_SHORT, 2);
|
||||
ADD_ENTRY(s, TIFF_YRES, TIFF_RATIONAL, 1, res);
|
||||
ADD_ENTRY1(s, TIFF_RES_UNIT, TIFF_SHORT, 2);
|
||||
|
||||
if (!(avctx->flags & CODEC_FLAG_BITEXACT))
|
||||
add_entry(s, TIFF_SOFTWARE_NAME, TIFF_STRING,
|
||||
ADD_ENTRY(s, TIFF_SOFTWARE_NAME, TIFF_STRING,
|
||||
strlen(LIBAVCODEC_IDENT) + 1, LIBAVCODEC_IDENT);
|
||||
|
||||
if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
|
||||
@@ -460,17 +477,17 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
pal[i + 256] = ((rgb >> 8) & 0xff) * 257;
|
||||
pal[i + 512] = (rgb & 0xff) * 257;
|
||||
}
|
||||
add_entry(s, TIFF_PAL, TIFF_SHORT, 256 * 3, pal);
|
||||
ADD_ENTRY(s, TIFF_PAL, TIFF_SHORT, 256 * 3, pal);
|
||||
}
|
||||
if (alpha)
|
||||
add_entry1(s,TIFF_EXTRASAMPLES, TIFF_SHORT, 2);
|
||||
if (is_yuv) {
|
||||
/** according to CCIR Recommendation 601.1 */
|
||||
uint32_t refbw[12] = { 15, 1, 235, 1, 128, 1, 240, 1, 128, 1, 240, 1 };
|
||||
add_entry(s, TIFF_YCBCR_SUBSAMPLING, TIFF_SHORT, 2, s->subsampling);
|
||||
ADD_ENTRY(s, TIFF_YCBCR_SUBSAMPLING, TIFF_SHORT, 2, s->subsampling);
|
||||
if (avctx->chroma_sample_location == AVCHROMA_LOC_TOPLEFT)
|
||||
add_entry1(s, TIFF_YCBCR_POSITIONING, TIFF_SHORT, 2);
|
||||
add_entry(s, TIFF_REFERENCE_BW, TIFF_RATIONAL, 6, refbw);
|
||||
ADD_ENTRY(s, TIFF_REFERENCE_BW, TIFF_RATIONAL, 6, refbw);
|
||||
}
|
||||
// write offset to dir
|
||||
bytestream_put_le32(&offset, ptr - pkt->data);
|
||||
|
@@ -197,4 +197,30 @@ void ff_vaapi_common_end_frame(AVCodecContext *avctx)
|
||||
vactx->slice_params_alloc = 0;
|
||||
}
|
||||
|
||||
#if CONFIG_H263_VAAPI_HWACCEL || CONFIG_MPEG1_VAAPI_HWACCEL || \
|
||||
CONFIG_MPEG2_VAAPI_HWACCEL || CONFIG_MPEG4_VAAPI_HWACCEL || \
|
||||
CONFIG_VC1_VAAPI_HWACCEL || CONFIG_WMV3_VAAPI_HWACCEL
|
||||
int ff_vaapi_mpeg_end_frame(AVCodecContext *avctx)
|
||||
{
|
||||
struct vaapi_context * const vactx = avctx->hwaccel_context;
|
||||
MpegEncContext *s = avctx->priv_data;
|
||||
int ret;
|
||||
|
||||
ret = ff_vaapi_commit_slices(vactx);
|
||||
if (ret < 0)
|
||||
goto finish;
|
||||
|
||||
ret = ff_vaapi_render_picture(vactx,
|
||||
ff_vaapi_get_surface_id(s->current_picture_ptr->f));
|
||||
if (ret < 0)
|
||||
goto finish;
|
||||
|
||||
ff_mpeg_draw_horiz_band(s, 0, s->avctx->height);
|
||||
|
||||
finish:
|
||||
ff_vaapi_common_end_frame(avctx);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* @} */
|
||||
|
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Video Acceleration API (video decoding)
|
||||
* HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
|
||||
*
|
||||
* Copyright (C) 2013 Anton Khirnov
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "vaapi_internal.h"
|
||||
|
||||
int ff_vaapi_mpeg_end_frame(AVCodecContext *avctx)
|
||||
{
|
||||
struct vaapi_context * const vactx = avctx->hwaccel_context;
|
||||
MpegEncContext *s = avctx->priv_data;
|
||||
int ret;
|
||||
|
||||
ret = ff_vaapi_commit_slices(vactx);
|
||||
if (ret < 0)
|
||||
goto finish;
|
||||
|
||||
ret = ff_vaapi_render_picture(vactx,
|
||||
ff_vaapi_get_surface_id(s->current_picture_ptr->f));
|
||||
if (ret < 0)
|
||||
goto finish;
|
||||
|
||||
ff_mpeg_draw_horiz_band(s, 0, s->avctx->height);
|
||||
|
||||
finish:
|
||||
ff_vaapi_common_end_frame(avctx);
|
||||
return ret;
|
||||
}
|
||||
|
@@ -1915,8 +1915,8 @@ void inter_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3],
|
||||
mb->bmv[2 * y * 4 + 2 * x + 1].y +
|
||||
mb->bmv[(2 * y + 1) * 4 + 2 * x ].y +
|
||||
mb->bmv[(2 * y + 1) * 4 + 2 * x + 1].y;
|
||||
uvmv.x = (uvmv.x + 2 + (uvmv.x >> (INT_BIT - 1))) >> 2;
|
||||
uvmv.y = (uvmv.y + 2 + (uvmv.y >> (INT_BIT - 1))) >> 2;
|
||||
uvmv.x = (uvmv.x + 2 + FF_SIGNBIT(uvmv.x)) >> 2;
|
||||
uvmv.y = (uvmv.y + 2 + FF_SIGNBIT(uvmv.y)) >> 2;
|
||||
if (s->profile == 3) {
|
||||
uvmv.x &= ~7;
|
||||
uvmv.y &= ~7;
|
||||
|
@@ -59,7 +59,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
||||
int has_alpha = avctx->codec_tag == MKTAG('D','X','S','A');
|
||||
|
||||
// check that at least header fits
|
||||
if (buf_size < 27 + 7 * 2 + 4 * 3) {
|
||||
if (buf_size < 27 + 7 * 2 + 4 * (3 + has_alpha)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "coded frame size %d too small\n", buf_size);
|
||||
return -1;
|
||||
}
|
||||
@@ -106,9 +106,15 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
||||
// read palette
|
||||
for (i = 0; i < sub->rects[0]->nb_colors; i++)
|
||||
((uint32_t*)sub->rects[0]->pict.data[1])[i] = bytestream_get_be24(&buf);
|
||||
// make all except background (first entry) non-transparent
|
||||
for (i = 0; i < sub->rects[0]->nb_colors; i++)
|
||||
((uint32_t*)sub->rects[0]->pict.data[1])[i] |= (has_alpha ? *buf++ : (i ? 0xff : 0)) << 24;
|
||||
|
||||
if (!has_alpha) {
|
||||
// make all except background (first entry) non-transparent
|
||||
for (i = 1; i < sub->rects[0]->nb_colors; i++)
|
||||
((uint32_t *)sub->rects[0]->pict.data[1])[i] |= 0xff000000;
|
||||
} else {
|
||||
for (i = 0; i < sub->rects[0]->nb_colors; i++)
|
||||
((uint32_t *)sub->rects[0]->pict.data[1])[i] |= *buf++ << 24;
|
||||
}
|
||||
|
||||
// process RLE-compressed data
|
||||
init_get_bits(&gb, buf, (buf_end - buf) * 8);
|
||||
|
@@ -134,9 +134,9 @@ int avdevice_app_to_dev_control_message(struct AVFormatContext *s, enum AVAppToD
|
||||
int avdevice_dev_to_app_control_message(struct AVFormatContext *s, enum AVDevToAppMessageType type,
|
||||
void *data, size_t data_size)
|
||||
{
|
||||
if (!s->control_message_cb)
|
||||
if (!av_format_get_control_message_cb(s))
|
||||
return AVERROR(ENOSYS);
|
||||
return s->control_message_cb(s, type, data, data_size);
|
||||
return av_format_get_control_message_cb(s)(s, type, data, data_size);
|
||||
}
|
||||
|
||||
int avdevice_capabilities_create(AVDeviceCapabilitiesQuery **caps, AVFormatContext *s,
|
||||
|
@@ -49,6 +49,7 @@ int ff_oss_audio_open(AVFormatContext *s1, int is_output,
|
||||
int audio_fd;
|
||||
int tmp, err;
|
||||
char *flip = getenv("AUDIO_FLIP_LEFT");
|
||||
char errbuff[128];
|
||||
|
||||
if (is_output)
|
||||
audio_fd = avpriv_open(audio_device, O_WRONLY);
|
||||
@@ -74,14 +75,15 @@ int ff_oss_audio_open(AVFormatContext *s1, int is_output,
|
||||
|
||||
#define CHECK_IOCTL_ERROR(event) \
|
||||
if (err < 0) { \
|
||||
av_log(s1, AV_LOG_ERROR, #event ": %s\n", strerror(errno)); \
|
||||
av_strerror(AVERROR(errno), errbuff, sizeof(errbuff)); \
|
||||
av_log(s1, AV_LOG_ERROR, #event ": %s\n", errbuff); \
|
||||
goto fail; \
|
||||
}
|
||||
|
||||
/* select format : favour native format
|
||||
* We don't CHECK_IOCTL_ERROR here because even if failed OSS still may be
|
||||
* usable. If OSS is not usable the SNDCTL_DSP_SETFMTS later is going to
|
||||
* fail anyway. `err =` kept to eliminate compiler warning. */
|
||||
* fail anyway. */
|
||||
err = ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &tmp);
|
||||
if (err < 0) {
|
||||
av_log(s1, AV_LOG_WARNING, "SNDCTL_DSP_GETFMTS: %s\n", strerror(errno));
|
||||
|
@@ -135,11 +135,14 @@ static int config_output(AVFilterLink *outlink)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
if (s->options) {
|
||||
int ret;
|
||||
AVDictionaryEntry *e = NULL;
|
||||
while ((e = av_dict_get(s->options, "", e, AV_DICT_IGNORE_SUFFIX)))
|
||||
av_log(ctx, AV_LOG_VERBOSE, "lavr option: %s=%s\n", e->key, e->value);
|
||||
|
||||
av_opt_set_dict(s->avr, &s->options);
|
||||
ret = av_opt_set_dict(s->avr, &s->options);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
av_opt_set_int(s->avr, "in_channel_layout", inlink ->channel_layout, 0);
|
||||
|
@@ -230,6 +230,11 @@ int avfilter_config_links(AVFilterContext *filter)
|
||||
AVFilterLink *inlink;
|
||||
|
||||
if (!link) continue;
|
||||
if (!link->src || !link->dst) {
|
||||
av_log(filter, AV_LOG_ERROR,
|
||||
"Not all input and output are properly linked (%d).\n", i);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
inlink = link->src->nb_inputs ? link->src->inputs[0] : NULL;
|
||||
link->current_pts = AV_NOPTS_VALUE;
|
||||
|
@@ -534,7 +534,7 @@ static int config_input(AVFilterLink *inlink)
|
||||
/* each slice will need to (pre & re)process the top and bottom block of
|
||||
* the previous one in in addition to its processing area. This is because
|
||||
* each pixel is averaged by all the surrounding blocks */
|
||||
slice_h = (int)ceilf(s->pr_height / s->nb_threads) + (s->bsize - 1) * 2;
|
||||
slice_h = (int)ceilf(s->pr_height / (float)s->nb_threads) + (s->bsize - 1) * 2;
|
||||
for (i = 0; i < s->nb_threads; i++) {
|
||||
s->slices[i] = av_malloc_array(linesize, slice_h * sizeof(*s->slices[i]));
|
||||
if (!s->slices[i])
|
||||
|
@@ -485,7 +485,7 @@ static int load_textfile(AVFilterContext *ctx)
|
||||
return err;
|
||||
}
|
||||
|
||||
if (!(tmp = av_realloc(s->text, textbuf_size + 1))) {
|
||||
if (textbuf_size > SIZE_MAX - 1 || !(tmp = av_realloc(s->text, textbuf_size + 1))) {
|
||||
av_file_unmap(textbuf, textbuf_size);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
@@ -60,8 +60,10 @@ static av_cold int init(AVFilterContext *ctx)
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
if (!s->pix_fmts)
|
||||
if (!s->pix_fmts) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Empty output format string.\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
/* count the formats */
|
||||
cur = s->pix_fmts;
|
||||
|
@@ -82,6 +82,7 @@ static int config_output(AVFilterLink *outlink)
|
||||
int width = ctx->inputs[LEFT]->w;
|
||||
int height = ctx->inputs[LEFT]->h;
|
||||
AVRational time_base = ctx->inputs[LEFT]->time_base;
|
||||
AVRational frame_rate = ctx->inputs[LEFT]->frame_rate;
|
||||
|
||||
// check size and fps match on the other input
|
||||
if (width != ctx->inputs[RIGHT]->w ||
|
||||
@@ -93,11 +94,18 @@ static int config_output(AVFilterLink *outlink)
|
||||
return AVERROR_INVALIDDATA;
|
||||
} else if (av_cmp_q(time_base, ctx->inputs[RIGHT]->time_base) != 0) {
|
||||
av_log(ctx, AV_LOG_ERROR,
|
||||
"Left and right framerates differ (%d/%d vs %d/%d).\n",
|
||||
"Left and right time bases differ (%d/%d vs %d/%d).\n",
|
||||
time_base.num, time_base.den,
|
||||
ctx->inputs[RIGHT]->time_base.num,
|
||||
ctx->inputs[RIGHT]->time_base.den);
|
||||
return AVERROR_INVALIDDATA;
|
||||
} else if (av_cmp_q(frame_rate, ctx->inputs[RIGHT]->frame_rate) != 0) {
|
||||
av_log(ctx, AV_LOG_ERROR,
|
||||
"Left and right framerates differ (%d/%d vs %d/%d).\n",
|
||||
frame_rate.num, frame_rate.den,
|
||||
ctx->inputs[RIGHT]->frame_rate.num,
|
||||
ctx->inputs[RIGHT]->frame_rate.den);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
s->pix_desc = av_pix_fmt_desc_get(outlink->format);
|
||||
@@ -108,6 +116,8 @@ static int config_output(AVFilterLink *outlink)
|
||||
switch (s->format) {
|
||||
case AV_STEREO3D_FRAMESEQUENCE:
|
||||
time_base.den *= 2;
|
||||
frame_rate.num *= 2;
|
||||
|
||||
s->double_pts = AV_NOPTS_VALUE;
|
||||
break;
|
||||
case AV_STEREO3D_COLUMNS:
|
||||
@@ -126,6 +136,7 @@ static int config_output(AVFilterLink *outlink)
|
||||
outlink->w = width;
|
||||
outlink->h = height;
|
||||
outlink->time_base = time_base;
|
||||
outlink->frame_rate= frame_rate;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -86,9 +86,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
||||
int i, plane, vsub = desc->log2_chroma_h;
|
||||
|
||||
for (plane = 0; plane < 4 && frame->data[plane] && frame->linesize[plane]; plane++) {
|
||||
int64_t linesize = av_image_get_linesize(frame->format, frame->width, plane);
|
||||
uint8_t *data = frame->data[plane];
|
||||
int h = plane == 1 || plane == 2 ? FF_CEIL_RSHIFT(inlink->h, vsub) : inlink->h;
|
||||
int linesize = av_image_get_linesize(frame->format, frame->width, plane);
|
||||
|
||||
if (linesize < 0)
|
||||
return linesize;
|
||||
|
@@ -80,13 +80,14 @@ static int interleave_new_audio_packet(AVFormatContext *s, AVPacket *pkt,
|
||||
{
|
||||
AVStream *st = s->streams[stream_index];
|
||||
AudioInterleaveContext *aic = st->priv_data;
|
||||
|
||||
int ret;
|
||||
int size = FFMIN(av_fifo_size(aic->fifo), *aic->samples * aic->sample_size);
|
||||
if (!size || (!flush && size == av_fifo_size(aic->fifo)))
|
||||
return 0;
|
||||
|
||||
if (av_new_packet(pkt, size) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
ret = av_new_packet(pkt, size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
av_fifo_generic_read(aic->fifo, pkt->data, size, NULL);
|
||||
|
||||
pkt->dts = pkt->pts = aic->dts;
|
||||
|
@@ -1098,7 +1098,6 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
|
||||
*pbuffer = NULL;
|
||||
return 0;
|
||||
}
|
||||
d = s->opaque;
|
||||
|
||||
/* don't attempt to pad fixed-size packet buffers */
|
||||
if (!s->max_packet_size) {
|
||||
@@ -1108,6 +1107,7 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
|
||||
|
||||
avio_flush(s);
|
||||
|
||||
d = s->opaque;
|
||||
*pbuffer = d->buffer;
|
||||
size = d->size;
|
||||
av_free(d);
|
||||
|
@@ -204,11 +204,7 @@ static int write_manifest(AVFormatContext *s, int final)
|
||||
avio_printf(out, "</manifest>\n");
|
||||
avio_flush(out);
|
||||
avio_close(out);
|
||||
if (rename(temp_filename, filename) == -1) {
|
||||
av_log(s, AV_LOG_ERROR, "failed to rename file %s to %s\n", temp_filename, filename);
|
||||
return AVERROR(errno);
|
||||
}
|
||||
return 0;
|
||||
return ff_rename(temp_filename, filename);
|
||||
}
|
||||
|
||||
static void update_size(AVIOContext *out, int64_t pos)
|
||||
@@ -289,11 +285,7 @@ static int write_abst(AVFormatContext *s, OutputStream *os, int final)
|
||||
update_size(out, afrt_pos);
|
||||
update_size(out, 0);
|
||||
avio_close(out);
|
||||
if (rename(temp_filename, filename) == -1) {
|
||||
av_log(s, AV_LOG_ERROR, "failed to rename file %s to %s\n", temp_filename, filename);
|
||||
return AVERROR(errno);
|
||||
}
|
||||
return 0;
|
||||
return ff_rename(temp_filename, filename);
|
||||
}
|
||||
|
||||
static int init_file(AVFormatContext *s, OutputStream *os, int64_t start_ts)
|
||||
@@ -487,10 +479,9 @@ static int hds_flush(AVFormatContext *s, OutputStream *os, int final,
|
||||
|
||||
snprintf(target_filename, sizeof(target_filename),
|
||||
"%s/stream%dSeg1-Frag%d", s->filename, index, os->fragment_index);
|
||||
if (rename(os->temp_filename, target_filename) == -1) {
|
||||
av_log(s, AV_LOG_ERROR, "failed to rename file %s to %s\n", os->temp_filename, target_filename);
|
||||
return AVERROR(errno);
|
||||
}
|
||||
ret = ff_rename(os->temp_filename, target_filename);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
add_fragment(os, target_filename, os->frag_start_ts, end_ts - os->frag_start_ts);
|
||||
|
||||
if (!final) {
|
||||
|
@@ -360,7 +360,7 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
|
||||
VideoDemuxData *s = s1->priv_data;
|
||||
char filename_bytes[1024];
|
||||
char *filename = filename_bytes;
|
||||
int i;
|
||||
int i, res;
|
||||
int size[3] = { 0 }, ret[3] = { 0 };
|
||||
AVIOContext *f[3] = { NULL };
|
||||
AVCodecContext *codec = s1->streams[0]->codec;
|
||||
@@ -436,8 +436,9 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
|
||||
}
|
||||
}
|
||||
|
||||
if (av_new_packet(pkt, size[0] + size[1] + size[2]) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
res = av_new_packet(pkt, size[0] + size[1] + size[2]);
|
||||
if (res < 0)
|
||||
return res;
|
||||
pkt->stream_index = 0;
|
||||
pkt->flags |= AV_PKT_FLAG_KEY;
|
||||
if (s->ts_from_file) {
|
||||
|
@@ -371,6 +371,20 @@ AVRational ff_choose_timebase(AVFormatContext *s, AVStream *st, int min_precisio
|
||||
*/
|
||||
int ff_generate_avci_extradata(AVStream *st);
|
||||
|
||||
/**
|
||||
* Wrap errno on rename() error.
|
||||
*
|
||||
* @param oldpath source path
|
||||
* @param newpath destination path
|
||||
* @return 0 or AVERROR on failure
|
||||
*/
|
||||
static inline int ff_rename(const char *oldpath, const char *newpath)
|
||||
{
|
||||
if (rename(oldpath, newpath) == -1)
|
||||
return AVERROR(errno);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate extradata with additional FF_INPUT_BUFFER_PADDING_SIZE at end
|
||||
* which is always set to 0.
|
||||
|
@@ -169,7 +169,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
|
||||
}
|
||||
if (ctx->swfurl) {
|
||||
av_strlcat(filename, " swfUrl=", len);
|
||||
av_strlcat(filename, ctx->pageurl, len);
|
||||
av_strlcat(filename, ctx->swfurl, len);
|
||||
}
|
||||
if (ctx->flashver) {
|
||||
av_strlcat(filename, " flashVer=", len);
|
||||
|
@@ -1924,8 +1924,8 @@ static int matroska_parse_tracks(AVFormatContext *s)
|
||||
av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
|
||||
1000000000, track->default_duration, 30000);
|
||||
#if FF_API_R_FRAME_RATE
|
||||
if ( st->avg_frame_rate.num < st->avg_frame_rate.den * 1000L
|
||||
&& st->avg_frame_rate.num > st->avg_frame_rate.den * 5L)
|
||||
if ( st->avg_frame_rate.num < st->avg_frame_rate.den * 1000LL
|
||||
&& st->avg_frame_rate.num > st->avg_frame_rate.den * 5LL)
|
||||
st->r_frame_rate = st->avg_frame_rate;
|
||||
#endif
|
||||
}
|
||||
@@ -2911,7 +2911,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
|
||||
int64_t timestamp, int flags)
|
||||
{
|
||||
MatroskaDemuxContext *matroska = s->priv_data;
|
||||
MatroskaTrack *tracks = matroska->tracks.elem;
|
||||
MatroskaTrack *tracks = NULL;
|
||||
AVStream *st = s->streams[stream_index];
|
||||
int i, index, index_sub, index_min;
|
||||
|
||||
@@ -2941,6 +2941,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
|
||||
goto err;
|
||||
|
||||
index_min = index;
|
||||
tracks = matroska->tracks.elem;
|
||||
for (i = 0; i < matroska->tracks.nb_elem; i++) {
|
||||
tracks[i].audio.pkt_cnt = 0;
|
||||
tracks[i].audio.sub_packet_cnt = 0;
|
||||
|
@@ -696,13 +696,15 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb,
|
||||
|
||||
|
||||
static int mkv_write_stereo_mode(AVFormatContext *s, AVIOContext *pb,
|
||||
AVStream *st, int mode)
|
||||
AVStream *st, int mode, int *h_width, int *h_height)
|
||||
{
|
||||
int i;
|
||||
int ret = 0;
|
||||
AVDictionaryEntry *tag;
|
||||
MatroskaVideoStereoModeType format = MATROSKA_VIDEO_STEREOMODE_TYPE_NB;
|
||||
|
||||
*h_width = 1;
|
||||
*h_height = 1;
|
||||
// convert metadata into proper side data and add it to the stream
|
||||
if ((tag = av_dict_get(st->metadata, "stereo_mode", NULL, 0)) ||
|
||||
(tag = av_dict_get( s->metadata, "stereo_mode", NULL, 0))) {
|
||||
@@ -722,6 +724,7 @@ static int mkv_write_stereo_mode(AVFormatContext *s, AVIOContext *pb,
|
||||
}
|
||||
}
|
||||
|
||||
// iterate to find the stereo3d side data
|
||||
for (i = 0; i < st->nb_side_data; i++) {
|
||||
AVPacketSideData sd = st->side_data[i];
|
||||
if (sd.type == AV_PKT_DATA_STEREO3D) {
|
||||
@@ -735,11 +738,13 @@ static int mkv_write_stereo_mode(AVFormatContext *s, AVIOContext *pb,
|
||||
format = (stereo->flags & AV_STEREO3D_FLAG_INVERT)
|
||||
? MATROSKA_VIDEO_STEREOMODE_TYPE_RIGHT_LEFT
|
||||
: MATROSKA_VIDEO_STEREOMODE_TYPE_LEFT_RIGHT;
|
||||
*h_width = 2;
|
||||
break;
|
||||
case AV_STEREO3D_TOPBOTTOM:
|
||||
format = MATROSKA_VIDEO_STEREOMODE_TYPE_TOP_BOTTOM;
|
||||
if (stereo->flags & AV_STEREO3D_FLAG_INVERT)
|
||||
format--;
|
||||
*h_height = 2;
|
||||
break;
|
||||
case AV_STEREO3D_CHECKERBOARD:
|
||||
format = MATROSKA_VIDEO_STEREOMODE_TYPE_CHECKERBOARD_LR;
|
||||
@@ -750,11 +755,13 @@ static int mkv_write_stereo_mode(AVFormatContext *s, AVIOContext *pb,
|
||||
format = MATROSKA_VIDEO_STEREOMODE_TYPE_ROW_INTERLEAVED_LR;
|
||||
if (stereo->flags & AV_STEREO3D_FLAG_INVERT)
|
||||
format--;
|
||||
*h_height = 2;
|
||||
break;
|
||||
case AV_STEREO3D_COLUMNS:
|
||||
format = MATROSKA_VIDEO_STEREOMODE_TYPE_COL_INTERLEAVED_LR;
|
||||
if (stereo->flags & AV_STEREO3D_FLAG_INVERT)
|
||||
format--;
|
||||
*h_width = 2;
|
||||
break;
|
||||
case AV_STEREO3D_FRAMESEQUENCE:
|
||||
format = MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_LR;
|
||||
@@ -762,8 +769,6 @@ static int mkv_write_stereo_mode(AVFormatContext *s, AVIOContext *pb,
|
||||
format++;
|
||||
break;
|
||||
}
|
||||
ret = stereo->type;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -771,6 +776,7 @@ static int mkv_write_stereo_mode(AVFormatContext *s, AVIOContext *pb,
|
||||
if (format == MATROSKA_VIDEO_STEREOMODE_TYPE_NB)
|
||||
return ret;
|
||||
|
||||
// if webm, do not write unsupported modes
|
||||
if ((mode == MODE_WEBM &&
|
||||
format > MATROSKA_VIDEO_STEREOMODE_TYPE_TOP_BOTTOM &&
|
||||
format != MATROSKA_VIDEO_STEREOMODE_TYPE_RIGHT_LEFT)
|
||||
@@ -781,6 +787,7 @@ static int mkv_write_stereo_mode(AVFormatContext *s, AVIOContext *pb,
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
// write StereoMode if format is valid
|
||||
put_ebml_uint(pb, MATROSKA_ID_VIDEOSTEREOMODE, format);
|
||||
|
||||
return ret;
|
||||
@@ -926,27 +933,20 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
|
||||
|
||||
// check both side data and metadata for stereo information,
|
||||
// write the result to the bitstream if any is found
|
||||
ret = mkv_write_stereo_mode(s, pb, st, mkv->mode);
|
||||
ret = mkv_write_stereo_mode(s, pb, st, mkv->mode,
|
||||
&display_width_div,
|
||||
&display_height_div);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
switch (ret) {
|
||||
case AV_STEREO3D_SIDEBYSIDE:
|
||||
case AV_STEREO3D_COLUMNS:
|
||||
display_width_div = 2;
|
||||
break;
|
||||
case AV_STEREO3D_TOPBOTTOM:
|
||||
case AV_STEREO3D_LINES:
|
||||
display_height_div = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
if (((tag = av_dict_get(st->metadata, "alpha_mode", NULL, 0)) && atoi(tag->value)) ||
|
||||
((tag = av_dict_get( s->metadata, "alpha_mode", NULL, 0)) && atoi(tag->value)) ||
|
||||
(codec->pix_fmt == AV_PIX_FMT_YUVA420P)) {
|
||||
put_ebml_uint(pb, MATROSKA_ID_VIDEOALPHAMODE, 1);
|
||||
}
|
||||
|
||||
// write DisplayWidth and DisplayHeight, they contain the size of
|
||||
// a single source view and/or the display aspect ratio
|
||||
if (st->sample_aspect_ratio.num) {
|
||||
int64_t d_width = av_rescale(codec->width, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
|
||||
if (d_width > INT_MAX) {
|
||||
@@ -964,6 +964,7 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
|
||||
uint32_t color_space = av_le2ne32(codec->codec_tag);
|
||||
put_ebml_binary(pb, MATROSKA_ID_VIDEOCOLORSPACE, &color_space, sizeof(color_space));
|
||||
}
|
||||
|
||||
end_ebml_master(pb, subinfo);
|
||||
break;
|
||||
|
||||
|
@@ -3645,7 +3645,7 @@ static int mov_read_header(AVFormatContext *s)
|
||||
av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
|
||||
sc->time_scale*(int64_t)sc->nb_frames_for_fps, sc->duration_for_fps, INT_MAX);
|
||||
if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
|
||||
if (st->codec->width <= 0 && st->codec->height <= 0) {
|
||||
if (st->codec->width <= 0 || st->codec->height <= 0) {
|
||||
st->codec->width = sc->width;
|
||||
st->codec->height = sc->height;
|
||||
}
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#define XING_FLAG_FRAMES 0x01
|
||||
#define XING_FLAG_SIZE 0x02
|
||||
#define XING_FLAG_TOC 0x04
|
||||
#define XING_FLAC_QSCALE 0x08
|
||||
|
||||
#define XING_TOC_COUNT 100
|
||||
|
||||
@@ -168,8 +169,8 @@ static void mp3_parse_info_tag(AVFormatContext *s, AVStream *st,
|
||||
(AVRational){spf, c->sample_rate},
|
||||
st->time_base));
|
||||
/* VBR quality */
|
||||
if(v & 8)
|
||||
avio_skip(s->pb, 4);
|
||||
if (v & XING_FLAC_QSCALE)
|
||||
avio_rb32(s->pb);
|
||||
|
||||
/* Encoder short version string */
|
||||
memset(version, 0, sizeof(version));
|
||||
|
@@ -57,7 +57,7 @@ typedef struct {
|
||||
|
||||
static inline int64_t bs_get_v(const uint8_t **bs)
|
||||
{
|
||||
int64_t v = 0;
|
||||
uint64_t v = 0;
|
||||
int br = 0;
|
||||
int c;
|
||||
|
||||
@@ -91,7 +91,7 @@ static int mpc8_probe(AVProbeData *p)
|
||||
size = bs_get_v(&bs);
|
||||
if (size < 2)
|
||||
return 0;
|
||||
if (bs + size - 2 >= bs_end)
|
||||
if (size >= bs_end - bs + 2)
|
||||
return AVPROBE_SCORE_EXTENSION - 1; // seems to be valid MPC but no header yet
|
||||
if (header_found) {
|
||||
if (size < 11 || size > 28)
|
||||
@@ -108,7 +108,7 @@ static int mpc8_probe(AVProbeData *p)
|
||||
|
||||
static inline int64_t gb_get_v(GetBitContext *gb)
|
||||
{
|
||||
int64_t v = 0;
|
||||
uint64_t v = 0;
|
||||
int bits = 0;
|
||||
while(get_bits1(gb) && bits < 64-7){
|
||||
v <<= 7;
|
||||
@@ -223,6 +223,10 @@ static int mpc8_read_header(AVFormatContext *s)
|
||||
while(!avio_feof(pb)){
|
||||
pos = avio_tell(pb);
|
||||
mpc8_get_chunk_header(pb, &tag, &size);
|
||||
if (size < 0) {
|
||||
av_log(s, AV_LOG_ERROR, "Invalid chunk length\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if(tag == TAG_STREAMHDR)
|
||||
break;
|
||||
mpc8_handle_chunk(s, tag, pos, size);
|
||||
|
@@ -70,20 +70,23 @@ static int mpegps_probe(AVProbeData *p)
|
||||
int i;
|
||||
int sys = 0, pspack = 0, priv1 = 0, vid = 0;
|
||||
int audio = 0, invalid = 0, score = 0;
|
||||
int endpes = 0;
|
||||
|
||||
for (i = 0; i < p->buf_size; i++) {
|
||||
code = (code << 8) + p->buf[i];
|
||||
if ((code & 0xffffff00) == 0x100) {
|
||||
int len = p->buf[i + 1] << 8 | p->buf[i + 2];
|
||||
int pes = check_pes(p->buf + i, p->buf + p->buf_size);
|
||||
int pes = endpes <= i && check_pes(p->buf + i, p->buf + p->buf_size);
|
||||
int pack = check_pack_header(p->buf + i);
|
||||
|
||||
if (code == SYSTEM_HEADER_START_CODE)
|
||||
sys++;
|
||||
else if (code == PACK_START_CODE && pack)
|
||||
pspack++;
|
||||
else if ((code & 0xf0) == VIDEO_ID && pes)
|
||||
else if ((code & 0xf0) == VIDEO_ID && pes) {
|
||||
endpes = i + len;
|
||||
vid++;
|
||||
}
|
||||
// skip pes payload to avoid start code emulation for private
|
||||
// and audio streams
|
||||
else if ((code & 0xe0) == AUDIO_ID && pes) {audio++; i+=len;}
|
||||
|
@@ -112,7 +112,7 @@ static int mtv_read_header(AVFormatContext *s)
|
||||
mtv->audio_identifier = avio_rl24(pb);
|
||||
mtv->audio_br = avio_rl16(pb);
|
||||
mtv->img_colorfmt = avio_rl24(pb);
|
||||
mtv->img_bpp = avio_r8(pb)>>3;
|
||||
mtv->img_bpp = avio_r8(pb);
|
||||
mtv->img_width = avio_rl16(pb);
|
||||
mtv->img_height = avio_rl16(pb);
|
||||
mtv->img_segment_size = avio_rl16(pb);
|
||||
@@ -128,17 +128,17 @@ static int mtv_read_header(AVFormatContext *s)
|
||||
|
||||
/* Calculate width and height if missing from header */
|
||||
|
||||
if(!mtv->img_width && mtv->img_height)
|
||||
mtv->img_width=mtv->img_segment_size / (mtv->img_bpp)
|
||||
if (!mtv->img_width && mtv->img_height > 0 && mtv->img_bpp >= 8)
|
||||
mtv->img_width=mtv->img_segment_size / (mtv->img_bpp>>3)
|
||||
/ mtv->img_height;
|
||||
|
||||
if(!mtv->img_height && mtv->img_width)
|
||||
mtv->img_height=mtv->img_segment_size / (mtv->img_bpp)
|
||||
if (!mtv->img_height && mtv->img_width > 0 && mtv->img_bpp >= 8)
|
||||
mtv->img_height=mtv->img_segment_size / (mtv->img_bpp>>3)
|
||||
/ mtv->img_width;
|
||||
|
||||
if(!mtv->img_height || !mtv->img_width || !mtv->img_segment_size){
|
||||
av_log(s, AV_LOG_ERROR, "width or height or segment_size is invalid and I cannot calculate them from other information\n");
|
||||
return AVERROR(EINVAL);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
avio_skip(pb, 4);
|
||||
|
@@ -994,11 +994,10 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code)
|
||||
{
|
||||
AVFormatContext *s = nut->avf;
|
||||
AVIOContext *bc = s->pb;
|
||||
int size, stream_id, discard;
|
||||
int size, stream_id, discard, ret;
|
||||
int64_t pts, last_IP_pts;
|
||||
StreamContext *stc;
|
||||
uint8_t header_idx;
|
||||
int ret;
|
||||
|
||||
size = decode_frame_header(nut, &pts, &stream_id, &header_idx, frame_code);
|
||||
if (size < 0)
|
||||
@@ -1020,8 +1019,9 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (av_new_packet(pkt, size + nut->header_len[header_idx]) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
ret = av_new_packet(pkt, size + nut->header_len[header_idx]);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]);
|
||||
pkt->pos = avio_tell(bc); // FIXME
|
||||
if (stc->last_flags & FLAG_SM_DATA) {
|
||||
|
@@ -174,7 +174,7 @@ static int nprobe(AVFormatContext *s, uint8_t *enc_header, unsigned size,
|
||||
taglen = AV_RB32(&enc_header[pos + 32]);
|
||||
datalen = AV_RB32(&enc_header[pos + 36]) >> 4;
|
||||
|
||||
pos += 44L + taglen;
|
||||
pos += 44LL + taglen;
|
||||
|
||||
if (pos + (((uint64_t)datalen) << 4) > size)
|
||||
return -1;
|
||||
|
@@ -132,7 +132,7 @@ static int
|
||||
rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr)
|
||||
{
|
||||
AVIOContext pb;
|
||||
int size;
|
||||
unsigned int size;
|
||||
uint32_t tag;
|
||||
|
||||
/**
|
||||
|
@@ -50,7 +50,7 @@ extern AVInputFormat ff_rdt_demuxer;
|
||||
*/
|
||||
int ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
|
||||
AVStream *st, RMStream *rst,
|
||||
int codec_data_size, const uint8_t *mime);
|
||||
unsigned int codec_data_size, const uint8_t *mime);
|
||||
|
||||
/**
|
||||
* Parse one rm-stream packet from the input bytestream.
|
||||
|
@@ -86,8 +86,10 @@ static void get_str8(AVIOContext *pb, char *buf, int buf_size)
|
||||
|
||||
static int rm_read_extradata(AVIOContext *pb, AVCodecContext *avctx, unsigned size)
|
||||
{
|
||||
if (size >= 1<<24)
|
||||
if (size >= 1<<24) {
|
||||
av_log(avctx, AV_LOG_ERROR, "extradata size %u too large\n", size);
|
||||
return -1;
|
||||
}
|
||||
if (ff_get_extradata(avctx, pb, size) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
return 0;
|
||||
@@ -303,16 +305,16 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
|
||||
AVStream *st, RMStream *rst, int codec_data_size, const uint8_t *mime)
|
||||
int ff_rm_read_mdpr_codecdata(AVFormatContext *s, AVIOContext *pb,
|
||||
AVStream *st, RMStream *rst,
|
||||
unsigned int codec_data_size, const uint8_t *mime)
|
||||
{
|
||||
unsigned int v;
|
||||
int size;
|
||||
int64_t codec_pos;
|
||||
int ret;
|
||||
|
||||
if (codec_data_size < 0)
|
||||
if (codec_data_size > INT_MAX)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
avpriv_set_pts_info(st, 64, 1, 1000);
|
||||
@@ -412,7 +414,11 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
|
||||
skip:
|
||||
/* skip codec info */
|
||||
size = avio_tell(pb) - codec_pos;
|
||||
avio_skip(pb, codec_data_size - size);
|
||||
if (codec_data_size >= size) {
|
||||
avio_skip(pb, codec_data_size - size);
|
||||
} else {
|
||||
av_log(s, AV_LOG_WARNING, "codec_data_size %u < size %d\n", codec_data_size, size);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -921,8 +927,9 @@ ff_rm_retrieve_cache (AVFormatContext *s, AVIOContext *pb,
|
||||
ast->deint_id == DEINT_ID_VBRS)
|
||||
av_get_packet(pb, pkt, ast->sub_packet_lengths[ast->sub_packet_cnt - rm->audio_pkt_cnt]);
|
||||
else {
|
||||
if(av_new_packet(pkt, st->codec->block_align) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
int ret = av_new_packet(pkt, st->codec->block_align);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
memcpy(pkt->data, ast->pkt.data + st->codec->block_align * //FIXME avoid this
|
||||
(ast->sub_packet_h * ast->audio_framesize / st->codec->block_align - rm->audio_pkt_cnt),
|
||||
st->codec->block_align);
|
||||
|
@@ -83,6 +83,7 @@ static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data,
|
||||
avio_close_dyn_buf(data->buf, &p);
|
||||
av_free(p);
|
||||
data->buf = NULL;
|
||||
data->endbyte_bits = 0;
|
||||
}
|
||||
|
||||
if (len < 4) {
|
||||
|
@@ -1150,6 +1150,8 @@ start:
|
||||
if (content_length > 0) {
|
||||
/* leave some room for a trailing '\0' (useful for simple parsing) */
|
||||
content = av_malloc(content_length + 1);
|
||||
if (!content)
|
||||
return AVERROR(ENOMEM);
|
||||
ffurl_read_complete(rt->rtsp_hd, content, content_length);
|
||||
content[content_length] = '\0';
|
||||
}
|
||||
|
@@ -561,6 +561,13 @@ static int select_reference_stream(AVFormatContext *s)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void seg_free_context(SegmentContext *seg)
|
||||
{
|
||||
avio_closep(&seg->list_pb);
|
||||
avformat_free_context(seg->avf);
|
||||
seg->avf = NULL;
|
||||
}
|
||||
|
||||
static int seg_write_header(AVFormatContext *s)
|
||||
{
|
||||
SegmentContext *seg = s->priv_data;
|
||||
@@ -692,12 +699,9 @@ static int seg_write_header(AVFormatContext *s)
|
||||
|
||||
fail:
|
||||
av_dict_free(&options);
|
||||
if (ret) {
|
||||
if (seg->list)
|
||||
avio_close(seg->list_pb);
|
||||
if (seg->avf)
|
||||
avformat_free_context(seg->avf);
|
||||
}
|
||||
if (ret < 0)
|
||||
seg_free_context(seg);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -712,6 +716,9 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
int64_t usecs;
|
||||
int64_t wrapped_val;
|
||||
|
||||
if (!seg->avf)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
if (seg->times) {
|
||||
end_pts = seg->segment_count < seg->nb_times ?
|
||||
seg->times[seg->segment_count] : INT64_MAX;
|
||||
@@ -806,6 +813,9 @@ fail:
|
||||
seg->segment_frame_count++;
|
||||
}
|
||||
|
||||
if (ret < 0)
|
||||
seg_free_context(seg);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -814,8 +824,11 @@ static int seg_write_trailer(struct AVFormatContext *s)
|
||||
SegmentContext *seg = s->priv_data;
|
||||
AVFormatContext *oc = seg->avf;
|
||||
SegmentListEntry *cur, *next;
|
||||
int ret = 0;
|
||||
|
||||
if (!oc)
|
||||
goto fail;
|
||||
|
||||
int ret;
|
||||
if (!seg->write_header_trailer) {
|
||||
if ((ret = segment_end(s, 0, 1)) < 0)
|
||||
goto fail;
|
||||
|
@@ -321,7 +321,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
int err;
|
||||
|
||||
size = avio_rl32(s->pb) - 4;
|
||||
if (!size || size + 4L > frame_size) {
|
||||
if (!size || size + 4LL > frame_size) {
|
||||
av_log(s, AV_LOG_ERROR, "Invalid audio part size\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
@@ -34,6 +34,7 @@
|
||||
|
||||
#include "libavutil/opt.h"
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/file.h"
|
||||
#include "libavutil/mathematics.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
|
||||
@@ -282,8 +283,7 @@ static int write_manifest(AVFormatContext *s, int final)
|
||||
avio_printf(out, "</SmoothStreamingMedia>\n");
|
||||
avio_flush(out);
|
||||
avio_close(out);
|
||||
rename(temp_filename, filename);
|
||||
return 0;
|
||||
return ff_rename(temp_filename, filename);
|
||||
}
|
||||
|
||||
static int ism_write_header(AVFormatContext *s)
|
||||
@@ -539,8 +539,11 @@ static int ism_flush(AVFormatContext *s, int final)
|
||||
snprintf(header_filename, sizeof(header_filename), "%s/FragmentInfo(%s=%"PRIu64")", os->dirname, os->stream_type_tag, start_ts);
|
||||
snprintf(target_filename, sizeof(target_filename), "%s/Fragments(%s=%"PRIu64")", os->dirname, os->stream_type_tag, start_ts);
|
||||
copy_moof(s, filename, header_filename, moof_size);
|
||||
rename(filename, target_filename);
|
||||
add_fragment(os, target_filename, header_filename, start_ts, duration, start_pos, size);
|
||||
ret = ff_rename(filename, target_filename);
|
||||
if (ret < 0)
|
||||
break;
|
||||
add_fragment(os, target_filename, header_filename, start_ts, duration,
|
||||
start_pos, size);
|
||||
}
|
||||
|
||||
if (c->window_size || (final && c->remove_at_exit)) {
|
||||
|
@@ -184,6 +184,8 @@ static int thp_read_packet(AVFormatContext *s,
|
||||
pkt->stream_index = thp->video_stream_index;
|
||||
} else {
|
||||
ret = av_get_packet(pb, pkt, thp->audiosize);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (ret != thp->audiosize) {
|
||||
av_free_packet(pkt);
|
||||
return AVERROR(EIO);
|
||||
|
@@ -118,8 +118,10 @@ static int tta_read_header(AVFormatContext *s)
|
||||
ffio_init_checksum(s->pb, tta_check_crc, UINT32_MAX);
|
||||
for (i = 0; i < c->totalframes; i++) {
|
||||
uint32_t size = avio_rl32(s->pb);
|
||||
av_add_index_entry(st, framepos, i * c->frame_size, size, 0,
|
||||
AVINDEX_KEYFRAME);
|
||||
int r;
|
||||
if ((r = av_add_index_entry(st, framepos, i * c->frame_size, size, 0,
|
||||
AVINDEX_KEYFRAME)) < 0)
|
||||
return r;
|
||||
framepos += size;
|
||||
}
|
||||
crc = ffio_get_checksum(s->pb) ^ UINT32_MAX;
|
||||
@@ -153,6 +155,11 @@ static int tta_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
if (c->currentframe >= c->totalframes)
|
||||
return AVERROR_EOF;
|
||||
|
||||
if (st->nb_index_entries < c->totalframes) {
|
||||
av_log(s, AV_LOG_ERROR, "Index entry disappeared\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
size = st->index_entries[c->currentframe].size;
|
||||
|
||||
ret = av_get_packet(s->pb, pkt, size);
|
||||
|
@@ -2768,8 +2768,8 @@ static int get_std_framerate(int i)
|
||||
* And there are "variable" fps files this needs to detect as well. */
|
||||
static int tb_unreliable(AVCodecContext *c)
|
||||
{
|
||||
if (c->time_base.den >= 101L * c->time_base.num ||
|
||||
c->time_base.den < 5L * c->time_base.num ||
|
||||
if (c->time_base.den >= 101LL * c->time_base.num ||
|
||||
c->time_base.den < 5LL * c->time_base.num ||
|
||||
// c->codec_tag == AV_RL32("DIVX") ||
|
||||
// c->codec_tag == AV_RL32("XVID") ||
|
||||
c->codec_tag == AV_RL32("mp4v") ||
|
||||
@@ -3610,6 +3610,11 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
|
||||
st->info->last_dts = AV_NOPTS_VALUE;
|
||||
|
||||
st->codec = avcodec_alloc_context3(c);
|
||||
if (!st->codec) {
|
||||
av_free(st->info);
|
||||
av_free(st);
|
||||
return NULL;
|
||||
}
|
||||
if (s->iformat) {
|
||||
/* no default bitrate if decoding */
|
||||
st->codec->bit_rate = 0;
|
||||
|
@@ -44,7 +44,7 @@ static int xwma_probe(AVProbeData *p)
|
||||
static int xwma_read_header(AVFormatContext *s)
|
||||
{
|
||||
int64_t size;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
uint32_t dpds_table_size = 0;
|
||||
uint32_t *dpds_table = NULL;
|
||||
unsigned int tag;
|
||||
@@ -132,7 +132,7 @@ static int xwma_read_header(AVFormatContext *s)
|
||||
for (;;) {
|
||||
if (pb->eof_reached) {
|
||||
ret = AVERROR_EOF;
|
||||
goto end;
|
||||
goto fail;
|
||||
}
|
||||
/* read next chunk tag */
|
||||
tag = avio_rl32(pb);
|
||||
@@ -155,7 +155,7 @@ static int xwma_read_header(AVFormatContext *s)
|
||||
if (dpds_table) {
|
||||
av_log(s, AV_LOG_ERROR, "two dpds chunks present\n");
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto end;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Compute the number of entries in the dpds chunk. */
|
||||
@@ -189,7 +189,7 @@ static int xwma_read_header(AVFormatContext *s)
|
||||
/* Determine overall data length */
|
||||
if (size < 0) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto end;
|
||||
goto fail;
|
||||
}
|
||||
if (!size) {
|
||||
xwma->data_end = INT64_MAX;
|
||||
@@ -210,7 +210,7 @@ static int xwma_read_header(AVFormatContext *s)
|
||||
"Invalid bits_per_coded_sample %d for %d channels\n",
|
||||
st->codec->bits_per_coded_sample, st->codec->channels);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto end;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
st->duration = total_decoded_bytes / bytes_per_sample;
|
||||
@@ -245,7 +245,7 @@ static int xwma_read_header(AVFormatContext *s)
|
||||
st->duration = (size<<3) * st->codec->sample_rate / st->codec->bit_rate;
|
||||
}
|
||||
|
||||
end:
|
||||
fail:
|
||||
av_free(dpds_table);
|
||||
|
||||
return ret;
|
||||
|
@@ -60,7 +60,7 @@
|
||||
|
||||
static av_always_inline int even(uint64_t layout)
|
||||
{
|
||||
return (!layout || (layout & (layout - 1)));
|
||||
return (!layout || !!(layout & (layout - 1)));
|
||||
}
|
||||
|
||||
static int sane_layout(uint64_t layout)
|
||||
|
@@ -32,11 +32,10 @@
|
||||
#ifndef LIBAVUTIL_OPENCL_H
|
||||
#define LIBAVUTIL_OPENCL_H
|
||||
|
||||
#include "config.h"
|
||||
#if HAVE_CL_CL_H
|
||||
#include <CL/cl.h>
|
||||
#else
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
#include "dict.h"
|
||||
|
@@ -75,8 +75,8 @@ static int read_number(const AVOption *o, void *dst, double *num, int *den, int6
|
||||
{
|
||||
switch (o->type) {
|
||||
case AV_OPT_TYPE_FLAGS: *intnum = *(unsigned int*)dst;return 0;
|
||||
case AV_OPT_TYPE_PIXEL_FMT:
|
||||
case AV_OPT_TYPE_SAMPLE_FMT:
|
||||
case AV_OPT_TYPE_PIXEL_FMT: *intnum = *(enum AVPixelFormat *)dst;return 0;
|
||||
case AV_OPT_TYPE_SAMPLE_FMT:*intnum = *(enum AVSampleFormat*)dst;return 0;
|
||||
case AV_OPT_TYPE_INT: *intnum = *(int *)dst;return 0;
|
||||
case AV_OPT_TYPE_CHANNEL_LAYOUT:
|
||||
case AV_OPT_TYPE_DURATION:
|
||||
@@ -110,9 +110,9 @@ static int write_number(void *obj, const AVOption *o, void *dst, double num, int
|
||||
}
|
||||
|
||||
switch (o->type) {
|
||||
case AV_OPT_TYPE_PIXEL_FMT: *(enum AVPixelFormat *)dst = llrint(num/den) * intnum; break;
|
||||
case AV_OPT_TYPE_SAMPLE_FMT:*(enum AVSampleFormat*)dst = llrint(num/den) * intnum; break;
|
||||
case AV_OPT_TYPE_FLAGS:
|
||||
case AV_OPT_TYPE_PIXEL_FMT:
|
||||
case AV_OPT_TYPE_SAMPLE_FMT:
|
||||
case AV_OPT_TYPE_INT: *(int *)dst= llrint(num/den)*intnum; break;
|
||||
case AV_OPT_TYPE_DURATION:
|
||||
case AV_OPT_TYPE_CHANNEL_LAYOUT:
|
||||
@@ -150,6 +150,8 @@ static int set_string_binary(void *obj, const AVOption *o, const char *val, uint
|
||||
len /= 2;
|
||||
|
||||
ptr = bin = av_malloc(len);
|
||||
if (!ptr)
|
||||
return AVERROR(ENOMEM);
|
||||
while (*val) {
|
||||
int a = hexchar2int(*val++);
|
||||
int b = hexchar2int(*val++);
|
||||
|
@@ -84,14 +84,14 @@ int swri_dither_init(SwrContext *s, enum AVSampleFormat out_fmt, enum AVSampleFo
|
||||
in_fmt = av_get_packed_sample_fmt( in_fmt);
|
||||
|
||||
if(in_fmt == AV_SAMPLE_FMT_FLT || in_fmt == AV_SAMPLE_FMT_DBL){
|
||||
if(out_fmt == AV_SAMPLE_FMT_S32) scale = 1.0/(1L<<31);
|
||||
if(out_fmt == AV_SAMPLE_FMT_S16) scale = 1.0/(1L<<15);
|
||||
if(out_fmt == AV_SAMPLE_FMT_U8 ) scale = 1.0/(1L<< 7);
|
||||
if(out_fmt == AV_SAMPLE_FMT_S32) scale = 1.0/(1LL<<31);
|
||||
if(out_fmt == AV_SAMPLE_FMT_S16) scale = 1.0/(1LL<<15);
|
||||
if(out_fmt == AV_SAMPLE_FMT_U8 ) scale = 1.0/(1LL<< 7);
|
||||
}
|
||||
if(in_fmt == AV_SAMPLE_FMT_S32 && out_fmt == AV_SAMPLE_FMT_S32 && (s->dither.output_sample_bits&31)) scale = 1;
|
||||
if(in_fmt == AV_SAMPLE_FMT_S32 && out_fmt == AV_SAMPLE_FMT_S16) scale = 1L<<16;
|
||||
if(in_fmt == AV_SAMPLE_FMT_S32 && out_fmt == AV_SAMPLE_FMT_U8 ) scale = 1L<<24;
|
||||
if(in_fmt == AV_SAMPLE_FMT_S16 && out_fmt == AV_SAMPLE_FMT_U8 ) scale = 1L<<8;
|
||||
if(in_fmt == AV_SAMPLE_FMT_S32 && out_fmt == AV_SAMPLE_FMT_S16) scale = 1<<16;
|
||||
if(in_fmt == AV_SAMPLE_FMT_S32 && out_fmt == AV_SAMPLE_FMT_U8 ) scale = 1<<24;
|
||||
if(in_fmt == AV_SAMPLE_FMT_S16 && out_fmt == AV_SAMPLE_FMT_U8 ) scale = 1<<8;
|
||||
|
||||
scale *= s->dither.scale;
|
||||
|
||||
|
@@ -221,6 +221,8 @@ cglobal pack_6ch_%2_to_%1_%3, 2,8,7, dst, src, src1, src2, src3, src4, src5, len
|
||||
jne pack_6ch_%2_to_%1_u_int %+ SUFFIX
|
||||
test srcq, mmsize-1
|
||||
jne pack_6ch_%2_to_%1_u_int %+ SUFFIX
|
||||
test src1q, mmsize-1
|
||||
jne pack_6ch_%2_to_%1_u_int %+ SUFFIX
|
||||
test src2q, mmsize-1
|
||||
jne pack_6ch_%2_to_%1_u_int %+ SUFFIX
|
||||
test src3q, mmsize-1
|
||||
|
@@ -355,9 +355,9 @@ static inline void yuvPlanartoyuy2_c(const uint8_t *ysrc, const uint8_t *usrc,
|
||||
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
|
||||
for (i = 0; i < chromWidth; i += 2) {
|
||||
uint64_t k = yc[0] + (uc[0] << 8) +
|
||||
(yc[1] << 16) + (unsigned)(vc[0] << 24);
|
||||
(yc[1] << 16) + ((unsigned) vc[0] << 24);
|
||||
uint64_t l = yc[2] + (uc[1] << 8) +
|
||||
(yc[3] << 16) + (unsigned)(vc[1] << 24);
|
||||
(yc[3] << 16) + ((unsigned) vc[1] << 24);
|
||||
*ldst++ = k + (l << 32);
|
||||
yc += 4;
|
||||
uc += 2;
|
||||
@@ -419,9 +419,9 @@ static inline void yuvPlanartouyvy_c(const uint8_t *ysrc, const uint8_t *usrc,
|
||||
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
|
||||
for (i = 0; i < chromWidth; i += 2) {
|
||||
uint64_t k = uc[0] + (yc[0] << 8) +
|
||||
(vc[0] << 16) + (unsigned)(yc[1] << 24);
|
||||
(vc[0] << 16) + ((unsigned) yc[1] << 24);
|
||||
uint64_t l = uc[1] + (yc[2] << 8) +
|
||||
(vc[1] << 16) + (unsigned)(yc[3] << 24);
|
||||
(vc[1] << 16) + ((unsigned) yc[3] << 24);
|
||||
*ldst++ = k + (l << 32);
|
||||
yc += 4;
|
||||
uc += 2;
|
||||
|
@@ -622,14 +622,15 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
|
||||
}
|
||||
|
||||
if ((*filterPos)[i] + filterSize > srcW) {
|
||||
int shift = (*filterPos)[i] + filterSize - srcW;
|
||||
int shift = (*filterPos)[i] + FFMIN(filterSize - srcW, 0);
|
||||
|
||||
// move filter coefficients right to compensate for filterPos
|
||||
for (j = filterSize - 2; j >= 0; j--) {
|
||||
int right = FFMIN(j + shift, filterSize - 1);
|
||||
filter[i * filterSize + right] += filter[i * filterSize + j];
|
||||
filter[i * filterSize + j] = 0;
|
||||
}
|
||||
(*filterPos)[i]= srcW - filterSize;
|
||||
(*filterPos)[i]-= shift;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -771,9 +771,13 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
|
||||
|
||||
av_freep(&c->yuvTable);
|
||||
|
||||
#define ALLOC_YUV_TABLE(x) \
|
||||
c->yuvTable = av_malloc(x); \
|
||||
if (!c->yuvTable) \
|
||||
return AVERROR(ENOMEM);
|
||||
switch (bpp) {
|
||||
case 1:
|
||||
c->yuvTable = av_malloc(1024);
|
||||
ALLOC_YUV_TABLE(1024);
|
||||
y_table = c->yuvTable;
|
||||
yb = -(384 << 16) - oy;
|
||||
for (i = 0; i < 1024 - 110; i++) {
|
||||
@@ -788,7 +792,7 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
|
||||
rbase = isRgb ? 3 : 0;
|
||||
gbase = 1;
|
||||
bbase = isRgb ? 0 : 3;
|
||||
c->yuvTable = av_malloc(1024 * 3);
|
||||
ALLOC_YUV_TABLE(1024 * 3);
|
||||
y_table = c->yuvTable;
|
||||
yb = -(384 << 16) - oy;
|
||||
for (i = 0; i < 1024 - 110; i++) {
|
||||
@@ -807,7 +811,7 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
|
||||
rbase = isRgb ? 5 : 0;
|
||||
gbase = isRgb ? 2 : 3;
|
||||
bbase = isRgb ? 0 : 6;
|
||||
c->yuvTable = av_malloc(1024 * 3);
|
||||
ALLOC_YUV_TABLE(1024 * 3);
|
||||
y_table = c->yuvTable;
|
||||
yb = -(384 << 16) - oy;
|
||||
for (i = 0; i < 1024 - 38; i++) {
|
||||
@@ -826,7 +830,7 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
|
||||
rbase = isRgb ? 8 : 0;
|
||||
gbase = 4;
|
||||
bbase = isRgb ? 0 : 8;
|
||||
c->yuvTable = av_malloc(1024 * 3 * 2);
|
||||
ALLOC_YUV_TABLE(1024 * 3 * 2);
|
||||
y_table16 = c->yuvTable;
|
||||
yb = -(384 << 16) - oy;
|
||||
for (i = 0; i < 1024; i++) {
|
||||
@@ -849,7 +853,7 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
|
||||
rbase = isRgb ? bpp - 5 : 0;
|
||||
gbase = 5;
|
||||
bbase = isRgb ? 0 : (bpp - 5);
|
||||
c->yuvTable = av_malloc(1024 * 3 * 2);
|
||||
ALLOC_YUV_TABLE(1024 * 3 * 2);
|
||||
y_table16 = c->yuvTable;
|
||||
yb = -(384 << 16) - oy;
|
||||
for (i = 0; i < 1024; i++) {
|
||||
@@ -869,7 +873,7 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
|
||||
break;
|
||||
case 24:
|
||||
case 48:
|
||||
c->yuvTable = av_malloc(1024);
|
||||
ALLOC_YUV_TABLE(1024);
|
||||
y_table = c->yuvTable;
|
||||
yb = -(384 << 16) - oy;
|
||||
for (i = 0; i < 1024; i++) {
|
||||
@@ -891,7 +895,7 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
|
||||
needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat);
|
||||
if (!needAlpha)
|
||||
abase = (base + 24) & 31;
|
||||
c->yuvTable = av_malloc(1024 * 3 * 4);
|
||||
ALLOC_YUV_TABLE(1024 * 3 * 4);
|
||||
y_table32 = c->yuvTable;
|
||||
yb = -(384 << 16) - oy;
|
||||
for (i = 0; i < 1024; i++) {
|
||||
|
@@ -1,16 +1,16 @@
|
||||
#tb 0: 1/25
|
||||
#tb 0: 1/50
|
||||
0, 0, 0, 1, 152064, 0x05b789ef
|
||||
0, 1, 1, 1, 152064, 0x05b789ef
|
||||
0, 2, 2, 1, 152064, 0x4bb46551
|
||||
0, 3, 3, 1, 152064, 0x9dddf64a
|
||||
0, 4, 4, 1, 152064, 0x2a8380b0
|
||||
0, 5, 5, 1, 152064, 0x4de3b652
|
||||
0, 6, 6, 1, 152064, 0xedb5a8e6
|
||||
0, 7, 7, 1, 152064, 0xe20f7c23
|
||||
0, 8, 8, 1, 152064, 0x5ab58bac
|
||||
0, 9, 9, 1, 152064, 0x1f1b8026
|
||||
0, 10, 10, 1, 152064, 0x91373915
|
||||
0, 11, 11, 1, 152064, 0x02344760
|
||||
0, 12, 12, 1, 152064, 0x30f5fcd5
|
||||
0, 13, 13, 1, 152064, 0xc711ad61
|
||||
0, 14, 14, 1, 152064, 0x24eca223
|
||||
0, 3, 3, 1, 152064, 0x4bb46551
|
||||
0, 4, 4, 1, 152064, 0x9dddf64a
|
||||
0, 5, 5, 1, 152064, 0x9dddf64a
|
||||
0, 6, 6, 1, 152064, 0x2a8380b0
|
||||
0, 7, 7, 1, 152064, 0x2a8380b0
|
||||
0, 8, 8, 1, 152064, 0x4de3b652
|
||||
0, 9, 9, 1, 152064, 0x4de3b652
|
||||
0, 10, 10, 1, 152064, 0xedb5a8e6
|
||||
0, 11, 11, 1, 152064, 0xedb5a8e6
|
||||
0, 12, 12, 1, 152064, 0xe20f7c23
|
||||
0, 13, 13, 1, 152064, 0xe20f7c23
|
||||
0, 14, 14, 1, 152064, 0x5ab58bac
|
||||
|
Reference in New Issue
Block a user