Compare commits
319 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b17cec5262 | ||
![]() |
088733414a | ||
![]() |
44a9e2dbba | ||
![]() |
2d89356641 | ||
![]() |
3c96f21d6e | ||
![]() |
e812220a30 | ||
![]() |
7f84858dcf | ||
![]() |
32df1cd6ac | ||
![]() |
a0f50ddcb8 | ||
![]() |
dc85a75332 | ||
![]() |
21769e3884 | ||
![]() |
a3d3e0a6bc | ||
![]() |
fdf166c5d2 | ||
![]() |
874b3117ed | ||
![]() |
827a8bfc64 | ||
![]() |
e8ce2770b1 | ||
![]() |
e3a521d817 | ||
![]() |
0de6cf5fdd | ||
![]() |
620b3e680c | ||
![]() |
b7f1d51b9c | ||
![]() |
ed6d8e185a | ||
![]() |
fb47b6cb4b | ||
![]() |
5db095793a | ||
![]() |
7dbfeeeb94 | ||
![]() |
e604662d04 | ||
![]() |
77eddee375 | ||
![]() |
fca28d35e4 | ||
![]() |
9d0f7a8d78 | ||
![]() |
df6f2daccf | ||
![]() |
0cb600b7bf | ||
![]() |
c5c141bc69 | ||
![]() |
6c98d5e7c8 | ||
![]() |
27a88f9d45 | ||
![]() |
77f5302465 | ||
![]() |
6d6ca8b82e | ||
![]() |
1ca226989c | ||
![]() |
a4cb97067b | ||
![]() |
4fad45ad14 | ||
![]() |
1674c5beaf | ||
![]() |
11142fb83b | ||
![]() |
002bbc3687 | ||
![]() |
1ea58c6c6a | ||
![]() |
917544b2ea | ||
![]() |
873b08f411 | ||
![]() |
63ef4014c5 | ||
![]() |
0324008de6 | ||
![]() |
49ad1658b2 | ||
![]() |
3b136179a3 | ||
![]() |
48127e2ad6 | ||
![]() |
860dc1e19b | ||
![]() |
be6a569e3a | ||
![]() |
e920af2cdf | ||
![]() |
12e166dacb | ||
![]() |
80cec4e496 | ||
![]() |
f2e3d5adb3 | ||
![]() |
5019f8d10c | ||
![]() |
476cf3eb7e | ||
![]() |
47e9508485 | ||
![]() |
cd85dd1373 | ||
![]() |
a5e8ca7e73 | ||
![]() |
c049e979b6 | ||
![]() |
7b1c5fa5e5 | ||
![]() |
008229b7f9 | ||
![]() |
3ea15a4547 | ||
![]() |
31dd783631 | ||
![]() |
c10871aca8 | ||
![]() |
b477f97ab9 | ||
![]() |
c7ef69c23c | ||
![]() |
274121179f | ||
![]() |
1c5d25f2c0 | ||
![]() |
35e46e74bc | ||
![]() |
d15f4f5f22 | ||
![]() |
0afa8a6c85 | ||
![]() |
33ec70785f | ||
![]() |
3c7e41df27 | ||
![]() |
6b4c6b7ff5 | ||
![]() |
e21db6e339 | ||
![]() |
e354ec95d6 | ||
![]() |
2b31264e1a | ||
![]() |
c2595b4485 | ||
![]() |
c8377cc49b | ||
![]() |
ed5bfeca04 | ||
![]() |
7050d07562 | ||
![]() |
19cef664fe | ||
![]() |
9d749d69b2 | ||
![]() |
d6d328c294 | ||
![]() |
9591f2fe94 | ||
![]() |
b46ae71f29 | ||
![]() |
c40aa4704f | ||
![]() |
3ea2ffc284 | ||
![]() |
9e3723b848 | ||
![]() |
63716cebb7 | ||
![]() |
665b34df73 | ||
![]() |
4947158b1f | ||
![]() |
308bcf53f9 | ||
![]() |
4db46cf520 | ||
![]() |
cb921dd47f | ||
![]() |
9c3d306ba4 | ||
![]() |
d4d8c3553d | ||
![]() |
bd9313d9f8 | ||
![]() |
6270401561 | ||
![]() |
862ba8b4b4 | ||
![]() |
94a3d2e49c | ||
![]() |
4c2a1e673b | ||
![]() |
3bb17d2692 | ||
![]() |
a5e18e900f | ||
![]() |
8c5d196f50 | ||
![]() |
678a189e5d | ||
![]() |
e2054a8b55 | ||
![]() |
ecd3cce0ec | ||
![]() |
81d923f14b | ||
![]() |
a6bdfd9b46 | ||
![]() |
df408d213a | ||
![]() |
7e5a298bce | ||
![]() |
d9dd0cbe63 | ||
![]() |
1f7343c814 | ||
![]() |
af5917698b | ||
![]() |
b58cbb07bc | ||
![]() |
dd9789ab6d | ||
![]() |
aded27a30b | ||
![]() |
a1f68d9518 | ||
![]() |
2612b69d3f | ||
![]() |
88217c40b6 | ||
![]() |
001cc6d27a | ||
![]() |
ea6bd45885 | ||
![]() |
51850d9a2c | ||
![]() |
211ec9196d | ||
![]() |
e4318f6875 | ||
![]() |
008c1debb9 | ||
![]() |
f33bd39d27 | ||
![]() |
0337770352 | ||
![]() |
ab8f686bbc | ||
![]() |
b5a942685f | ||
![]() |
7e2ea1cb70 | ||
![]() |
10e1108732 | ||
![]() |
3da0395b34 | ||
![]() |
25d50ad814 | ||
![]() |
fb564cd21d | ||
![]() |
10609d8864 | ||
![]() |
dbc48ba1cd | ||
![]() |
19ffa15d2d | ||
![]() |
531ea97b89 | ||
![]() |
0a5b242422 | ||
![]() |
f43fb74ad4 | ||
![]() |
0463e9d6da | ||
![]() |
e8784ec5f5 | ||
![]() |
0a93dc83d2 | ||
![]() |
bced2ad1bd | ||
![]() |
fe22d0d7c6 | ||
![]() |
a5167b4d66 | ||
![]() |
3123cb5d0b | ||
![]() |
375a97bb70 | ||
![]() |
0fc6a95116 | ||
![]() |
f93412406f | ||
![]() |
05eddbbc05 | ||
![]() |
75b21eb8f8 | ||
![]() |
1933fa5daa | ||
![]() |
bd05ac1df8 | ||
![]() |
8d0f079c45 | ||
![]() |
889a4779eb | ||
![]() |
a9d3baff03 | ||
![]() |
f4ce752f22 | ||
![]() |
02532e1162 | ||
![]() |
b1652fbb9e | ||
![]() |
39236d5618 | ||
![]() |
38e628fd6d | ||
![]() |
cf6cbcca7e | ||
![]() |
df9eca44f8 | ||
![]() |
a563a1468f | ||
![]() |
fd17e34217 | ||
![]() |
ec17706e5c | ||
![]() |
e0f85f10c8 | ||
![]() |
9ccaeff67a | ||
![]() |
4a46a29b07 | ||
![]() |
22ef88ee30 | ||
![]() |
48e53620e0 | ||
![]() |
8a7748e1de | ||
![]() |
86a360e349 | ||
![]() |
07ad029d1b | ||
![]() |
b53b6a25e2 | ||
![]() |
83ee63e7f8 | ||
![]() |
536093824d | ||
![]() |
485f53548b | ||
![]() |
2ac7a0d999 | ||
![]() |
b35d67fa51 | ||
![]() |
b942813a41 | ||
![]() |
a75f293264 | ||
![]() |
33862c1f6d | ||
![]() |
89fbae7686 | ||
![]() |
3f9ecaf886 | ||
![]() |
50dc37f281 | ||
![]() |
6c39528a3a | ||
![]() |
9b0c9261cc | ||
![]() |
9fc45b313c | ||
![]() |
d9390b9d64 | ||
![]() |
5a8b43285b | ||
![]() |
8e94e5d339 | ||
![]() |
73cf5d9a28 | ||
![]() |
ac83399281 | ||
![]() |
9bcaf90378 | ||
![]() |
d9249b5582 | ||
![]() |
66b95ee4df | ||
![]() |
0f7e67be3a | ||
![]() |
0856eea770 | ||
![]() |
04f80ed3f8 | ||
![]() |
c6f6be93ac | ||
![]() |
c6418be043 | ||
![]() |
f78d7e6a03 | ||
![]() |
0cb8d786f2 | ||
![]() |
c74846388b | ||
![]() |
35013fa23a | ||
![]() |
33d77bc384 | ||
![]() |
e6a5023d1f | ||
![]() |
99e737a7c7 | ||
![]() |
835037506b | ||
![]() |
2f290cf881 | ||
![]() |
2523bdcd67 | ||
![]() |
9b87d15ca8 | ||
![]() |
a13a288ec8 | ||
![]() |
9f2c8734b9 | ||
![]() |
d35086d715 | ||
![]() |
be1b665dec | ||
![]() |
47f5f6b230 | ||
![]() |
01291b4e2f | ||
![]() |
787e094ed0 | ||
![]() |
2f8f4351b8 | ||
![]() |
f77cb3d4a6 | ||
![]() |
3258e12d8c | ||
![]() |
84cd276d0e | ||
![]() |
a298e13c2c | ||
![]() |
50fb69c737 | ||
![]() |
9c826d8d51 | ||
![]() |
4aa4c78dae | ||
![]() |
7b13aef5d2 | ||
![]() |
aebafed24f | ||
![]() |
4ea7ff4354 | ||
![]() |
262c678357 | ||
![]() |
763ab41f77 | ||
![]() |
76ee9fdb61 | ||
![]() |
692fd5635f | ||
![]() |
c3b1261afa | ||
![]() |
04fd0250e1 | ||
![]() |
6f236d3774 | ||
![]() |
c1c245e1a3 | ||
![]() |
369f46aae3 | ||
![]() |
05b448082a | ||
![]() |
b4bfbbfb95 | ||
![]() |
e6d9094fd3 | ||
![]() |
bcc4c360aa | ||
![]() |
8be177e048 | ||
![]() |
7d5908d5c8 | ||
![]() |
3550d239a6 | ||
![]() |
d3f96c1e3c | ||
![]() |
ac07ab7db7 | ||
![]() |
9bff35abde | ||
![]() |
9ee7fcdcd0 | ||
![]() |
f1b4a71ddf | ||
![]() |
fa538f1a8c | ||
![]() |
7689fe5cfd | ||
![]() |
f597b9f04e | ||
![]() |
037d6cf580 | ||
![]() |
8bd7bf1a3c | ||
![]() |
f90c9bbbca | ||
![]() |
f2abcdedfe | ||
![]() |
eebd161e76 | ||
![]() |
6a4d1325e2 | ||
![]() |
dfce316c12 | ||
![]() |
87e2a689a8 | ||
![]() |
e9eb9839bd | ||
![]() |
c3be71001c | ||
![]() |
f3deed98ec | ||
![]() |
7439ed2f39 | ||
![]() |
40607290c9 | ||
![]() |
a9e683bb7a | ||
![]() |
0edf9c6907 | ||
![]() |
b2c9cd36d3 | ||
![]() |
b3e6d3ee78 | ||
![]() |
f6327e5fa6 | ||
![]() |
b80c486fb3 | ||
![]() |
37469af294 | ||
![]() |
350054e8e2 | ||
![]() |
7ff46a20d5 | ||
![]() |
7edd380668 | ||
![]() |
26bed98d64 | ||
![]() |
480e18e6ff | ||
![]() |
742bc7eea8 | ||
![]() |
c58edf52f9 | ||
![]() |
ea52c0614c | ||
![]() |
5e84ab838c | ||
![]() |
3f7b89937d | ||
![]() |
39c9b47bb6 | ||
![]() |
016bf7cb81 | ||
![]() |
bb00821f62 | ||
![]() |
d9dbd2362d | ||
![]() |
ec684aa58a | ||
![]() |
a613dd627c | ||
![]() |
1903d6d2b0 | ||
![]() |
2319fddfd3 | ||
![]() |
5a6ef7d7cb | ||
![]() |
47e8d17132 | ||
![]() |
a156f86e91 | ||
![]() |
3586314147 | ||
![]() |
28e17ba220 | ||
![]() |
998173ed94 | ||
![]() |
bffed1d9d0 | ||
![]() |
52bf144ad9 | ||
![]() |
6fc8c72c7d | ||
![]() |
77621ca311 | ||
![]() |
1a89aab3c0 | ||
![]() |
c43e5faf03 | ||
![]() |
876d2d8db8 | ||
![]() |
1caad74533 | ||
![]() |
28950d1f8c | ||
![]() |
791e085634 | ||
![]() |
3dc88e1fd6 | ||
![]() |
4e2cab5a79 | ||
![]() |
1dab67b647 | ||
![]() |
0d4549c2d6 | ||
![]() |
c741eb7d88 |
244
Changelog
244
Changelog
@ -1,6 +1,247 @@
|
|||||||
Entries are sorted chronologically from oldest to youngest within each release,
|
Entries are sorted chronologically from oldest to youngest within each release,
|
||||||
releases are sorted from youngest to oldest.
|
releases are sorted from youngest to oldest.
|
||||||
|
|
||||||
|
version 2.6.4:
|
||||||
|
- imc: use correct position for flcoeffs2 calculation
|
||||||
|
- hevc: check slice address length
|
||||||
|
- snow: remove an obsolete av_assert2
|
||||||
|
- webp: fix infinite loop in webp_decode_frame
|
||||||
|
- wavpack: limit extra_bits to 32 and use get_bits_long
|
||||||
|
- ffmpeg: only count got_output/errors in decode_error_stat
|
||||||
|
- ffmpeg: exit_on_error if decoding a packet failed
|
||||||
|
- pthread_frame: forward error codes when flushing
|
||||||
|
- huffyuvdec: validate image size
|
||||||
|
- wavpack: use get_bits_long to read up to 32 bits
|
||||||
|
- nutdec: check maxpos in read_sm_data before returning success
|
||||||
|
- vc1dec: use get_bits_long and limit the read bits to 32
|
||||||
|
- mpegaudiodec: copy AVFloatDSPContext from first context to all contexts
|
||||||
|
- avcodec/vp8: Check buffer size in vp8_decode_frame_header()
|
||||||
|
- avcodec/vp8: Fix null pointer dereference in ff_vp8_decode_free()
|
||||||
|
- avcodec/diracdec: Check for hpel_base allocation failure
|
||||||
|
- avcodec/rv34: Clear pointers in ff_rv34_decode_init_thread_copy()
|
||||||
|
- avfilter/af_aresample: Check ff_all_* for allocation failures
|
||||||
|
- avcodec/pthread_frame: clear priv_data, avoid stale pointer in error case
|
||||||
|
- swscale/utils: Clear pix buffers
|
||||||
|
- avutil/fifo: Fix the case where func() returns less bytes than requested in av_fifo_generic_write()
|
||||||
|
- ffmpeg: Fix cleanup after failed allocation of output_files
|
||||||
|
- avformat/mov: Fix deallocation when MOVStreamContext failed to allocate
|
||||||
|
- ffmpeg: Fix crash with ost->last_frame allocation failure
|
||||||
|
- ffmpeg: Fix cleanup with ost = NULL
|
||||||
|
- avcodec/pthread_frame: check avctx on deallocation
|
||||||
|
- avcodec/sanm: Reset sizes in destroy_buffers()
|
||||||
|
- avcodec/alac: Clear pointers in allocate_buffers()
|
||||||
|
- bytestream2: set the reader to the end when reading more than available
|
||||||
|
- avcodec/utils: use a minimum 32pixel width in avcodec_align_dimensions2() for H.264
|
||||||
|
- avcodec/mpegvideo: Clear pointers in ff_mpv_common_init()
|
||||||
|
- oggparsedirac: check return value of init_get_bits
|
||||||
|
- wmalosslessdec: reset frame->nb_samples on packet loss
|
||||||
|
- wmalosslessdec: avoid reading 0 bits with get_bits
|
||||||
|
- avcodec/rawenc: Use ff_alloc_packet() instead of ff_alloc_packet2()
|
||||||
|
- avcodec/aacsbr: Assert that bs_num_env is positive
|
||||||
|
- avcodec/aacsbr: check that the element type matches before applying SBR
|
||||||
|
- avcodec/h264_slice: Use w/h from the AVFrame instead of mb_w/h
|
||||||
|
- vp9/update_prob: prevent out of bounds table read
|
||||||
|
- avfilter/vf_transpose: Fix rounding error
|
||||||
|
- avcodec/pngdec: Check values before updating context in decode_fctl_chunk()
|
||||||
|
- avcodec/pngdec: Require a IHDR chunk before fctl
|
||||||
|
- avcodec/pngdec: Only allow one IHDR chunk
|
||||||
|
- wmavoice: limit wmavoice_decode_packet return value to packet size
|
||||||
|
- swscale/swscale_unscaled: Fix rounding difference with RGBA output between little and big endian
|
||||||
|
- ffmpeg: Do not use the data/size of a bitstream filter after failure
|
||||||
|
- swscale/x86/rgb2rgb_template: fix signedness of v in shuffle_bytes_2103_{mmx,mmxext}
|
||||||
|
- swscale/x86/rgb2rgb_template: add missing xmm clobbers
|
||||||
|
- vda: unlock the pixel buffer base address.
|
||||||
|
- swscale/rgb2rgb_template: Fix signedness of v in shuffle_bytes_2103_c()
|
||||||
|
- swscale/rgb2rgb_template: Implement shuffle_bytes_0321_c and fix shuffle_bytes_2103_c on BE
|
||||||
|
- swscale/rgb2rgb_template: Disable shuffle_bytes_2103_c on big endian
|
||||||
|
- swr: Remember previously set int_sample_format from user
|
||||||
|
- matroskadec: check audio sample rate
|
||||||
|
- matroskadec: validate audio channels and bitdepth
|
||||||
|
- avcodec/dpxenc: implement write16/32 as functions
|
||||||
|
- postproc: fix unaligned access
|
||||||
|
- ffmpeg: Free last_frame instead of just unref
|
||||||
|
- avio: fix potential crashes when combining ffio_ensure_seekback + crc
|
||||||
|
- examples/demuxing_decoding: use properties from frame instead of video_dec_ctx
|
||||||
|
- h264: er: Copy from the previous reference only if compatible
|
||||||
|
- sonic: set avctx->channels in sonic_decode_init
|
||||||
|
- vp8: change mv_{min,max}.{x,y} type to int
|
||||||
|
- vp9: change type of tile_size from unsigned to int64_t
|
||||||
|
- arm: only enable setend on ARMv6
|
||||||
|
- libopenjpegdec: check existence of image component data
|
||||||
|
- mov: abort on EOF in ff_mov_read_chan
|
||||||
|
- ffmpeg_opt: Check for localtime() failure
|
||||||
|
- avformat: Fix bug in parse_rps for HEVC.
|
||||||
|
- takdec: ensure chan2 is a valid channel index
|
||||||
|
- avcodec/h264_slice: Use AVFrame diemensions for grayscale handling
|
||||||
|
- avdevice/lavfi: do not rescale AV_NOPTS_VALUE in lavfi_read_packet()
|
||||||
|
- libavutil/channel_layout: Correctly return layout when channel specification ends with a trailing 'c'.
|
||||||
|
- avcodec/jpeg2000dec: Check that coords match before applying ICT
|
||||||
|
- avformat/ffmdec: Check ffio_set_buf_size() return value
|
||||||
|
- avcodec/adpcm: Check for overreads
|
||||||
|
- avcodec/alsdec: Check for overread
|
||||||
|
- avcodec/atrac3plusdec: consume only as many bytes as available
|
||||||
|
- libavutil/softfloat: Fix av_normalize1_sf bias.
|
||||||
|
- swresample/swresample: Cleanup on init failure.
|
||||||
|
- Revert "avformat/rtpenc: check av_packet_get_side_data() return, fix null ptr dereference"
|
||||||
|
- avformat/mxfenc: Accept MXF D-10 with 49.999840 Mbit/sec
|
||||||
|
- swresample/dither: check memory allocation
|
||||||
|
- libopenjpegenc: add NULL check for img before accessing it
|
||||||
|
- swresample: Check the return value of resampler->init()
|
||||||
|
- h264: Make sure reinit failures mark the context as not initialized
|
||||||
|
- avfilter/x86/vf_fspp: Fix invalid combination of opcode and operands
|
||||||
|
- ffmpeg_opt: Set the video VBV parameters only for the video stream from -target
|
||||||
|
- avcodec/bitstream: Assert that there is enough space left in avpriv_copy_bits()
|
||||||
|
- avcodec/put_bits: Assert that there is enough space left in skip_put_bytes()
|
||||||
|
- avcodec/mpegvideo_enc: Update the buffer size as more slices are merged
|
||||||
|
- avcodec/put_bits: Update size_in_bits in set_put_bits_buffer_size()
|
||||||
|
- avformat/wavdec: Increase dts packet threshold to fix more misdetections
|
||||||
|
- avformat/wavdec: Increase probe_packets limit
|
||||||
|
- nutdec: abort if EOF is reached in decode_info_header/read_sm_data
|
||||||
|
- nutdec: stop skipping bytes at EOF
|
||||||
|
- nutdec: fix infinite resync loops
|
||||||
|
- avformat/nutdec: Check X in 2nd branch of index reading
|
||||||
|
- avformat/nutdec: Fix recovery when immedeately after seeking a failure happens
|
||||||
|
- avformat/nutdec: Return error on EOF from get_str()
|
||||||
|
- rtsp: Make sure we don't write too many transport entries into a fixed-size array
|
||||||
|
- rtpenc_jpeg: handle case of picture dimensions not dividing by 8
|
||||||
|
- avcodec/golomb: get_ur_golomb_jpegls: Fix reading huge k values
|
||||||
|
- avformat/swfdec: Do not error out on pixel format changes
|
||||||
|
- avformat/mov: Mark avio context of decompressed atoms as seekable
|
||||||
|
- avcodec/mjpegenc_common: Use ff_mpv_reallocate_putbitbuffer()
|
||||||
|
- avcodec/mpegvideo: Factor ff_mpv_reallocate_putbitbuffer() out
|
||||||
|
- avfilter/x86/vf_hqdn3d: Fix register types
|
||||||
|
- avcodec/exr: fix crash caused by merge
|
||||||
|
- avcodec/x86/h264_weight: handle weight1=128
|
||||||
|
- avcodec/dvbsubdec: Fix buf_size check in dvbsub_parse_display_definition_segment()
|
||||||
|
- avcodec/hevc_ps: Only discard overread VPS if a previous is available
|
||||||
|
- avcodec/flacenc: Fix Invalid Rice order
|
||||||
|
- lavd/xcbgrab: fix comparison with screen size.
|
||||||
|
|
||||||
|
version 2.6.3:
|
||||||
|
- avcodec/libtheoraenc: Check for av_malloc failure
|
||||||
|
- ffmpeg_opt: Fix -timestamp parsing
|
||||||
|
- hevc: make avcodec_decode_video2() fail if get_format() fails
|
||||||
|
- avcodec/cavsdec: Use ff_set_dimensions()
|
||||||
|
- swr: fix alignment issue caused by 8ch sse functions
|
||||||
|
- avcodec/mjpegdec: fix len computation in ff_mjpeg_decode_dqt()
|
||||||
|
- avcodec/jpeg2000dec: fix boolean operator
|
||||||
|
- avcodec/hevc_ps: Explicitly check num_tile_* for negative values
|
||||||
|
- avformat/matroskadec: Cleanup error handling for bz2 & zlib
|
||||||
|
- avformat/nutdec: Fix use of uinitialized value
|
||||||
|
- tools/graph2dot: use larger data types than int for array/string sizes
|
||||||
|
- avformat/matroskaenc: Check ff_vorbiscomment_length in put_flac_codecpriv()
|
||||||
|
- avcodec/mpeg12dec: use the correct dimensions for checking SAR
|
||||||
|
- xcbgrab: Validate the capture area
|
||||||
|
- xcbgrab: Do not assume the non shm image data is always available
|
||||||
|
- avfilter/lavfutils: disable frame threads when decoding a single image
|
||||||
|
- avformat/mov: Do not read ACLR into extradata for H.264
|
||||||
|
- ffmpeg: remove incorrect network deinit
|
||||||
|
- OpenCL: Avoid potential buffer overflow in cmdutils_opencl.c
|
||||||
|
- libvpxenc: only set noise reduction w/vp8
|
||||||
|
- vp9: remove another optimization branch in iadst16 which causes overflows.
|
||||||
|
- lavf: Reset global flag on deinit
|
||||||
|
- network: Do not leave context locked on error
|
||||||
|
- vp9: remove one optimization branch in iadst16 which causes overflows.
|
||||||
|
- fate: Include branch information in the payload header
|
||||||
|
- avformat/utils: Ensure that AVFMT_FLAG_CUSTOM_IO is set before use
|
||||||
|
- avformat/img2dec: do not rewind custom io buffers
|
||||||
|
- avcodec/alsdec: Use av_mallocz_array() for chan_data to ensure the arrays never contain random data
|
||||||
|
- avcodec/atrac3plusdsp: fix on stack alignment
|
||||||
|
- swresample/swresample-test: Randomly wipe out channel counts
|
||||||
|
- swresample: Check channel layouts and channels against each other and print human readable error messages
|
||||||
|
- swresample: Allow reinitialization without ever setting channel layouts (cherry picked from commit 80a28c7509a11114e1aea5b208d56c6646d69c07)
|
||||||
|
- swresample: Allow reinitialization without ever setting channel counts
|
||||||
|
- dashenc: replace attribute id with contentType for the AdaptationSet element
|
||||||
|
- avformat/matroskaenc: Use avoid_negative_ts_use_pts if no stream writes dts
|
||||||
|
- avformat/mux: Add avoid_negative_ts_use_pts
|
||||||
|
- tests/fate-run: do not attempt to parse tiny_psnrs output if it failed
|
||||||
|
- cafdec: free extradata before allocating it
|
||||||
|
- imgutils: initialize palette padding bytes in av_image_alloc
|
||||||
|
- aacdec: don't return frames without data
|
||||||
|
- id3v2: catch avio_read errors in check_tag
|
||||||
|
- avi: Validate sample_size
|
||||||
|
- aacsbr: break infinite loop in sbr_hf_calc_npatches
|
||||||
|
- diracdec: avoid overflow of bytes*8 in decode_lowdelay
|
||||||
|
- diracdec: prevent overflow in data_unit_size check
|
||||||
|
- avformat/matroskadec: Use tracks[k]->stream instead of s->streams[k]
|
||||||
|
- matroskadec: use uint64_t instead of int for index_scale
|
||||||
|
- pngdec: don't use AV_PIX_FMT_MONOBLACK for apng
|
||||||
|
- pngdec: return correct error code from decode_frame_common
|
||||||
|
- nutdec: fix illegal count check in decode_main_header
|
||||||
|
- nutdec: fix memleaks on error in nut_read_header
|
||||||
|
- apedec: prevent out of array writes in decode_array_0000
|
||||||
|
- apedec: set s->samples only when init_frame_decoder succeeded
|
||||||
|
- swscale/ppc/swscale_altivec.c: POWER LE support in yuv2planeX_8() delete macro GET_VF() it was wrong
|
||||||
|
- alac: reject rice_limit 0 if compression is used
|
||||||
|
- alsdec: only adapt order for positive max_order
|
||||||
|
- bink: check vst->index_entries before using it
|
||||||
|
- mpeg4videodec: only allow a positive length
|
||||||
|
- aacpsy: correct calculation of minath in psy_3gpp_init
|
||||||
|
- alsdec: validate time diff index
|
||||||
|
- alsdec: ensure channel reordering is reversible
|
||||||
|
- ac3: validate end in ff_ac3_bit_alloc_calc_mask
|
||||||
|
- aacpsy: avoid psy_band->threshold becoming NaN
|
||||||
|
- aasc: return correct buffer size from aasc_decode_frame
|
||||||
|
- matroskadec: export cover art correctly
|
||||||
|
- mxfenc: don't try to write footer without header
|
||||||
|
- mxfenc: fix memleaks in mxf_write_footer
|
||||||
|
- rtpenc_mpegts: Set chain->rtp_ctx only after avformat_write_header succeeded
|
||||||
|
- rtpenc_mpegts: Free the right ->pb in the error path in the init function
|
||||||
|
|
||||||
|
version 2.6.2:
|
||||||
|
- avcodec/h264: Do not fail with randomly truncated VUIs
|
||||||
|
- avcodec/h264_ps: Move truncation check from VUI to SPS
|
||||||
|
- avcodec/h264: Be more tolerant to changing pps id between slices
|
||||||
|
- avcodec/aacdec: Fix storing state before PCE decode
|
||||||
|
- avcodec/h264: reset the counts in the correct context
|
||||||
|
- avcodec/h264_slice: Do not reset mb_aff_frame per slice
|
||||||
|
- avcodec/h264: finish previous slices before switching to single thread mode
|
||||||
|
- avcodec/h264: Fix race between slices where one overwrites data from the next
|
||||||
|
- avformat/utils: avoid discarded streams in av_find_default_stream_index()
|
||||||
|
- ffmpeg: Fix extradata allocation
|
||||||
|
- avcodec/h264_refs: Do not set reference to things which do not exist
|
||||||
|
- avcodec/h264: Fail for invalid mixed IDR / non IDR frames in slice threading mode
|
||||||
|
- Revert "avcodec/exr: fix memset first arg in reverse_lut()"
|
||||||
|
- h264: avoid unnecessary calls to get_format
|
||||||
|
- avutil/pca: Check for av_malloc* failures
|
||||||
|
- avutil/cpu: add missing check for mmxext to av_force_cpu_flags
|
||||||
|
- lavc/dnxhd: Fix pix_fmt change.
|
||||||
|
- avformat/http: replace cookies with updated values instead of appending forever
|
||||||
|
- avformat/hls: store cookies returned in HLS key response
|
||||||
|
- avformat/rmdec: fix support for 0 sized mdpr
|
||||||
|
- avcodec/msrledec: restructure msrle_decode_pal4() based on the line number instead of the pixel pointer
|
||||||
|
- avcodec/hevc_ps: Check cropping parameters more correctly
|
||||||
|
- hevc: make the crop sizes unsigned
|
||||||
|
- avcodec/dnxhddec: Reset is_444 if format is not 444
|
||||||
|
- avcodec/dnxhddec: Check that the frame is interlaced before using cur_field
|
||||||
|
- mips/float_dsp: fix vector_fmul_window_mips on mips64
|
||||||
|
- doc: Remove non-existing decklink options.
|
||||||
|
|
||||||
|
version 2.6.1:
|
||||||
|
- avformat/mov: Disallow ".." in dref unless use_absolute_path is set
|
||||||
|
- avfilter/palettegen: make sure at least one frame was sent to the filter
|
||||||
|
- avformat/mov: Check for string truncation in mov_open_dref()
|
||||||
|
- ac3_fixed: fix out-of-bound read
|
||||||
|
- mips/asmdefs: use _ABI64 as defined by gcc
|
||||||
|
- hevc: delay ff_thread_finish_setup for hwaccel
|
||||||
|
- avcodec/012v: Check dimensions more completely
|
||||||
|
- asfenc: fix leaking asf->index_ptr on error
|
||||||
|
- roqvideoenc: set enc->avctx in roq_encode_init
|
||||||
|
- avcodec/options_table: remove extradata_size from the AVOptions table
|
||||||
|
- ffmdec: limit the backward seek to the last resync position
|
||||||
|
- Add dependencies to configure file for vf_fftfilt
|
||||||
|
- ffmdec: make sure the time base is valid
|
||||||
|
- ffmdec: fix infinite loop at EOF
|
||||||
|
- ffmdec: initialize f_cprv, f_stvi and f_stau
|
||||||
|
- arm: Suppress tags about used cpu arch and extensions
|
||||||
|
- mxfdec: Fix the error handling for when strftime fails
|
||||||
|
- avcodec/opusdec: Fix delayed sample value
|
||||||
|
- avcodec/opusdec: Clear out pointers per packet
|
||||||
|
- avcodec/utils: Align YUV411 by as much as the other YUV variants
|
||||||
|
- lavc/hevcdsp: Fix compilation for arm with --disable-neon.
|
||||||
|
- vp9: fix segmentation map retention with threading enabled.
|
||||||
|
- Revert "avutil/opencl: is_compiled flag not being cleared in av_opencl_uninit"
|
||||||
|
|
||||||
version 2.6:
|
version 2.6:
|
||||||
- nvenc encoder
|
- nvenc encoder
|
||||||
- 10bit spp filter
|
- 10bit spp filter
|
||||||
@ -35,8 +276,7 @@ version 2.6:
|
|||||||
- Fix stsd atom corruption in DNxHD QuickTimes
|
- Fix stsd atom corruption in DNxHD QuickTimes
|
||||||
- Canopus HQX decoder
|
- Canopus HQX decoder
|
||||||
- RTP depacketization of T.140 text (RFC 4103)
|
- RTP depacketization of T.140 text (RFC 4103)
|
||||||
- VP9 RTP payload format (draft 0) experimental depacketizer
|
- Port MIPS optimizations to 64-bit
|
||||||
- Port MIPS opttimizations to 64-bit
|
|
||||||
|
|
||||||
|
|
||||||
version 2.5:
|
version 2.5:
|
||||||
|
@ -545,6 +545,7 @@ x86 Michael Niedermayer
|
|||||||
Releases
|
Releases
|
||||||
========
|
========
|
||||||
|
|
||||||
|
2.6 Michael Niedermayer
|
||||||
2.5 Michael Niedermayer
|
2.5 Michael Niedermayer
|
||||||
2.4 Michael Niedermayer
|
2.4 Michael Niedermayer
|
||||||
2.2 Michael Niedermayer
|
2.2 Michael Niedermayer
|
||||||
|
65
RELEASE_NOTES
Normal file
65
RELEASE_NOTES
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
|
||||||
|
┌─────────────────────────────────────────────┐
|
||||||
|
│ RELEASE NOTES for FFmpeg 2.6 "Grothendieck" │
|
||||||
|
└─────────────────────────────────────────────┘
|
||||||
|
|
||||||
|
The FFmpeg Project proudly presents FFmpeg 2.6 "Grothendieck", about 3
|
||||||
|
months after the release of FFmpeg 2.5.
|
||||||
|
|
||||||
|
A lot of important work got in this time, so let's start talking about what
|
||||||
|
we like to brag the most about: features.
|
||||||
|
|
||||||
|
A lot of people will probably be happy to hear that we now have support for
|
||||||
|
NVENC — the Nvidia Video Encoder interface for H.264 encoding — thanks to
|
||||||
|
Timo Rothenpieler, with some little help from NVIDIA and Philip Langdale.
|
||||||
|
|
||||||
|
People in the broadcasting industry might also be interested in the first
|
||||||
|
steps of closed captions support with the introduction of a decoder by
|
||||||
|
Anshul Maheswhwari.
|
||||||
|
|
||||||
|
Regarding filters love, we improved and added many. We could talk about the
|
||||||
|
10-bit support in spp, but maybe it's more important to mention the addition
|
||||||
|
of colorlevels (yet another color handling filter), tblend (allowing you
|
||||||
|
to for example run a diff between successive frames of a video stream), or
|
||||||
|
the dcshift audio filter.
|
||||||
|
|
||||||
|
There are also two other important filters landing in libavfilter: palettegen
|
||||||
|
and paletteuse. Both submitted by the Stupeflix company. These filters will
|
||||||
|
be very useful in case you are looking for creating high quality GIFs, a
|
||||||
|
format that still bravely fights annihilation in 2015.
|
||||||
|
|
||||||
|
There are many other new features, but let's follow-up on one big cleanup
|
||||||
|
achievement: the libmpcodecs (MPlayer filters) wrapper is finally dead. The
|
||||||
|
last remaining filters (softpulldown/repeatfields, eq*, and various
|
||||||
|
postprocessing filters) were ported by Arwa Arif (OPW student) and Paul B
|
||||||
|
Mahol.
|
||||||
|
|
||||||
|
Concerning API changes, there are not many things to mention. Though, the
|
||||||
|
introduction of device inputs and outputs listing by Lukasz Marek is a
|
||||||
|
notable addition (try ffmpeg -sources or ffmpeg -sinks for an example of
|
||||||
|
the usage). As usual, see doc/APIchanges for more information.
|
||||||
|
|
||||||
|
Now let's talk about optimizations. Ronald S. Bultje made the VP9 decoder
|
||||||
|
usable on x86 32-bit systems and pre-ssse3 CPUs like Phenom (even dual core
|
||||||
|
Athlons can play 1080p 30fps VP9 content now), so we now secretly hope for
|
||||||
|
Google and Mozilla to use ffvp9 instead of libvpx. But VP9 is not the
|
||||||
|
center of attention anymore, and HEVC/H.265 is also getting many
|
||||||
|
improvements, which include C and x86 ASM optimizations, mainly from James
|
||||||
|
Almer, Christophe Gisquet and Pierre-Edouard Lepere.
|
||||||
|
|
||||||
|
Even though we had many x86 contributions, it is not the only architecture
|
||||||
|
getting some love, with Seppo Tomperi adding ARM NEON optimizations to the
|
||||||
|
HEVC stack, and James Cowgill adding MIPS64 assembly for all kind of audio
|
||||||
|
processing code in libavcodec.
|
||||||
|
|
||||||
|
And finally, Michael Niedermayer is still fixing many bugs, dealing with
|
||||||
|
most of the boring work such as making releases, applying tons of
|
||||||
|
contributors patches, and daily merging the changes from the Libav project.
|
||||||
|
|
||||||
|
A more complete Changelog is available at the root of the project, and the
|
||||||
|
complete Git history on http://source.ffmpeg.org.
|
||||||
|
|
||||||
|
We hope you will like this release as much as we enjoyed working on it, and
|
||||||
|
as usual, if you have any questions about it, or any FFmpeg related topic,
|
||||||
|
feel free to join us on the #ffmpeg IRC channel (on irc.freenode.net) or ask
|
||||||
|
on the mailing-lists.
|
@ -22,6 +22,7 @@
|
|||||||
#include "libavutil/time.h"
|
#include "libavutil/time.h"
|
||||||
#include "libavutil/log.h"
|
#include "libavutil/log.h"
|
||||||
#include "libavutil/opencl.h"
|
#include "libavutil/opencl.h"
|
||||||
|
#include "libavutil/avstring.h"
|
||||||
#include "cmdutils.h"
|
#include "cmdutils.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -238,7 +239,8 @@ int opt_opencl_bench(void *optctx, const char *opt, const char *arg)
|
|||||||
devices[count].platform_idx = i;
|
devices[count].platform_idx = i;
|
||||||
devices[count].device_idx = j;
|
devices[count].device_idx = j;
|
||||||
devices[count].runtime = score;
|
devices[count].runtime = score;
|
||||||
strcpy(devices[count].device_name, device_node->device_name);
|
av_strlcpy(devices[count].device_name, device_node->device_name,
|
||||||
|
sizeof(devices[count].device_name));
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
9
configure
vendored
9
configure
vendored
@ -1769,6 +1769,7 @@ SYSTEM_FUNCS="
|
|||||||
TOOLCHAIN_FEATURES="
|
TOOLCHAIN_FEATURES="
|
||||||
as_dn_directive
|
as_dn_directive
|
||||||
as_func
|
as_func
|
||||||
|
as_object_arch
|
||||||
asm_mod_q
|
asm_mod_q
|
||||||
attribute_may_alias
|
attribute_may_alias
|
||||||
attribute_packed
|
attribute_packed
|
||||||
@ -2595,6 +2596,8 @@ deshake_filter_select="pixelutils"
|
|||||||
drawtext_filter_deps="libfreetype"
|
drawtext_filter_deps="libfreetype"
|
||||||
ebur128_filter_deps="gpl"
|
ebur128_filter_deps="gpl"
|
||||||
eq_filter_deps="gpl"
|
eq_filter_deps="gpl"
|
||||||
|
fftfilt_filter_deps="avcodec"
|
||||||
|
fftfilt_filter_select="rdft"
|
||||||
flite_filter_deps="libflite"
|
flite_filter_deps="libflite"
|
||||||
frei0r_filter_deps="frei0r dlopen"
|
frei0r_filter_deps="frei0r dlopen"
|
||||||
frei0r_src_filter_deps="frei0r dlopen"
|
frei0r_src_filter_deps="frei0r dlopen"
|
||||||
@ -4560,6 +4563,11 @@ EOF
|
|||||||
check_as <<EOF && enable as_dn_directive
|
check_as <<EOF && enable as_dn_directive
|
||||||
ra .dn d0.i16
|
ra .dn d0.i16
|
||||||
.unreq ra
|
.unreq ra
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# llvm's integrated assembler supports .object_arch from llvm 3.5
|
||||||
|
[ "$objformat" = elf ] && check_as <<EOF && enable as_object_arch
|
||||||
|
.object_arch armv4
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
[ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
|
[ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
|
||||||
@ -5451,6 +5459,7 @@ enabled asyncts_filter && prepend avfilter_deps "avresample"
|
|||||||
enabled atempo_filter && prepend avfilter_deps "avcodec"
|
enabled atempo_filter && prepend avfilter_deps "avcodec"
|
||||||
enabled ebur128_filter && enabled swresample && prepend avfilter_deps "swresample"
|
enabled ebur128_filter && enabled swresample && prepend avfilter_deps "swresample"
|
||||||
enabled elbg_filter && prepend avfilter_deps "avcodec"
|
enabled elbg_filter && prepend avfilter_deps "avcodec"
|
||||||
|
enabled fftfilt_filter && prepend avfilter_deps "avcodec"
|
||||||
enabled mcdeint_filter && prepend avfilter_deps "avcodec"
|
enabled mcdeint_filter && prepend avfilter_deps "avcodec"
|
||||||
enabled movie_filter && prepend avfilter_deps "avformat avcodec"
|
enabled movie_filter && prepend avfilter_deps "avformat avcodec"
|
||||||
enabled pan_filter && prepend avfilter_deps "swresample"
|
enabled pan_filter && prepend avfilter_deps "swresample"
|
||||||
|
@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg
|
|||||||
# This could be handy for archiving the generated documentation or
|
# This could be handy for archiving the generated documentation or
|
||||||
# if some version control system is used.
|
# if some version control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER =
|
PROJECT_NUMBER = 2.6.4
|
||||||
|
|
||||||
# With the PROJECT_LOGO tag one can specify a logo or icon that is included
|
# 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
|
# in the documentation. The maximum height of the logo should not exceed 55
|
||||||
|
@ -81,8 +81,11 @@ static int decode_packet(int *got_frame, int cached)
|
|||||||
fprintf(stderr, "Error decoding video frame (%s)\n", av_err2str(ret));
|
fprintf(stderr, "Error decoding video frame (%s)\n", av_err2str(ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
if (video_dec_ctx->width != width || video_dec_ctx->height != height ||
|
|
||||||
video_dec_ctx->pix_fmt != pix_fmt) {
|
if (*got_frame) {
|
||||||
|
|
||||||
|
if (frame->width != width || frame->height != height ||
|
||||||
|
frame->format != pix_fmt) {
|
||||||
/* To handle this change, one could call av_image_alloc again and
|
/* To handle this change, one could call av_image_alloc again and
|
||||||
* decode the following frames into another rawvideo file. */
|
* decode the following frames into another rawvideo file. */
|
||||||
fprintf(stderr, "Error: Width, height and pixel format have to be "
|
fprintf(stderr, "Error: Width, height and pixel format have to be "
|
||||||
@ -91,12 +94,11 @@ static int decode_packet(int *got_frame, int cached)
|
|||||||
"old: width = %d, height = %d, format = %s\n"
|
"old: width = %d, height = %d, format = %s\n"
|
||||||
"new: width = %d, height = %d, format = %s\n",
|
"new: width = %d, height = %d, format = %s\n",
|
||||||
width, height, av_get_pix_fmt_name(pix_fmt),
|
width, height, av_get_pix_fmt_name(pix_fmt),
|
||||||
video_dec_ctx->width, video_dec_ctx->height,
|
frame->width, frame->height,
|
||||||
av_get_pix_fmt_name(video_dec_ctx->pix_fmt));
|
av_get_pix_fmt_name(frame->format));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*got_frame) {
|
|
||||||
printf("video_frame%s n:%d coded_n:%d pts:%s\n",
|
printf("video_frame%s n:%d coded_n:%d pts:%s\n",
|
||||||
cached ? "(cached)" : "",
|
cached ? "(cached)" : "",
|
||||||
video_frame_count++, frame->coded_picture_number,
|
video_frame_count++, frame->coded_picture_number,
|
||||||
|
@ -349,7 +349,7 @@ FFmpeg has a @url{http://ffmpeg.org/ffmpeg-protocols.html#concat,
|
|||||||
@code{concat}} protocol designed specifically for that, with examples in the
|
@code{concat}} protocol designed specifically for that, with examples in the
|
||||||
documentation.
|
documentation.
|
||||||
|
|
||||||
A few multimedia containers (MPEG-1, MPEG-2 PS, DV) allow to concatenate
|
A few multimedia containers (MPEG-1, MPEG-2 PS, DV) allow one to concatenate
|
||||||
video by merely concatenating the files containing them.
|
video by merely concatenating the files containing them.
|
||||||
|
|
||||||
Hence you may concatenate your multimedia files by first transcoding them to
|
Hence you may concatenate your multimedia files by first transcoding them to
|
||||||
|
@ -72,7 +72,7 @@ the HTTP server (configured through the @option{HTTPPort} option), and
|
|||||||
configuration file.
|
configuration file.
|
||||||
|
|
||||||
Each feed is associated to a file which is stored on disk. This stored
|
Each feed is associated to a file which is stored on disk. This stored
|
||||||
file is used to allow to send pre-recorded data to a player as fast as
|
file is used to send pre-recorded data to a player as fast as
|
||||||
possible when new content is added in real-time to the stream.
|
possible when new content is added in real-time to the stream.
|
||||||
|
|
||||||
A "live-stream" or "stream" is a resource published by
|
A "live-stream" or "stream" is a resource published by
|
||||||
|
@ -261,10 +261,14 @@ Possible flags for this option are:
|
|||||||
@item sse4.1
|
@item sse4.1
|
||||||
@item sse4.2
|
@item sse4.2
|
||||||
@item avx
|
@item avx
|
||||||
|
@item avx2
|
||||||
@item xop
|
@item xop
|
||||||
|
@item fma3
|
||||||
@item fma4
|
@item fma4
|
||||||
@item 3dnow
|
@item 3dnow
|
||||||
@item 3dnowext
|
@item 3dnowext
|
||||||
|
@item bmi1
|
||||||
|
@item bmi2
|
||||||
@item cmov
|
@item cmov
|
||||||
@end table
|
@end table
|
||||||
@item ARM
|
@item ARM
|
||||||
@ -275,6 +279,13 @@ Possible flags for this option are:
|
|||||||
@item vfp
|
@item vfp
|
||||||
@item vfpv3
|
@item vfpv3
|
||||||
@item neon
|
@item neon
|
||||||
|
@item setend
|
||||||
|
@end table
|
||||||
|
@item AArch64
|
||||||
|
@table @samp
|
||||||
|
@item armv8
|
||||||
|
@item vfp
|
||||||
|
@item neon
|
||||||
@end table
|
@end table
|
||||||
@item PowerPC
|
@item PowerPC
|
||||||
@table @samp
|
@table @samp
|
||||||
|
@ -3486,7 +3486,7 @@ Set number overlapping pixels for each block. Since the filter can be slow, you
|
|||||||
may want to reduce this value, at the cost of a less effective filter and the
|
may want to reduce this value, at the cost of a less effective filter and the
|
||||||
risk of various artefacts.
|
risk of various artefacts.
|
||||||
|
|
||||||
If the overlapping value doesn't allow to process the whole input width or
|
If the overlapping value doesn't permit processing the whole input width or
|
||||||
height, a warning will be displayed and according borders won't be denoised.
|
height, a warning will be displayed and according borders won't be denoised.
|
||||||
|
|
||||||
Default value is @var{blocksize}-1, which is the best possible setting.
|
Default value is @var{blocksize}-1, which is the best possible setting.
|
||||||
|
@ -23,7 +23,7 @@ Reduce buffering.
|
|||||||
|
|
||||||
@item probesize @var{integer} (@emph{input})
|
@item probesize @var{integer} (@emph{input})
|
||||||
Set probing size in bytes, i.e. the size of the data to analyze to get
|
Set probing size in bytes, i.e. the size of the data to analyze to get
|
||||||
stream information. A higher value will allow to detect more
|
stream information. A higher value will enable detecting more
|
||||||
information in case it is dispersed into the stream, but will increase
|
information in case it is dispersed into the stream, but will increase
|
||||||
latency. Must be an integer not lesser than 32. It is 5000000 by default.
|
latency. Must be an integer not lesser than 32. It is 5000000 by default.
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ Default is 0.
|
|||||||
|
|
||||||
@item analyzeduration @var{integer} (@emph{input})
|
@item analyzeduration @var{integer} (@emph{input})
|
||||||
Specify how many microseconds are analyzed to probe the input. A
|
Specify how many microseconds are analyzed to probe the input. A
|
||||||
higher value will allow to detect more accurate information, but will
|
higher value will enable detecting more accurate information, but will
|
||||||
increase latency. It defaults to 5,000,000 microseconds = 5 seconds.
|
increase latency. It defaults to 5,000,000 microseconds = 5 seconds.
|
||||||
|
|
||||||
@item cryptokey @var{hexadecimal string} (@emph{input})
|
@item cryptokey @var{hexadecimal string} (@emph{input})
|
||||||
|
160
doc/indevs.texi
160
doc/indevs.texi
@ -1,7 +1,7 @@
|
|||||||
@chapter Input Devices
|
@chapter Input Devices
|
||||||
@c man begin INPUT DEVICES
|
@c man begin INPUT DEVICES
|
||||||
|
|
||||||
Input devices are configured elements in FFmpeg which allow to access
|
Input devices are configured elements in FFmpeg which enable accessing
|
||||||
the data coming from a multimedia device attached to your system.
|
the data coming from a multimedia device attached to your system.
|
||||||
|
|
||||||
When you configure your FFmpeg build, all the supported input devices
|
When you configure your FFmpeg build, all the supported input devices
|
||||||
@ -150,6 +150,81 @@ $ ffmpeg -f avfoundation -pixel_format bgr0 -i "default:none" out.avi
|
|||||||
|
|
||||||
BSD video input device.
|
BSD video input device.
|
||||||
|
|
||||||
|
@section decklink
|
||||||
|
|
||||||
|
The decklink input device provides capture capabilities for Blackmagic
|
||||||
|
DeckLink devices.
|
||||||
|
|
||||||
|
To enable this input device, you need the Blackmagic DeckLink SDK and you
|
||||||
|
need to configure with the appropriate @code{--extra-cflags}
|
||||||
|
and @code{--extra-ldflags}.
|
||||||
|
On Windows, you need to run the IDL files through @command{widl}.
|
||||||
|
|
||||||
|
DeckLink is very picky about the formats it supports. Pixel format is
|
||||||
|
uyvy422 or v210, framerate and video size must be determined for your device with
|
||||||
|
@command{-list_formats 1}. Audio sample rate is always 48 kHz and the number
|
||||||
|
of channels can be 2, 8 or 16.
|
||||||
|
|
||||||
|
@subsection Options
|
||||||
|
|
||||||
|
@table @option
|
||||||
|
|
||||||
|
@item list_devices
|
||||||
|
If set to @option{true}, print a list of devices and exit.
|
||||||
|
Defaults to @option{false}.
|
||||||
|
|
||||||
|
@item list_formats
|
||||||
|
If set to @option{true}, print a list of supported formats and exit.
|
||||||
|
Defaults to @option{false}.
|
||||||
|
|
||||||
|
@item bm_v210
|
||||||
|
If set to @samp{1}, video is captured in 10 bit v210 instead
|
||||||
|
of uyvy422. Not all Blackmagic devices support this option.
|
||||||
|
|
||||||
|
@end table
|
||||||
|
|
||||||
|
@subsection Examples
|
||||||
|
|
||||||
|
@itemize
|
||||||
|
|
||||||
|
@item
|
||||||
|
List input devices:
|
||||||
|
@example
|
||||||
|
ffmpeg -f decklink -list_devices 1 -i dummy
|
||||||
|
@end example
|
||||||
|
|
||||||
|
@item
|
||||||
|
List supported formats:
|
||||||
|
@example
|
||||||
|
ffmpeg -f decklink -list_formats 1 -i 'Intensity Pro'
|
||||||
|
@end example
|
||||||
|
|
||||||
|
@item
|
||||||
|
Capture video clip at 1080i50 (format 11):
|
||||||
|
@example
|
||||||
|
ffmpeg -f decklink -i 'Intensity Pro@@11' -acodec copy -vcodec copy output.avi
|
||||||
|
@end example
|
||||||
|
|
||||||
|
@item
|
||||||
|
Capture video clip at 1080i50 10 bit:
|
||||||
|
@example
|
||||||
|
ffmpeg -bm_v210 1 -f decklink -i 'UltraStudio Mini Recorder@@11' -acodec copy -vcodec copy output.avi
|
||||||
|
@end example
|
||||||
|
|
||||||
|
@item
|
||||||
|
Capture video clip at 720p50 with 32bit audio:
|
||||||
|
@example
|
||||||
|
ffmpeg -bm_audiodepth 32 -f decklink -i 'UltraStudio Mini Recorder@@14' -acodec copy -vcodec copy output.avi
|
||||||
|
@end example
|
||||||
|
|
||||||
|
@item
|
||||||
|
Capture video clip at 576i50 with 8 audio channels:
|
||||||
|
@example
|
||||||
|
ffmpeg -bm_channels 8 -f decklink -i 'UltraStudio Mini Recorder@@3' -acodec copy -vcodec copy output.avi
|
||||||
|
@end example
|
||||||
|
|
||||||
|
@end itemize
|
||||||
|
|
||||||
@section dshow
|
@section dshow
|
||||||
|
|
||||||
Windows DirectShow input device.
|
Windows DirectShow input device.
|
||||||
@ -1109,89 +1184,8 @@ The syntax is:
|
|||||||
-grab_x @var{x_offset} -grab_y @var{y_offset}
|
-grab_x @var{x_offset} -grab_y @var{y_offset}
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
Set the grabing region coordinates. The are expressed as offset from the top left
|
Set the grabbing region coordinates. They are expressed as offset from the top left
|
||||||
corner of the X11 window. The default value is 0.
|
corner of the X11 window. The default value is 0.
|
||||||
|
|
||||||
@section decklink
|
|
||||||
|
|
||||||
The decklink input device provides capture capabilities for Blackmagic
|
|
||||||
DeckLink devices.
|
|
||||||
|
|
||||||
To enable this input device, you need the Blackmagic DeckLink SDK and you
|
|
||||||
need to configure with the appropriate @code{--extra-cflags}
|
|
||||||
and @code{--extra-ldflags}.
|
|
||||||
On Windows, you need to run the IDL files through @command{widl}.
|
|
||||||
|
|
||||||
DeckLink is very picky about the formats it supports. Pixel format is
|
|
||||||
uyvy422 or v210, framerate and video size must be determined for your device with
|
|
||||||
@command{-list_formats 1}. Audio sample rate is always 48 kHz and the number
|
|
||||||
of channels can be 2, 8 or 16.
|
|
||||||
|
|
||||||
@subsection Options
|
|
||||||
|
|
||||||
@table @option
|
|
||||||
|
|
||||||
@item list_devices
|
|
||||||
If set to @option{true}, print a list of devices and exit.
|
|
||||||
Defaults to @option{false}.
|
|
||||||
|
|
||||||
@item list_formats
|
|
||||||
If set to @option{true}, print a list of supported formats and exit.
|
|
||||||
Defaults to @option{false}.
|
|
||||||
|
|
||||||
@item bm_v210
|
|
||||||
If set to @samp{1}, video is captured in 10 bit v210 instead
|
|
||||||
of uyvy422. Not all Blackmagic devices support this option.
|
|
||||||
|
|
||||||
@item bm_channels <CHANNELS>
|
|
||||||
Number of audio channels, can be 2, 8 or 16
|
|
||||||
|
|
||||||
@item bm_audiodepth <BITDEPTH>
|
|
||||||
Audio bit depth, can be 16 or 32.
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@subsection Examples
|
|
||||||
|
|
||||||
@itemize
|
|
||||||
|
|
||||||
@item
|
|
||||||
List input devices:
|
|
||||||
@example
|
|
||||||
ffmpeg -f decklink -list_devices 1 -i dummy
|
|
||||||
@end example
|
|
||||||
|
|
||||||
@item
|
|
||||||
List supported formats:
|
|
||||||
@example
|
|
||||||
ffmpeg -f decklink -list_formats 1 -i 'Intensity Pro'
|
|
||||||
@end example
|
|
||||||
|
|
||||||
@item
|
|
||||||
Capture video clip at 1080i50 (format 11):
|
|
||||||
@example
|
|
||||||
ffmpeg -f decklink -i 'Intensity Pro@@11' -acodec copy -vcodec copy output.avi
|
|
||||||
@end example
|
|
||||||
|
|
||||||
@item
|
|
||||||
Capture video clip at 1080i50 10 bit:
|
|
||||||
@example
|
|
||||||
ffmpeg -bm_v210 1 -f decklink -i 'UltraStudio Mini Recorder@@11' -acodec copy -vcodec copy output.avi
|
|
||||||
@end example
|
|
||||||
|
|
||||||
@item
|
|
||||||
Capture video clip at 720p50 with 32bit audio:
|
|
||||||
@example
|
|
||||||
ffmpeg -bm_audiodepth 32 -f decklink -i 'UltraStudio Mini Recorder@@14' -acodec copy -vcodec copy output.avi
|
|
||||||
@end example
|
|
||||||
|
|
||||||
@item
|
|
||||||
Capture video clip at 576i50 with 8 audio channels:
|
|
||||||
@example
|
|
||||||
ffmpeg -bm_channels 8 -f decklink -i 'UltraStudio Mini Recorder@@3' -acodec copy -vcodec copy output.avi
|
|
||||||
@end example
|
|
||||||
|
|
||||||
@end itemize
|
|
||||||
|
|
||||||
|
|
||||||
@c man end INPUT DEVICES
|
@c man end INPUT DEVICES
|
||||||
|
@ -63,7 +63,7 @@ cache:@var{URL}
|
|||||||
|
|
||||||
Physical concatenation protocol.
|
Physical concatenation protocol.
|
||||||
|
|
||||||
Allow to read and seek from many resource in sequence as if they were
|
Read and seek from many resources in sequence as if they were
|
||||||
a unique resource.
|
a unique resource.
|
||||||
|
|
||||||
A URL accepted by this protocol has the syntax:
|
A URL accepted by this protocol has the syntax:
|
||||||
@ -117,7 +117,7 @@ ffmpeg -i "data:image/gif;base64,R0lGODdhCAAIAMIEAAAAAAAA//8AAP//AP/////////////
|
|||||||
|
|
||||||
File access protocol.
|
File access protocol.
|
||||||
|
|
||||||
Allow to read from or write to a file.
|
Read from or write to a file.
|
||||||
|
|
||||||
A file URL can have the form:
|
A file URL can have the form:
|
||||||
@example
|
@example
|
||||||
@ -155,7 +155,7 @@ time, which is valuable for files on slow medium.
|
|||||||
|
|
||||||
FTP (File Transfer Protocol).
|
FTP (File Transfer Protocol).
|
||||||
|
|
||||||
Allow to read from or write to remote resources using FTP protocol.
|
Read from or write to remote resources using FTP protocol.
|
||||||
|
|
||||||
Following syntax is required.
|
Following syntax is required.
|
||||||
@example
|
@example
|
||||||
@ -374,7 +374,7 @@ be seekable, so they will fail with the MD5 output protocol.
|
|||||||
|
|
||||||
UNIX pipe access protocol.
|
UNIX pipe access protocol.
|
||||||
|
|
||||||
Allow to read and write from UNIX pipes.
|
Read and write from UNIX pipes.
|
||||||
|
|
||||||
The accepted syntax is:
|
The accepted syntax is:
|
||||||
@example
|
@example
|
||||||
@ -614,7 +614,7 @@ For more information see: @url{http://www.samba.org/}.
|
|||||||
|
|
||||||
Secure File Transfer Protocol via libssh
|
Secure File Transfer Protocol via libssh
|
||||||
|
|
||||||
Allow to read from or write to remote resources using SFTP protocol.
|
Read from or write to remote resources using SFTP protocol.
|
||||||
|
|
||||||
Following syntax is required.
|
Following syntax is required.
|
||||||
|
|
||||||
|
@ -844,7 +844,7 @@ Return 1.0 if @var{x} is +/-INFINITY, 0.0 otherwise.
|
|||||||
Return 1.0 if @var{x} is NAN, 0.0 otherwise.
|
Return 1.0 if @var{x} is NAN, 0.0 otherwise.
|
||||||
|
|
||||||
@item ld(var)
|
@item ld(var)
|
||||||
Allow to load the value of the internal variable with number
|
Load the value of the internal variable with number
|
||||||
@var{var}, which was previously stored with st(@var{var}, @var{expr}).
|
@var{var}, which was previously stored with st(@var{var}, @var{expr}).
|
||||||
The function returns the loaded value.
|
The function returns the loaded value.
|
||||||
|
|
||||||
@ -912,7 +912,7 @@ Compute the square root of @var{expr}. This is equivalent to
|
|||||||
Compute expression @code{1/(1 + exp(4*x))}.
|
Compute expression @code{1/(1 + exp(4*x))}.
|
||||||
|
|
||||||
@item st(var, expr)
|
@item st(var, expr)
|
||||||
Allow to store the value of the expression @var{expr} in an internal
|
Store the value of the expression @var{expr} in an internal
|
||||||
variable. @var{var} specifies the number of the variable where to
|
variable. @var{var} specifies the number of the variable where to
|
||||||
store the value, and it is a value ranging from 0 to 9. The function
|
store the value, and it is a value ranging from 0 to 9. The function
|
||||||
returns the value stored in the internal variable.
|
returns the value stored in the internal variable.
|
||||||
|
34
ffmpeg.c
34
ffmpeg.c
@ -351,7 +351,6 @@ void term_init(void)
|
|||||||
signal(SIGQUIT, sigterm_handler); /* Quit (POSIX). */
|
signal(SIGQUIT, sigterm_handler); /* Quit (POSIX). */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
avformat_network_deinit();
|
|
||||||
|
|
||||||
signal(SIGINT , sigterm_handler); /* Interrupt (ANSI). */
|
signal(SIGINT , sigterm_handler); /* Interrupt (ANSI). */
|
||||||
signal(SIGTERM, sigterm_handler); /* Termination (ANSI). */
|
signal(SIGTERM, sigterm_handler); /* Termination (ANSI). */
|
||||||
@ -456,7 +455,10 @@ static void ffmpeg_cleanup(int ret)
|
|||||||
/* close files */
|
/* close files */
|
||||||
for (i = 0; i < nb_output_files; i++) {
|
for (i = 0; i < nb_output_files; i++) {
|
||||||
OutputFile *of = output_files[i];
|
OutputFile *of = output_files[i];
|
||||||
AVFormatContext *s = of->ctx;
|
AVFormatContext *s;
|
||||||
|
if (!of)
|
||||||
|
continue;
|
||||||
|
s = of->ctx;
|
||||||
if (s && s->oformat && !(s->oformat->flags & AVFMT_NOFILE))
|
if (s && s->oformat && !(s->oformat->flags & AVFMT_NOFILE))
|
||||||
avio_closep(&s->pb);
|
avio_closep(&s->pb);
|
||||||
avformat_free_context(s);
|
avformat_free_context(s);
|
||||||
@ -466,7 +468,12 @@ static void ffmpeg_cleanup(int ret)
|
|||||||
}
|
}
|
||||||
for (i = 0; i < nb_output_streams; i++) {
|
for (i = 0; i < nb_output_streams; i++) {
|
||||||
OutputStream *ost = output_streams[i];
|
OutputStream *ost = output_streams[i];
|
||||||
AVBitStreamFilterContext *bsfc = ost->bitstream_filters;
|
AVBitStreamFilterContext *bsfc;
|
||||||
|
|
||||||
|
if (!ost)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
bsfc = ost->bitstream_filters;
|
||||||
while (bsfc) {
|
while (bsfc) {
|
||||||
AVBitStreamFilterContext *next = bsfc->next;
|
AVBitStreamFilterContext *next = bsfc->next;
|
||||||
av_bitstream_filter_close(bsfc);
|
av_bitstream_filter_close(bsfc);
|
||||||
@ -650,6 +657,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
|
|||||||
if (!new_pkt.buf)
|
if (!new_pkt.buf)
|
||||||
exit_program(1);
|
exit_program(1);
|
||||||
} else if (a < 0) {
|
} else if (a < 0) {
|
||||||
|
new_pkt = *pkt;
|
||||||
av_log(NULL, AV_LOG_ERROR, "Failed to open bitstream filter %s for stream %d with codec %s",
|
av_log(NULL, AV_LOG_ERROR, "Failed to open bitstream filter %s for stream %d with codec %s",
|
||||||
bsfc->filter->name, pkt->stream_index,
|
bsfc->filter->name, pkt->stream_index,
|
||||||
avctx->codec ? avctx->codec->name : "copy");
|
avctx->codec ? avctx->codec->name : "copy");
|
||||||
@ -1156,7 +1164,10 @@ static void do_video_out(AVFormatContext *s,
|
|||||||
if (!ost->last_frame)
|
if (!ost->last_frame)
|
||||||
ost->last_frame = av_frame_alloc();
|
ost->last_frame = av_frame_alloc();
|
||||||
av_frame_unref(ost->last_frame);
|
av_frame_unref(ost->last_frame);
|
||||||
|
if (next_picture && ost->last_frame)
|
||||||
av_frame_ref(ost->last_frame, next_picture);
|
av_frame_ref(ost->last_frame, next_picture);
|
||||||
|
else
|
||||||
|
av_frame_free(&ost->last_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
static double psnr(double d)
|
static double psnr(double d)
|
||||||
@ -1830,9 +1841,12 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
|
|||||||
ret = AVERROR_INVALIDDATA;
|
ret = AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*got_output || ret<0 || pkt->size)
|
if (*got_output || ret<0)
|
||||||
decode_error_stat[ret<0] ++;
|
decode_error_stat[ret<0] ++;
|
||||||
|
|
||||||
|
if (ret < 0 && exit_on_error)
|
||||||
|
exit_program(1);
|
||||||
|
|
||||||
if (!*got_output || ret < 0) {
|
if (!*got_output || ret < 0) {
|
||||||
if (!pkt->size) {
|
if (!pkt->size) {
|
||||||
for (i = 0; i < ist->nb_filters; i++)
|
for (i = 0; i < ist->nb_filters; i++)
|
||||||
@ -1975,9 +1989,12 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*got_output || ret<0 || pkt->size)
|
if (*got_output || ret<0)
|
||||||
decode_error_stat[ret<0] ++;
|
decode_error_stat[ret<0] ++;
|
||||||
|
|
||||||
|
if (ret < 0 && exit_on_error)
|
||||||
|
exit_program(1);
|
||||||
|
|
||||||
if (*got_output && ret >= 0) {
|
if (*got_output && ret >= 0) {
|
||||||
if (ist->dec_ctx->width != decoded_frame->width ||
|
if (ist->dec_ctx->width != decoded_frame->width ||
|
||||||
ist->dec_ctx->height != decoded_frame->height ||
|
ist->dec_ctx->height != decoded_frame->height ||
|
||||||
@ -2093,9 +2110,12 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output)
|
|||||||
int i, ret = avcodec_decode_subtitle2(ist->dec_ctx,
|
int i, ret = avcodec_decode_subtitle2(ist->dec_ctx,
|
||||||
&subtitle, got_output, pkt);
|
&subtitle, got_output, pkt);
|
||||||
|
|
||||||
if (*got_output || ret<0 || pkt->size)
|
if (*got_output || ret<0)
|
||||||
decode_error_stat[ret<0] ++;
|
decode_error_stat[ret<0] ++;
|
||||||
|
|
||||||
|
if (ret < 0 && exit_on_error)
|
||||||
|
exit_program(1);
|
||||||
|
|
||||||
if (ret < 0 || !*got_output) {
|
if (ret < 0 || !*got_output) {
|
||||||
if (!pkt->size)
|
if (!pkt->size)
|
||||||
sub2video_flush(ist);
|
sub2video_flush(ist);
|
||||||
@ -2666,11 +2686,13 @@ static int transcode_init(void)
|
|||||||
enc_ctx->rc_max_rate = dec_ctx->rc_max_rate;
|
enc_ctx->rc_max_rate = dec_ctx->rc_max_rate;
|
||||||
enc_ctx->rc_buffer_size = dec_ctx->rc_buffer_size;
|
enc_ctx->rc_buffer_size = dec_ctx->rc_buffer_size;
|
||||||
enc_ctx->field_order = dec_ctx->field_order;
|
enc_ctx->field_order = dec_ctx->field_order;
|
||||||
|
if (dec_ctx->extradata_size) {
|
||||||
enc_ctx->extradata = av_mallocz(extra_size);
|
enc_ctx->extradata = av_mallocz(extra_size);
|
||||||
if (!enc_ctx->extradata) {
|
if (!enc_ctx->extradata) {
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
memcpy(enc_ctx->extradata, dec_ctx->extradata, dec_ctx->extradata_size);
|
memcpy(enc_ctx->extradata, dec_ctx->extradata, dec_ctx->extradata_size);
|
||||||
|
}
|
||||||
enc_ctx->extradata_size= dec_ctx->extradata_size;
|
enc_ctx->extradata_size= dec_ctx->extradata_size;
|
||||||
enc_ctx->bits_per_coded_sample = dec_ctx->bits_per_coded_sample;
|
enc_ctx->bits_per_coded_sample = dec_ctx->bits_per_coded_sample;
|
||||||
|
|
||||||
|
23
ffmpeg_opt.c
23
ffmpeg_opt.c
@ -2282,9 +2282,9 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
|
|||||||
opt_default(NULL, "g", norm == PAL ? "15" : "18");
|
opt_default(NULL, "g", norm == PAL ? "15" : "18");
|
||||||
|
|
||||||
opt_default(NULL, "b:v", "1150000");
|
opt_default(NULL, "b:v", "1150000");
|
||||||
opt_default(NULL, "maxrate", "1150000");
|
opt_default(NULL, "maxrate:v", "1150000");
|
||||||
opt_default(NULL, "minrate", "1150000");
|
opt_default(NULL, "minrate:v", "1150000");
|
||||||
opt_default(NULL, "bufsize", "327680"); // 40*1024*8;
|
opt_default(NULL, "bufsize:v", "327680"); // 40*1024*8;
|
||||||
|
|
||||||
opt_default(NULL, "b:a", "224000");
|
opt_default(NULL, "b:a", "224000");
|
||||||
parse_option(o, "ar", "44100", options);
|
parse_option(o, "ar", "44100", options);
|
||||||
@ -2311,9 +2311,9 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
|
|||||||
opt_default(NULL, "g", norm == PAL ? "15" : "18");
|
opt_default(NULL, "g", norm == PAL ? "15" : "18");
|
||||||
|
|
||||||
opt_default(NULL, "b:v", "2040000");
|
opt_default(NULL, "b:v", "2040000");
|
||||||
opt_default(NULL, "maxrate", "2516000");
|
opt_default(NULL, "maxrate:v", "2516000");
|
||||||
opt_default(NULL, "minrate", "0"); // 1145000;
|
opt_default(NULL, "minrate:v", "0"); // 1145000;
|
||||||
opt_default(NULL, "bufsize", "1835008"); // 224*1024*8;
|
opt_default(NULL, "bufsize:v", "1835008"); // 224*1024*8;
|
||||||
opt_default(NULL, "scan_offset", "1");
|
opt_default(NULL, "scan_offset", "1");
|
||||||
|
|
||||||
opt_default(NULL, "b:a", "224000");
|
opt_default(NULL, "b:a", "224000");
|
||||||
@ -2333,9 +2333,9 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
|
|||||||
opt_default(NULL, "g", norm == PAL ? "15" : "18");
|
opt_default(NULL, "g", norm == PAL ? "15" : "18");
|
||||||
|
|
||||||
opt_default(NULL, "b:v", "6000000");
|
opt_default(NULL, "b:v", "6000000");
|
||||||
opt_default(NULL, "maxrate", "9000000");
|
opt_default(NULL, "maxrate:v", "9000000");
|
||||||
opt_default(NULL, "minrate", "0"); // 1500000;
|
opt_default(NULL, "minrate:v", "0"); // 1500000;
|
||||||
opt_default(NULL, "bufsize", "1835008"); // 224*1024*8;
|
opt_default(NULL, "bufsize:v", "1835008"); // 224*1024*8;
|
||||||
|
|
||||||
opt_default(NULL, "packetsize", "2048"); // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack.
|
opt_default(NULL, "packetsize", "2048"); // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack.
|
||||||
opt_default(NULL, "muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8
|
opt_default(NULL, "muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8
|
||||||
@ -2379,6 +2379,9 @@ static int opt_vstats(void *optctx, const char *opt, const char *arg)
|
|||||||
time_t today2 = time(NULL);
|
time_t today2 = time(NULL);
|
||||||
struct tm *today = localtime(&today2);
|
struct tm *today = localtime(&today2);
|
||||||
|
|
||||||
|
if (!today)
|
||||||
|
return AVERROR(errno);
|
||||||
|
|
||||||
snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
|
snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
|
||||||
today->tm_sec);
|
today->tm_sec);
|
||||||
return opt_vstats_file(NULL, opt, filename);
|
return opt_vstats_file(NULL, opt, filename);
|
||||||
@ -2859,7 +2862,7 @@ const OptionDef options[] = {
|
|||||||
{ "itsscale", HAS_ARG | OPT_DOUBLE | OPT_SPEC |
|
{ "itsscale", HAS_ARG | OPT_DOUBLE | OPT_SPEC |
|
||||||
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(ts_scale) },
|
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(ts_scale) },
|
||||||
"set the input ts scale", "scale" },
|
"set the input ts scale", "scale" },
|
||||||
{ "timestamp", HAS_ARG | OPT_PERFILE, { .func_arg = opt_recording_timestamp },
|
{ "timestamp", HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_recording_timestamp },
|
||||||
"set the recording timestamp ('now' to set the current time)", "time" },
|
"set the recording timestamp ('now' to set the current time)", "time" },
|
||||||
{ "metadata", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(metadata) },
|
{ "metadata", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(metadata) },
|
||||||
"add metadata", "string=string" },
|
"add metadata", "string=string" },
|
||||||
|
@ -77,6 +77,8 @@ static int vda_retrieve_data(AVCodecContext *s, AVFrame *frame)
|
|||||||
frame->width, frame->height);
|
frame->width, frame->height);
|
||||||
|
|
||||||
ret = av_frame_copy_props(vda->tmp_frame, frame);
|
ret = av_frame_copy_props(vda->tmp_frame, frame);
|
||||||
|
CVPixelBufferUnlockBaseAddress(pixbuf, kCVPixelBufferLock_ReadOnly);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -38,15 +38,15 @@ static av_cold int zero12v_decode_init(AVCodecContext *avctx)
|
|||||||
static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
|
static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
|
||||||
int *got_frame, AVPacket *avpkt)
|
int *got_frame, AVPacket *avpkt)
|
||||||
{
|
{
|
||||||
int line = 0, ret;
|
int line, ret;
|
||||||
const int width = avctx->width;
|
const int width = avctx->width;
|
||||||
AVFrame *pic = data;
|
AVFrame *pic = data;
|
||||||
uint16_t *y, *u, *v;
|
uint16_t *y, *u, *v;
|
||||||
const uint8_t *line_end, *src = avpkt->data;
|
const uint8_t *line_end, *src = avpkt->data;
|
||||||
int stride = avctx->width * 8 / 3;
|
int stride = avctx->width * 8 / 3;
|
||||||
|
|
||||||
if (width == 1) {
|
if (width <= 1 || avctx->height <= 0) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Width 1 not supported.\n");
|
av_log(avctx, AV_LOG_ERROR, "Dimensions %dx%d not supported.\n", width, avctx->height);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,45 +67,45 @@ static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
pic->pict_type = AV_PICTURE_TYPE_I;
|
pic->pict_type = AV_PICTURE_TYPE_I;
|
||||||
pic->key_frame = 1;
|
pic->key_frame = 1;
|
||||||
|
|
||||||
y = (uint16_t *)pic->data[0];
|
|
||||||
u = (uint16_t *)pic->data[1];
|
|
||||||
v = (uint16_t *)pic->data[2];
|
|
||||||
line_end = avpkt->data + stride;
|
line_end = avpkt->data + stride;
|
||||||
|
for (line = 0; line < avctx->height; line++) {
|
||||||
|
uint16_t y_temp[6] = {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000};
|
||||||
|
uint16_t u_temp[3] = {0x8000, 0x8000, 0x8000};
|
||||||
|
uint16_t v_temp[3] = {0x8000, 0x8000, 0x8000};
|
||||||
|
int x;
|
||||||
|
y = (uint16_t *)(pic->data[0] + line * pic->linesize[0]);
|
||||||
|
u = (uint16_t *)(pic->data[1] + line * pic->linesize[1]);
|
||||||
|
v = (uint16_t *)(pic->data[2] + line * pic->linesize[2]);
|
||||||
|
|
||||||
while (line++ < avctx->height) {
|
for (x = 0; x < width; x += 6) {
|
||||||
while (1) {
|
uint32_t t;
|
||||||
uint32_t t = AV_RL32(src);
|
|
||||||
|
if (width - x < 6 || line_end - src < 16) {
|
||||||
|
y = y_temp;
|
||||||
|
u = u_temp;
|
||||||
|
v = v_temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line_end - src < 4)
|
||||||
|
break;
|
||||||
|
|
||||||
|
t = AV_RL32(src);
|
||||||
src += 4;
|
src += 4;
|
||||||
*u++ = t << 6 & 0xFFC0;
|
*u++ = t << 6 & 0xFFC0;
|
||||||
*y++ = t >> 4 & 0xFFC0;
|
*y++ = t >> 4 & 0xFFC0;
|
||||||
*v++ = t >> 14 & 0xFFC0;
|
*v++ = t >> 14 & 0xFFC0;
|
||||||
|
|
||||||
if (src >= line_end - 1) {
|
if (line_end - src < 4)
|
||||||
*y = 0x80;
|
|
||||||
src++;
|
|
||||||
line_end += stride;
|
|
||||||
y = (uint16_t *)(pic->data[0] + line * pic->linesize[0]);
|
|
||||||
u = (uint16_t *)(pic->data[1] + line * pic->linesize[1]);
|
|
||||||
v = (uint16_t *)(pic->data[2] + line * pic->linesize[2]);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
t = AV_RL32(src);
|
t = AV_RL32(src);
|
||||||
src += 4;
|
src += 4;
|
||||||
*y++ = t << 6 & 0xFFC0;
|
*y++ = t << 6 & 0xFFC0;
|
||||||
*u++ = t >> 4 & 0xFFC0;
|
*u++ = t >> 4 & 0xFFC0;
|
||||||
*y++ = t >> 14 & 0xFFC0;
|
*y++ = t >> 14 & 0xFFC0;
|
||||||
if (src >= line_end - 2) {
|
|
||||||
if (!(width & 1)) {
|
if (line_end - src < 4)
|
||||||
*y = 0x80;
|
|
||||||
src += 2;
|
|
||||||
}
|
|
||||||
line_end += stride;
|
|
||||||
y = (uint16_t *)(pic->data[0] + line * pic->linesize[0]);
|
|
||||||
u = (uint16_t *)(pic->data[1] + line * pic->linesize[1]);
|
|
||||||
v = (uint16_t *)(pic->data[2] + line * pic->linesize[2]);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
t = AV_RL32(src);
|
t = AV_RL32(src);
|
||||||
src += 4;
|
src += 4;
|
||||||
@ -113,15 +113,8 @@ static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
*y++ = t >> 4 & 0xFFC0;
|
*y++ = t >> 4 & 0xFFC0;
|
||||||
*u++ = t >> 14 & 0xFFC0;
|
*u++ = t >> 14 & 0xFFC0;
|
||||||
|
|
||||||
if (src >= line_end - 1) {
|
if (line_end - src < 4)
|
||||||
*y = 0x80;
|
|
||||||
src++;
|
|
||||||
line_end += stride;
|
|
||||||
y = (uint16_t *)(pic->data[0] + line * pic->linesize[0]);
|
|
||||||
u = (uint16_t *)(pic->data[1] + line * pic->linesize[1]);
|
|
||||||
v = (uint16_t *)(pic->data[2] + line * pic->linesize[2]);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
t = AV_RL32(src);
|
t = AV_RL32(src);
|
||||||
src += 4;
|
src += 4;
|
||||||
@ -129,18 +122,21 @@ static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
*v++ = t >> 4 & 0xFFC0;
|
*v++ = t >> 4 & 0xFFC0;
|
||||||
*y++ = t >> 14 & 0xFFC0;
|
*y++ = t >> 14 & 0xFFC0;
|
||||||
|
|
||||||
if (src >= line_end - 2) {
|
if (width - x < 6)
|
||||||
if (width & 1) {
|
|
||||||
*y = 0x80;
|
|
||||||
src += 2;
|
|
||||||
}
|
|
||||||
line_end += stride;
|
|
||||||
y = (uint16_t *)(pic->data[0] + line * pic->linesize[0]);
|
|
||||||
u = (uint16_t *)(pic->data[1] + line * pic->linesize[1]);
|
|
||||||
v = (uint16_t *)(pic->data[2] + line * pic->linesize[2]);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (x < width) {
|
||||||
|
y = x + (uint16_t *)(pic->data[0] + line * pic->linesize[0]);
|
||||||
|
u = x/2 + (uint16_t *)(pic->data[1] + line * pic->linesize[1]);
|
||||||
|
v = x/2 + (uint16_t *)(pic->data[2] + line * pic->linesize[2]);
|
||||||
|
memcpy(y, y_temp, sizeof(*y) * (width - x));
|
||||||
|
memcpy(u, u_temp, sizeof(*u) * (width - x + 1) / 2);
|
||||||
|
memcpy(v, v_temp, sizeof(*v) * (width - x + 1) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
line_end += stride;
|
||||||
|
src = line_end - stride;
|
||||||
}
|
}
|
||||||
|
|
||||||
*got_frame = 1;
|
*got_frame = 1;
|
||||||
|
@ -217,7 +217,7 @@ OBJS-$(CONFIG_DVVIDEO_DECODER) += dvdec.o dv.o dvdata.o
|
|||||||
OBJS-$(CONFIG_DVVIDEO_ENCODER) += dvenc.o dv.o dvdata.o
|
OBJS-$(CONFIG_DVVIDEO_ENCODER) += dvenc.o dv.o dvdata.o
|
||||||
OBJS-$(CONFIG_DXA_DECODER) += dxa.o
|
OBJS-$(CONFIG_DXA_DECODER) += dxa.o
|
||||||
OBJS-$(CONFIG_DXTORY_DECODER) += dxtory.o
|
OBJS-$(CONFIG_DXTORY_DECODER) += dxtory.o
|
||||||
OBJS-$(CONFIG_EAC3_DECODER) += eac3dec.o eac3_data.o
|
OBJS-$(CONFIG_EAC3_DECODER) += eac3_data.o
|
||||||
OBJS-$(CONFIG_EAC3_ENCODER) += eac3enc.o eac3_data.o
|
OBJS-$(CONFIG_EAC3_ENCODER) += eac3enc.o eac3_data.o
|
||||||
OBJS-$(CONFIG_EACMV_DECODER) += eacmv.o
|
OBJS-$(CONFIG_EACMV_DECODER) += eacmv.o
|
||||||
OBJS-$(CONFIG_EAMAD_DECODER) += eamad.o eaidct.o mpeg12.o \
|
OBJS-$(CONFIG_EAMAD_DECODER) += eamad.o eaidct.o mpeg12.o \
|
||||||
|
@ -424,7 +424,7 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
|
|||||||
* Save current output configuration if and only if it has been locked.
|
* Save current output configuration if and only if it has been locked.
|
||||||
*/
|
*/
|
||||||
static void push_output_configuration(AACContext *ac) {
|
static void push_output_configuration(AACContext *ac) {
|
||||||
if (ac->oc[1].status == OC_LOCKED) {
|
if (ac->oc[1].status == OC_LOCKED || ac->oc[0].status == OC_NONE) {
|
||||||
ac->oc[0] = ac->oc[1];
|
ac->oc[0] = ac->oc[1];
|
||||||
}
|
}
|
||||||
ac->oc[1].status = OC_NONE;
|
ac->oc[1].status = OC_NONE;
|
||||||
@ -900,7 +900,7 @@ static int decode_eld_specific_config(AACContext *ac, AVCodecContext *avctx,
|
|||||||
if (len == 15 + 255)
|
if (len == 15 + 255)
|
||||||
len += get_bits(gb, 16);
|
len += get_bits(gb, 16);
|
||||||
if (get_bits_left(gb) < len * 8 + 4) {
|
if (get_bits_left(gb) < len * 8 + 4) {
|
||||||
av_log(ac->avctx, AV_LOG_ERROR, overread_err);
|
av_log(avctx, AV_LOG_ERROR, overread_err);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
skip_bits_long(gb, 8 * len);
|
skip_bits_long(gb, 8 * len);
|
||||||
@ -3073,6 +3073,12 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
|
|||||||
AV_WL32(side, 2*AV_RL32(side));
|
AV_WL32(side, 2*AV_RL32(side));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ac->frame->data[0] && samples) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "no frame data found\n");
|
||||||
|
err = AVERROR_INVALIDDATA;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
*got_frame_ptr = !!samples;
|
*got_frame_ptr = !!samples;
|
||||||
if (samples) {
|
if (samples) {
|
||||||
ac->frame->nb_samples = samples;
|
ac->frame->nb_samples = samples;
|
||||||
|
@ -313,7 +313,7 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
|
|||||||
ctx->bitres.size = 6144 - pctx->frame_bits;
|
ctx->bitres.size = 6144 - pctx->frame_bits;
|
||||||
ctx->bitres.size -= ctx->bitres.size % 8;
|
ctx->bitres.size -= ctx->bitres.size % 8;
|
||||||
pctx->fill_level = ctx->bitres.size;
|
pctx->fill_level = ctx->bitres.size;
|
||||||
minath = ath(3410, ATH_ADD);
|
minath = ath(3410 - 0.733 * ATH_ADD, ATH_ADD);
|
||||||
for (j = 0; j < 2; j++) {
|
for (j = 0; j < 2; j++) {
|
||||||
AacPsyCoeffs *coeffs = pctx->psy_coef[j];
|
AacPsyCoeffs *coeffs = pctx->psy_coef[j];
|
||||||
const uint8_t *band_sizes = ctx->bands[j];
|
const uint8_t *band_sizes = ctx->bands[j];
|
||||||
@ -727,7 +727,10 @@ static void psy_3gpp_analyze_channel(FFPsyContext *ctx, int channel,
|
|||||||
if (active_lines > 0.0f)
|
if (active_lines > 0.0f)
|
||||||
band->thr = calc_reduced_thr_3gpp(band, coeffs[g].min_snr, reduction);
|
band->thr = calc_reduced_thr_3gpp(band, coeffs[g].min_snr, reduction);
|
||||||
pe += calc_pe_3gpp(band);
|
pe += calc_pe_3gpp(band);
|
||||||
|
if (band->thr > 0.0f)
|
||||||
band->norm_fac = band->active_lines / band->thr;
|
band->norm_fac = band->active_lines / band->thr;
|
||||||
|
else
|
||||||
|
band->norm_fac = 0.0f;
|
||||||
norm_fac += band->norm_fac;
|
norm_fac += band->norm_fac;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -514,7 +514,7 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
|
|||||||
/// High Frequency Generation - Patch Construction (14496-3 sp04 p216 fig. 4.46)
|
/// High Frequency Generation - Patch Construction (14496-3 sp04 p216 fig. 4.46)
|
||||||
static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
|
static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
|
||||||
{
|
{
|
||||||
int i, k, sb = 0;
|
int i, k, last_k = -1, last_msb = -1, sb = 0;
|
||||||
int msb = sbr->k[0];
|
int msb = sbr->k[0];
|
||||||
int usb = sbr->kx[1];
|
int usb = sbr->kx[1];
|
||||||
int goal_sb = ((1000 << 11) + (sbr->sample_rate >> 1)) / sbr->sample_rate;
|
int goal_sb = ((1000 << 11) + (sbr->sample_rate >> 1)) / sbr->sample_rate;
|
||||||
@ -528,6 +528,12 @@ static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
int odd = 0;
|
int odd = 0;
|
||||||
|
if (k == last_k && msb == last_msb) {
|
||||||
|
av_log(ac->avctx, AV_LOG_ERROR, "patch construction failed\n");
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
last_k = k;
|
||||||
|
last_msb = msb;
|
||||||
for (i = k; i == k || sb > (sbr->k[0] - 1 + msb - odd); i--) {
|
for (i = k; i == k || sb > (sbr->k[0] - 1 + msb - odd); i--) {
|
||||||
sb = sbr->f_master[i];
|
sb = sbr->f_master[i];
|
||||||
odd = (sb + sbr->k[0]) & 1;
|
odd = (sb + sbr->k[0]) & 1;
|
||||||
@ -1012,6 +1018,8 @@ static unsigned int read_sbr_data(AACContext *ac, SpectralBandReplication *sbr,
|
|||||||
{
|
{
|
||||||
unsigned int cnt = get_bits_count(gb);
|
unsigned int cnt = get_bits_count(gb);
|
||||||
|
|
||||||
|
sbr->id_aac = id_aac;
|
||||||
|
|
||||||
if (id_aac == TYPE_SCE || id_aac == TYPE_CCE) {
|
if (id_aac == TYPE_SCE || id_aac == TYPE_CCE) {
|
||||||
if (read_sbr_single_channel_element(ac, sbr, gb)) {
|
if (read_sbr_single_channel_element(ac, sbr, gb)) {
|
||||||
sbr_turnoff(sbr);
|
sbr_turnoff(sbr);
|
||||||
@ -1688,6 +1696,12 @@ void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
|
|||||||
int nch = (id_aac == TYPE_CPE) ? 2 : 1;
|
int nch = (id_aac == TYPE_CPE) ? 2 : 1;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
if (id_aac != sbr->id_aac) {
|
||||||
|
av_log(ac->avctx, AV_LOG_ERROR,
|
||||||
|
"element type mismatch %d != %d\n", id_aac, sbr->id_aac);
|
||||||
|
sbr_turnoff(sbr);
|
||||||
|
}
|
||||||
|
|
||||||
if (!sbr->kx_and_m_pushed) {
|
if (!sbr->kx_and_m_pushed) {
|
||||||
sbr->kx[0] = sbr->kx[1];
|
sbr->kx[0] = sbr->kx[1];
|
||||||
sbr->m[0] = sbr->m[1];
|
sbr->m[0] = sbr->m[1];
|
||||||
@ -1711,6 +1725,7 @@ void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
|
|||||||
sbr->c.sbr_hf_inverse_filter(&sbr->dsp, sbr->alpha0, sbr->alpha1,
|
sbr->c.sbr_hf_inverse_filter(&sbr->dsp, sbr->alpha0, sbr->alpha1,
|
||||||
(const float (*)[40][2]) sbr->X_low, sbr->k[0]);
|
(const float (*)[40][2]) sbr->X_low, sbr->k[0]);
|
||||||
sbr_chirp(sbr, &sbr->data[ch]);
|
sbr_chirp(sbr, &sbr->data[ch]);
|
||||||
|
av_assert0(sbr->data[ch].bs_num_env > 0);
|
||||||
sbr_hf_gen(ac, sbr, sbr->X_high,
|
sbr_hf_gen(ac, sbr, sbr->X_high,
|
||||||
(const float (*)[40][2]) sbr->X_low,
|
(const float (*)[40][2]) sbr->X_low,
|
||||||
(const float (*)[2]) sbr->alpha0,
|
(const float (*)[2]) sbr->alpha0,
|
||||||
|
@ -137,7 +137,7 @@ static int aasc_decode_frame(AVCodecContext *avctx,
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* report that the buffer was completely consumed */
|
/* report that the buffer was completely consumed */
|
||||||
return buf_size;
|
return avpkt->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold int aasc_decode_end(AVCodecContext *avctx)
|
static av_cold int aasc_decode_end(AVCodecContext *avctx)
|
||||||
|
@ -131,6 +131,9 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
|
|||||||
int band_start, band_end, begin, end1;
|
int band_start, band_end, begin, end1;
|
||||||
int lowcomp, fastleak, slowleak;
|
int lowcomp, fastleak, slowleak;
|
||||||
|
|
||||||
|
if (end <= 0)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
/* excitation function */
|
/* excitation function */
|
||||||
band_start = ff_ac3_bin_to_band_tab[start];
|
band_start = ff_ac3_bin_to_band_tab[start];
|
||||||
band_end = ff_ac3_bin_to_band_tab[end-1] + 1;
|
band_end = ff_ac3_bin_to_band_tab[end-1] + 1;
|
||||||
|
@ -872,7 +872,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
|
|||||||
start_subband += start_subband - 7;
|
start_subband += start_subband - 7;
|
||||||
end_subband = get_bits(gbc, 3) + 5;
|
end_subband = get_bits(gbc, 3) + 5;
|
||||||
#if USE_FIXED
|
#if USE_FIXED
|
||||||
s->spx_dst_end_freq = end_freq_inv_tab[end_subband];
|
s->spx_dst_end_freq = end_freq_inv_tab[end_subband-5];
|
||||||
#endif
|
#endif
|
||||||
if (end_subband > 7)
|
if (end_subband > 7)
|
||||||
end_subband += end_subband - 7;
|
end_subband += end_subband - 7;
|
||||||
@ -939,7 +939,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
|
|||||||
nblend = 0;
|
nblend = 0;
|
||||||
sblend = 0x800000;
|
sblend = 0x800000;
|
||||||
} else if (nratio > 0x7fffff) {
|
} else if (nratio > 0x7fffff) {
|
||||||
nblend = 0x800000;
|
nblend = 14529495; // sqrt(3) in FP.23
|
||||||
sblend = 0;
|
sblend = 0;
|
||||||
} else {
|
} else {
|
||||||
nblend = fixed_sqrt(nratio, 23);
|
nblend = fixed_sqrt(nratio, 23);
|
||||||
|
@ -243,19 +243,19 @@ typedef struct AC3DecodeContext {
|
|||||||
* Parse the E-AC-3 frame header.
|
* Parse the E-AC-3 frame header.
|
||||||
* This parses both the bit stream info and audio frame header.
|
* This parses both the bit stream info and audio frame header.
|
||||||
*/
|
*/
|
||||||
int ff_eac3_parse_header(AC3DecodeContext *s);
|
static int ff_eac3_parse_header(AC3DecodeContext *s);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decode mantissas in a single channel for the entire frame.
|
* Decode mantissas in a single channel for the entire frame.
|
||||||
* This is used when AHT mode is enabled.
|
* This is used when AHT mode is enabled.
|
||||||
*/
|
*/
|
||||||
void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch);
|
static void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply spectral extension to each channel by copying lower frequency
|
* Apply spectral extension to each channel by copying lower frequency
|
||||||
* coefficients to higher frequency bins and applying side information to
|
* coefficients to higher frequency bins and applying side information to
|
||||||
* approximate the original high frequency signal.
|
* approximate the original high frequency signal.
|
||||||
*/
|
*/
|
||||||
void ff_eac3_apply_spectral_extension(AC3DecodeContext *s);
|
static void ff_eac3_apply_spectral_extension(AC3DecodeContext *s);
|
||||||
|
|
||||||
#endif /* AVCODEC_AC3DEC_H */
|
#endif /* AVCODEC_AC3DEC_H */
|
||||||
|
@ -164,6 +164,7 @@ static void ac3_downmix_c_fixed16(int16_t **samples, int16_t (*matrix)[2],
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "eac3dec.c"
|
||||||
#include "ac3dec.c"
|
#include "ac3dec.c"
|
||||||
|
|
||||||
static const AVOption options[] = {
|
static const AVOption options[] = {
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
* Upmix delay samples from stereo to original channel layout.
|
* Upmix delay samples from stereo to original channel layout.
|
||||||
*/
|
*/
|
||||||
#include "ac3dec.h"
|
#include "ac3dec.h"
|
||||||
|
#include "eac3dec.c"
|
||||||
#include "ac3dec.c"
|
#include "ac3dec.c"
|
||||||
|
|
||||||
static const AVOption options[] = {
|
static const AVOption options[] = {
|
||||||
|
@ -578,6 +578,8 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
|
|||||||
case AV_CODEC_ID_ADPCM_IMA_DK4:
|
case AV_CODEC_ID_ADPCM_IMA_DK4:
|
||||||
if (avctx->block_align > 0)
|
if (avctx->block_align > 0)
|
||||||
buf_size = FFMIN(buf_size, avctx->block_align);
|
buf_size = FFMIN(buf_size, avctx->block_align);
|
||||||
|
if (buf_size < 4 * ch)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
nb_samples = 1 + (buf_size - 4 * ch) * 2 / ch;
|
nb_samples = 1 + (buf_size - 4 * ch) * 2 / ch;
|
||||||
break;
|
break;
|
||||||
case AV_CODEC_ID_ADPCM_IMA_RAD:
|
case AV_CODEC_ID_ADPCM_IMA_RAD:
|
||||||
@ -591,13 +593,15 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
|
|||||||
int bsamples = ff_adpcm_ima_block_samples[avctx->bits_per_coded_sample - 2];
|
int bsamples = ff_adpcm_ima_block_samples[avctx->bits_per_coded_sample - 2];
|
||||||
if (avctx->block_align > 0)
|
if (avctx->block_align > 0)
|
||||||
buf_size = FFMIN(buf_size, avctx->block_align);
|
buf_size = FFMIN(buf_size, avctx->block_align);
|
||||||
|
if (buf_size < 4 * ch)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
nb_samples = 1 + (buf_size - 4 * ch) / (bsize * ch) * bsamples;
|
nb_samples = 1 + (buf_size - 4 * ch) / (bsize * ch) * bsamples;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AV_CODEC_ID_ADPCM_MS:
|
case AV_CODEC_ID_ADPCM_MS:
|
||||||
if (avctx->block_align > 0)
|
if (avctx->block_align > 0)
|
||||||
buf_size = FFMIN(buf_size, avctx->block_align);
|
buf_size = FFMIN(buf_size, avctx->block_align);
|
||||||
nb_samples = 2 + (buf_size - 7 * ch) * 2 / ch;
|
nb_samples = (buf_size - 6 * ch) * 2 / ch;
|
||||||
break;
|
break;
|
||||||
case AV_CODEC_ID_ADPCM_SBPRO_2:
|
case AV_CODEC_ID_ADPCM_SBPRO_2:
|
||||||
case AV_CODEC_ID_ADPCM_SBPRO_3:
|
case AV_CODEC_ID_ADPCM_SBPRO_3:
|
||||||
@ -610,6 +614,8 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
|
|||||||
case AV_CODEC_ID_ADPCM_SBPRO_4: samples_per_byte = 2; break;
|
case AV_CODEC_ID_ADPCM_SBPRO_4: samples_per_byte = 2; break;
|
||||||
}
|
}
|
||||||
if (!s->status[0].step_index) {
|
if (!s->status[0].step_index) {
|
||||||
|
if (buf_size < ch)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
nb_samples++;
|
nb_samples++;
|
||||||
buf_size -= ch;
|
buf_size -= ch;
|
||||||
}
|
}
|
||||||
@ -1528,6 +1534,11 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
|
|
||||||
*got_frame_ptr = 1;
|
*got_frame_ptr = 1;
|
||||||
|
|
||||||
|
if (avpkt->size < bytestream2_tell(&gb)) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Overread of %d < %d\n", avpkt->size, bytestream2_tell(&gb));
|
||||||
|
return avpkt->size;
|
||||||
|
}
|
||||||
|
|
||||||
return bytestream2_tell(&gb);
|
return bytestream2_tell(&gb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,6 +316,11 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index,
|
|||||||
int lpc_quant[2];
|
int lpc_quant[2];
|
||||||
int rice_history_mult[2];
|
int rice_history_mult[2];
|
||||||
|
|
||||||
|
if (!alac->rice_limit) {
|
||||||
|
avpriv_request_sample(alac->avctx, "Compression with rice limit 0");
|
||||||
|
return AVERROR(ENOSYS);
|
||||||
|
}
|
||||||
|
|
||||||
decorr_shift = get_bits(&alac->gb, 8);
|
decorr_shift = get_bits(&alac->gb, 8);
|
||||||
decorr_left_weight = get_bits(&alac->gb, 8);
|
decorr_left_weight = get_bits(&alac->gb, 8);
|
||||||
|
|
||||||
@ -528,6 +533,12 @@ static int allocate_buffers(ALACContext *alac)
|
|||||||
int ch;
|
int ch;
|
||||||
int buf_size = alac->max_samples_per_frame * sizeof(int32_t);
|
int buf_size = alac->max_samples_per_frame * sizeof(int32_t);
|
||||||
|
|
||||||
|
for (ch = 0; ch < 2; ch++) {
|
||||||
|
alac->predict_error_buffer[ch] = NULL;
|
||||||
|
alac->output_samples_buffer[ch] = NULL;
|
||||||
|
alac->extra_bits_buffer[ch] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
for (ch = 0; ch < FFMIN(alac->channels, 2); ch++) {
|
for (ch = 0; ch < FFMIN(alac->channels, 2); ch++) {
|
||||||
FF_ALLOC_OR_GOTO(alac->avctx, alac->predict_error_buffer[ch],
|
FF_ALLOC_OR_GOTO(alac->avctx, alac->predict_error_buffer[ch],
|
||||||
buf_size, buf_alloc_fail);
|
buf_size, buf_alloc_fail);
|
||||||
|
@ -357,11 +357,15 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
|
|||||||
|
|
||||||
ctx->cs_switch = 1;
|
ctx->cs_switch = 1;
|
||||||
|
|
||||||
|
for (i = 0; i < avctx->channels; i++) {
|
||||||
|
sconf->chan_pos[i] = -1;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < avctx->channels; i++) {
|
for (i = 0; i < avctx->channels; i++) {
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
idx = get_bits(&gb, chan_pos_bits);
|
idx = get_bits(&gb, chan_pos_bits);
|
||||||
if (idx >= avctx->channels) {
|
if (idx >= avctx->channels || sconf->chan_pos[idx] != -1) {
|
||||||
av_log(avctx, AV_LOG_WARNING, "Invalid channel reordering.\n");
|
av_log(avctx, AV_LOG_WARNING, "Invalid channel reordering.\n");
|
||||||
ctx->cs_switch = 0;
|
ctx->cs_switch = 0;
|
||||||
break;
|
break;
|
||||||
@ -678,7 +682,7 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
|||||||
|
|
||||||
|
|
||||||
if (!sconf->rlslms) {
|
if (!sconf->rlslms) {
|
||||||
if (sconf->adapt_order) {
|
if (sconf->adapt_order && sconf->max_order) {
|
||||||
int opt_order_length = av_ceil_log2(av_clip((bd->block_length >> 3) - 1,
|
int opt_order_length = av_ceil_log2(av_clip((bd->block_length >> 3) - 1,
|
||||||
2, sconf->max_order + 1));
|
2, sconf->max_order + 1));
|
||||||
*bd->opt_order = get_bits(gb, opt_order_length);
|
*bd->opt_order = get_bits(gb, opt_order_length);
|
||||||
@ -1242,6 +1246,7 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
|
|||||||
ALSChannelData *ch = cd[c];
|
ALSChannelData *ch = cd[c];
|
||||||
unsigned int dep = 0;
|
unsigned int dep = 0;
|
||||||
unsigned int channels = ctx->avctx->channels;
|
unsigned int channels = ctx->avctx->channels;
|
||||||
|
unsigned int channel_size = ctx->sconf.frame_length + ctx->sconf.max_order;
|
||||||
|
|
||||||
if (reverted[c])
|
if (reverted[c])
|
||||||
return 0;
|
return 0;
|
||||||
@ -1272,9 +1277,9 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
|
|||||||
bd->raw_samples = ctx->raw_samples[c] + offset;
|
bd->raw_samples = ctx->raw_samples[c] + offset;
|
||||||
|
|
||||||
for (dep = 0; !ch[dep].stop_flag; dep++) {
|
for (dep = 0; !ch[dep].stop_flag; dep++) {
|
||||||
unsigned int smp;
|
ptrdiff_t smp;
|
||||||
unsigned int begin = 1;
|
ptrdiff_t begin = 1;
|
||||||
unsigned int end = bd->block_length - 1;
|
ptrdiff_t end = bd->block_length - 1;
|
||||||
int64_t y;
|
int64_t y;
|
||||||
int32_t *master = ctx->raw_samples[ch[dep].master_channel] + offset;
|
int32_t *master = ctx->raw_samples[ch[dep].master_channel] + offset;
|
||||||
|
|
||||||
@ -1286,11 +1291,28 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
|
|||||||
|
|
||||||
if (ch[dep].time_diff_sign) {
|
if (ch[dep].time_diff_sign) {
|
||||||
t = -t;
|
t = -t;
|
||||||
|
if (begin < t) {
|
||||||
|
av_log(ctx->avctx, AV_LOG_ERROR, "begin %td smaller than time diff index %d.\n", begin, t);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
begin -= t;
|
begin -= t;
|
||||||
} else {
|
} else {
|
||||||
|
if (end < t) {
|
||||||
|
av_log(ctx->avctx, AV_LOG_ERROR, "end %td smaller than time diff index %d.\n", end, t);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
end -= t;
|
end -= t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (FFMIN(begin - 1, begin - 1 + t) < ctx->raw_buffer - master ||
|
||||||
|
FFMAX(end + 1, end + 1 + t) > ctx->raw_buffer + channels * channel_size - master) {
|
||||||
|
av_log(ctx->avctx, AV_LOG_ERROR,
|
||||||
|
"sample pointer range [%p, %p] not contained in raw_buffer [%p, %p].\n",
|
||||||
|
master + FFMIN(begin - 1, begin - 1 + t), master + FFMAX(end + 1, end + 1 + t),
|
||||||
|
ctx->raw_buffer, ctx->raw_buffer + channels * channel_size);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
for (smp = begin; smp < end; smp++) {
|
for (smp = begin; smp < end; smp++) {
|
||||||
y = (1 << 6) +
|
y = (1 << 6) +
|
||||||
MUL64(ch[dep].weighting[0], master[smp - 1 ]) +
|
MUL64(ch[dep].weighting[0], master[smp - 1 ]) +
|
||||||
@ -1303,6 +1325,16 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
|
|||||||
bd->raw_samples[smp] += y >> 7;
|
bd->raw_samples[smp] += y >> 7;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if (begin - 1 < ctx->raw_buffer - master ||
|
||||||
|
end + 1 > ctx->raw_buffer + channels * channel_size - master) {
|
||||||
|
av_log(ctx->avctx, AV_LOG_ERROR,
|
||||||
|
"sample pointer range [%p, %p] not contained in raw_buffer [%p, %p].\n",
|
||||||
|
master + begin - 1, master + end + 1,
|
||||||
|
ctx->raw_buffer, ctx->raw_buffer + channels * channel_size);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
for (smp = begin; smp < end; smp++) {
|
for (smp = begin; smp < end; smp++) {
|
||||||
y = (1 << 6) +
|
y = (1 << 6) +
|
||||||
MUL64(ch[dep].weighting[0], master[smp - 1]) +
|
MUL64(ch[dep].weighting[0], master[smp - 1]) +
|
||||||
@ -1461,6 +1493,11 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
|
|||||||
|
|
||||||
// TODO: read_diff_float_data
|
// TODO: read_diff_float_data
|
||||||
|
|
||||||
|
if (get_bits_left(gb) < 0) {
|
||||||
|
av_log(ctx->avctx, AV_LOG_ERROR, "Overread %d\n", -get_bits_left(gb));
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1666,6 +1703,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
|||||||
avctx->sample_fmt = sconf->resolution > 1
|
avctx->sample_fmt = sconf->resolution > 1
|
||||||
? AV_SAMPLE_FMT_S32 : AV_SAMPLE_FMT_S16;
|
? AV_SAMPLE_FMT_S32 : AV_SAMPLE_FMT_S16;
|
||||||
avctx->bits_per_raw_sample = (sconf->resolution + 1) * 8;
|
avctx->bits_per_raw_sample = (sconf->resolution + 1) * 8;
|
||||||
|
if (avctx->bits_per_raw_sample > 32) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Bits per raw sample %d larger than 32.\n",
|
||||||
|
avctx->bits_per_raw_sample);
|
||||||
|
ret = AVERROR_INVALIDDATA;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set maximum Rice parameter for progressive decoding based on resolution
|
// set maximum Rice parameter for progressive decoding based on resolution
|
||||||
@ -1728,9 +1771,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
// allocate and assign channel data buffer for mcc mode
|
// allocate and assign channel data buffer for mcc mode
|
||||||
if (sconf->mc_coding) {
|
if (sconf->mc_coding) {
|
||||||
ctx->chan_data_buffer = av_malloc(sizeof(*ctx->chan_data_buffer) *
|
ctx->chan_data_buffer = av_mallocz(sizeof(*ctx->chan_data_buffer) *
|
||||||
num_buffers * num_buffers);
|
num_buffers * num_buffers);
|
||||||
ctx->chan_data = av_malloc(sizeof(*ctx->chan_data) *
|
ctx->chan_data = av_mallocz(sizeof(*ctx->chan_data) *
|
||||||
num_buffers);
|
num_buffers);
|
||||||
ctx->reverted_channels = av_malloc(sizeof(*ctx->reverted_channels) *
|
ctx->reverted_channels = av_malloc(sizeof(*ctx->reverted_channels) *
|
||||||
num_buffers);
|
num_buffers);
|
||||||
|
@ -592,14 +592,14 @@ static void decode_array_0000(APEContext *ctx, GetBitContext *gb,
|
|||||||
int ksummax, ksummin;
|
int ksummax, ksummin;
|
||||||
|
|
||||||
rice->ksum = 0;
|
rice->ksum = 0;
|
||||||
for (i = 0; i < 5; i++) {
|
for (i = 0; i < FFMIN(blockstodecode, 5); i++) {
|
||||||
out[i] = get_rice_ook(&ctx->gb, 10);
|
out[i] = get_rice_ook(&ctx->gb, 10);
|
||||||
rice->ksum += out[i];
|
rice->ksum += out[i];
|
||||||
}
|
}
|
||||||
rice->k = av_log2(rice->ksum / 10) + 1;
|
rice->k = av_log2(rice->ksum / 10) + 1;
|
||||||
if (rice->k >= 24)
|
if (rice->k >= 24)
|
||||||
return;
|
return;
|
||||||
for (; i < 64; i++) {
|
for (; i < FFMIN(blockstodecode, 64); i++) {
|
||||||
out[i] = get_rice_ook(&ctx->gb, rice->k);
|
out[i] = get_rice_ook(&ctx->gb, rice->k);
|
||||||
rice->ksum += out[i];
|
rice->ksum += out[i];
|
||||||
rice->k = av_log2(rice->ksum / ((i + 1) * 2)) + 1;
|
rice->k = av_log2(rice->ksum / ((i + 1) * 2)) + 1;
|
||||||
@ -1461,13 +1461,13 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
nblocks);
|
nblocks);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
s->samples = nblocks;
|
|
||||||
|
|
||||||
/* Initialize the frame decoder */
|
/* Initialize the frame decoder */
|
||||||
if (init_frame_decoder(s) < 0) {
|
if (init_frame_decoder(s) < 0) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Error reading frame header\n");
|
av_log(avctx, AV_LOG_ERROR, "Error reading frame header\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
s->samples = nblocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s->data) {
|
if (!s->data) {
|
||||||
|
@ -37,6 +37,7 @@ OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_init_arm.o
|
|||||||
OBJS-$(CONFIG_FLAC_DECODER) += arm/flacdsp_init_arm.o \
|
OBJS-$(CONFIG_FLAC_DECODER) += arm/flacdsp_init_arm.o \
|
||||||
arm/flacdsp_arm.o
|
arm/flacdsp_arm.o
|
||||||
OBJS-$(CONFIG_FLAC_ENCODER) += arm/flacdsp_init_arm.o
|
OBJS-$(CONFIG_FLAC_ENCODER) += arm/flacdsp_init_arm.o
|
||||||
|
OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_arm.o
|
||||||
OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_init_arm.o
|
OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_init_arm.o
|
||||||
OBJS-$(CONFIG_VC1_DECODER) += arm/vc1dsp_init_arm.o
|
OBJS-$(CONFIG_VC1_DECODER) += arm/vc1dsp_init_arm.o
|
||||||
OBJS-$(CONFIG_VORBIS_DECODER) += arm/vorbisdsp_init_arm.o
|
OBJS-$(CONFIG_VORBIS_DECODER) += arm/vorbisdsp_init_arm.o
|
||||||
|
26
libavcodec/arm/hevcdsp_arm.h
Normal file
26
libavcodec/arm/hevcdsp_arm.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AVCODEC_ARM_HEVCDSP_ARM_H
|
||||||
|
#define AVCODEC_ARM_HEVCDSP_ARM_H
|
||||||
|
|
||||||
|
#include "libavcodec/hevcdsp.h"
|
||||||
|
|
||||||
|
void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth);
|
||||||
|
|
||||||
|
#endif /* AVCODEC_ARM_HEVCDSP_ARM_H */
|
32
libavcodec/arm/hevcdsp_init_arm.c
Normal file
32
libavcodec/arm/hevcdsp_init_arm.c
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 Seppo Tomperi <seppo.tomperi@vtt.fi>
|
||||||
|
*
|
||||||
|
* 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 "libavutil/attributes.h"
|
||||||
|
#include "libavutil/arm/cpu.h"
|
||||||
|
#include "libavcodec/hevcdsp.h"
|
||||||
|
#include "hevcdsp_arm.h"
|
||||||
|
|
||||||
|
av_cold void ff_hevcdsp_init_arm(HEVCDSPContext *c, const int bit_depth)
|
||||||
|
{
|
||||||
|
int cpu_flags = av_get_cpu_flags();
|
||||||
|
|
||||||
|
if (have_neon(cpu_flags))
|
||||||
|
ff_hevcdsp_init_neon(c, bit_depth);
|
||||||
|
}
|
@ -21,6 +21,7 @@
|
|||||||
#include "libavutil/attributes.h"
|
#include "libavutil/attributes.h"
|
||||||
#include "libavutil/arm/cpu.h"
|
#include "libavutil/arm/cpu.h"
|
||||||
#include "libavcodec/hevcdsp.h"
|
#include "libavcodec/hevcdsp.h"
|
||||||
|
#include "hevcdsp_arm.h"
|
||||||
|
|
||||||
void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
|
void ff_hevc_v_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
|
||||||
void ff_hevc_h_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
|
void ff_hevc_h_loop_filter_luma_neon(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
|
||||||
@ -141,9 +142,8 @@ void ff_hevc_put_qpel_bi_neon_wrapper(uint8_t *dst, ptrdiff_t dststride, uint8_t
|
|||||||
put_hevc_qpel_uw_neon[my][mx](dst, dststride, src, srcstride, width, height, src2, MAX_PB_SIZE);
|
put_hevc_qpel_uw_neon[my][mx](dst, dststride, src, srcstride, width, height, src2, MAX_PB_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold void hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth)
|
av_cold void ff_hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth)
|
||||||
{
|
{
|
||||||
#if HAVE_NEON
|
|
||||||
if (bit_depth == 8) {
|
if (bit_depth == 8) {
|
||||||
int x;
|
int x;
|
||||||
c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_neon;
|
c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_neon;
|
||||||
@ -221,13 +221,4 @@ static av_cold void hevcdsp_init_neon(HEVCDSPContext *c, const int bit_depth)
|
|||||||
c->put_hevc_qpel_uni[8][0][0] = ff_hevc_put_qpel_uw_pixels_w48_neon_8;
|
c->put_hevc_qpel_uni[8][0][0] = ff_hevc_put_qpel_uw_pixels_w48_neon_8;
|
||||||
c->put_hevc_qpel_uni[9][0][0] = ff_hevc_put_qpel_uw_pixels_w64_neon_8;
|
c->put_hevc_qpel_uni[9][0][0] = ff_hevc_put_qpel_uw_pixels_w64_neon_8;
|
||||||
}
|
}
|
||||||
#endif // HAVE_NEON
|
|
||||||
}
|
|
||||||
|
|
||||||
void ff_hevcdsp_init_arm(HEVCDSPContext *c, const int bit_depth)
|
|
||||||
{
|
|
||||||
int cpu_flags = av_get_cpu_flags();
|
|
||||||
|
|
||||||
if (have_neon(cpu_flags))
|
|
||||||
hevcdsp_init_neon(c, bit_depth);
|
|
||||||
}
|
}
|
||||||
|
@ -381,7 +381,7 @@ static int atrac3p_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
|
|
||||||
*got_frame_ptr = 1;
|
*got_frame_ptr = 1;
|
||||||
|
|
||||||
return avctx->block_align;
|
return FFMIN(avctx->block_align, avpkt->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
AVCodec ff_atrac3p_decoder = {
|
AVCodec ff_atrac3p_decoder = {
|
||||||
|
@ -599,8 +599,8 @@ void ff_atrac3p_ipqf(FFTContext *dct_ctx, Atrac3pIPQFChannelCtx *hist,
|
|||||||
const float *in, float *out)
|
const float *in, float *out)
|
||||||
{
|
{
|
||||||
int i, s, sb, t, pos_now, pos_next;
|
int i, s, sb, t, pos_now, pos_next;
|
||||||
DECLARE_ALIGNED(32, float, idct_in)[ATRAC3P_SUBBANDS];
|
LOCAL_ALIGNED(32, float, idct_in, [ATRAC3P_SUBBANDS]);
|
||||||
DECLARE_ALIGNED(32, float, idct_out)[ATRAC3P_SUBBANDS];
|
LOCAL_ALIGNED(32, float, idct_out, [ATRAC3P_SUBBANDS]);
|
||||||
|
|
||||||
memset(out, 0, ATRAC3P_FRAME_SAMPLES * sizeof(*out));
|
memset(out, 0, ATRAC3P_FRAME_SAMPLES * sizeof(*out));
|
||||||
|
|
||||||
|
@ -69,6 +69,8 @@ void avpriv_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
|
|||||||
if (length == 0)
|
if (length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
av_assert0(length <= put_bits_left(pb));
|
||||||
|
|
||||||
if (CONFIG_SMALL || words < 16 || put_bits_count(pb) & 7) {
|
if (CONFIG_SMALL || words < 16 || put_bits_count(pb) & 7) {
|
||||||
for (i = 0; i < words; i++)
|
for (i = 0; i < words; i++)
|
||||||
put_bits(pb, 16, AV_RB16(src + 2 * i));
|
put_bits(pb, 16, AV_RB16(src + 2 * i));
|
||||||
|
@ -71,8 +71,10 @@ static av_always_inline type bytestream2_get_ ## name ## u(GetByteContext *g) \
|
|||||||
} \
|
} \
|
||||||
static av_always_inline type bytestream2_get_ ## name(GetByteContext *g) \
|
static av_always_inline type bytestream2_get_ ## name(GetByteContext *g) \
|
||||||
{ \
|
{ \
|
||||||
if (g->buffer_end - g->buffer < bytes) \
|
if (g->buffer_end - g->buffer < bytes) { \
|
||||||
|
g->buffer = g->buffer_end; \
|
||||||
return 0; \
|
return 0; \
|
||||||
|
} \
|
||||||
return bytestream2_get_ ## name ## u(g); \
|
return bytestream2_get_ ## name ## u(g); \
|
||||||
} \
|
} \
|
||||||
static av_always_inline type bytestream2_peek_ ## name(GetByteContext *g) \
|
static av_always_inline type bytestream2_peek_ ## name(GetByteContext *g) \
|
||||||
|
@ -563,6 +563,11 @@ static int decode_residual_block(AVSContext *h, GetBitContext *gb,
|
|||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
esc_code = get_ue_code(gb, esc_golomb_order);
|
esc_code = get_ue_code(gb, esc_golomb_order);
|
||||||
|
if (esc_code < 0 || esc_code > 32767) {
|
||||||
|
av_log(h->avctx, AV_LOG_ERROR, "esc_code invalid\n");
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
level = esc_code + (run > r->max_run ? 1 : r->level_add[run]);
|
level = esc_code + (run > r->max_run ? 1 : r->level_add[run]);
|
||||||
while (level > r->inc_limit)
|
while (level > r->inc_limit)
|
||||||
r++;
|
r++;
|
||||||
@ -1118,6 +1123,7 @@ static int decode_seq_header(AVSContext *h)
|
|||||||
{
|
{
|
||||||
int frame_rate_code;
|
int frame_rate_code;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
int ret;
|
||||||
|
|
||||||
h->profile = get_bits(&h->gb, 8);
|
h->profile = get_bits(&h->gb, 8);
|
||||||
h->level = get_bits(&h->gb, 8);
|
h->level = get_bits(&h->gb, 8);
|
||||||
@ -1134,9 +1140,6 @@ static int decode_seq_header(AVSContext *h)
|
|||||||
av_log(h->avctx, AV_LOG_ERROR, "Dimensions invalid\n");
|
av_log(h->avctx, AV_LOG_ERROR, "Dimensions invalid\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
h->width = width;
|
|
||||||
h->height = height;
|
|
||||||
|
|
||||||
skip_bits(&h->gb, 2); //chroma format
|
skip_bits(&h->gb, 2); //chroma format
|
||||||
skip_bits(&h->gb, 3); //sample_precision
|
skip_bits(&h->gb, 3); //sample_precision
|
||||||
h->aspect_ratio = get_bits(&h->gb, 4);
|
h->aspect_ratio = get_bits(&h->gb, 4);
|
||||||
@ -1145,11 +1148,16 @@ static int decode_seq_header(AVSContext *h)
|
|||||||
skip_bits1(&h->gb); //marker_bit
|
skip_bits1(&h->gb); //marker_bit
|
||||||
skip_bits(&h->gb, 12); //bit_rate_upper
|
skip_bits(&h->gb, 12); //bit_rate_upper
|
||||||
h->low_delay = get_bits1(&h->gb);
|
h->low_delay = get_bits1(&h->gb);
|
||||||
|
|
||||||
|
ret = ff_set_dimensions(h->avctx, width, height);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
h->width = width;
|
||||||
|
h->height = height;
|
||||||
h->mb_width = (h->width + 15) >> 4;
|
h->mb_width = (h->width + 15) >> 4;
|
||||||
h->mb_height = (h->height + 15) >> 4;
|
h->mb_height = (h->height + 15) >> 4;
|
||||||
h->avctx->framerate = ff_mpeg12_frame_rate_tab[frame_rate_code];
|
h->avctx->framerate = ff_mpeg12_frame_rate_tab[frame_rate_code];
|
||||||
h->avctx->width = h->width;
|
|
||||||
h->avctx->height = h->height;
|
|
||||||
if (!h->top_qp)
|
if (!h->top_qp)
|
||||||
return ff_cavs_init_top_lines(h);
|
return ff_cavs_init_top_lines(h);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -226,6 +226,14 @@ static int dca_parse_audio_coding_header(DCAContext *s, int base_channel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nchans = get_bits(&s->gb, 3) + 1;
|
nchans = get_bits(&s->gb, 3) + 1;
|
||||||
|
if (xxch && nchans >= 3) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "nchans %d is too large\n", nchans);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
} else if (nchans + base_channel > DCA_PRIM_CHANNELS_MAX) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "channel sum %d + %d is too large\n", nchans, base_channel);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
s->total_channels = nchans + base_channel;
|
s->total_channels = nchans + base_channel;
|
||||||
s->prim_channels = s->total_channels;
|
s->prim_channels = s->total_channels;
|
||||||
|
|
||||||
@ -426,6 +434,10 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
|
|||||||
|
|
||||||
if (!base_channel) {
|
if (!base_channel) {
|
||||||
s->subsubframes[s->current_subframe] = get_bits(&s->gb, 2) + 1;
|
s->subsubframes[s->current_subframe] = get_bits(&s->gb, 2) + 1;
|
||||||
|
if (block_index + s->subsubframes[s->current_subframe] > s->sample_blocks/8) {
|
||||||
|
s->subsubframes[s->current_subframe] = 1;
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
s->partial_samples[s->current_subframe] = get_bits(&s->gb, 3);
|
s->partial_samples[s->current_subframe] = get_bits(&s->gb, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1120,8 +1132,13 @@ int ff_dca_xbr_parse_frame(DCAContext *s)
|
|||||||
for(i = 0; i < num_chsets; i++) {
|
for(i = 0; i < num_chsets; i++) {
|
||||||
n_xbr_ch[i] = get_bits(&s->gb, 3) + 1;
|
n_xbr_ch[i] = get_bits(&s->gb, 3) + 1;
|
||||||
k = get_bits(&s->gb, 2) + 5;
|
k = get_bits(&s->gb, 2) + 5;
|
||||||
for(j = 0; j < n_xbr_ch[i]; j++)
|
for(j = 0; j < n_xbr_ch[i]; j++) {
|
||||||
active_bands[i][j] = get_bits(&s->gb, k) + 1;
|
active_bands[i][j] = get_bits(&s->gb, k) + 1;
|
||||||
|
if (active_bands[i][j] > DCA_SUBBANDS) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "too many active subbands (%d)\n", active_bands[i][j]);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* skip to the end of the header */
|
/* skip to the end of the header */
|
||||||
@ -1163,23 +1180,34 @@ int ff_dca_xbr_parse_frame(DCAContext *s)
|
|||||||
for(i = 0; i < n_xbr_ch[chset]; i++) {
|
for(i = 0; i < n_xbr_ch[chset]; i++) {
|
||||||
const uint32_t *scale_table;
|
const uint32_t *scale_table;
|
||||||
int nbits;
|
int nbits;
|
||||||
|
int scale_table_size;
|
||||||
|
|
||||||
if (s->scalefactor_huffman[chan_base+i] == 6) {
|
if (s->scalefactor_huffman[chan_base+i] == 6) {
|
||||||
scale_table = ff_dca_scale_factor_quant7;
|
scale_table = ff_dca_scale_factor_quant7;
|
||||||
|
scale_table_size = FF_ARRAY_ELEMS(ff_dca_scale_factor_quant7);
|
||||||
} else {
|
} else {
|
||||||
scale_table = ff_dca_scale_factor_quant6;
|
scale_table = ff_dca_scale_factor_quant6;
|
||||||
|
scale_table_size = FF_ARRAY_ELEMS(ff_dca_scale_factor_quant6);
|
||||||
}
|
}
|
||||||
|
|
||||||
nbits = anctemp[i];
|
nbits = anctemp[i];
|
||||||
|
|
||||||
for(j = 0; j < active_bands[chset][i]; j++) {
|
for(j = 0; j < active_bands[chset][i]; j++) {
|
||||||
if(abits_high[i][j] > 0) {
|
if(abits_high[i][j] > 0) {
|
||||||
scale_table_high[i][j][0] =
|
int index = get_bits(&s->gb, nbits);
|
||||||
scale_table[get_bits(&s->gb, nbits)];
|
if (index >= scale_table_size) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "scale table index %d invalid\n", index);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
scale_table_high[i][j][0] = scale_table[index];
|
||||||
|
|
||||||
if(xbr_tmode && s->transition_mode[i][j]) {
|
if(xbr_tmode && s->transition_mode[i][j]) {
|
||||||
scale_table_high[i][j][1] =
|
int index = get_bits(&s->gb, nbits);
|
||||||
scale_table[get_bits(&s->gb, nbits)];
|
if (index >= scale_table_size) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "scale table index %d invalid\n", index);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
scale_table_high[i][j][1] = scale_table[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -801,7 +801,10 @@ static int decode_lowdelay(DiracContext *s)
|
|||||||
slice_num++;
|
slice_num++;
|
||||||
|
|
||||||
buf += bytes;
|
buf += bytes;
|
||||||
|
if (bufsize/8 >= bytes)
|
||||||
bufsize -= bytes*8;
|
bufsize -= bytes*8;
|
||||||
|
else
|
||||||
|
bufsize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
avctx->execute(avctx, decode_lowdelay_slice, slices, NULL, slice_num,
|
avctx->execute(avctx, decode_lowdelay_slice, slices, NULL, slice_num,
|
||||||
@ -899,6 +902,14 @@ static int dirac_unpack_prediction_parameters(DiracContext *s)
|
|||||||
/*[DIRAC_STD] 11.2.4 motion_data_dimensions()
|
/*[DIRAC_STD] 11.2.4 motion_data_dimensions()
|
||||||
Calculated in function dirac_unpack_block_motion_data */
|
Calculated in function dirac_unpack_block_motion_data */
|
||||||
|
|
||||||
|
if (s->plane[0].xblen % (1 << s->chroma_x_shift) != 0 ||
|
||||||
|
s->plane[0].yblen % (1 << s->chroma_y_shift) != 0 ||
|
||||||
|
!s->plane[0].xblen || !s->plane[0].yblen) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR,
|
||||||
|
"invalid x/y block length (%d/%d) for x/y chroma shift (%d/%d)\n",
|
||||||
|
s->plane[0].xblen, s->plane[0].yblen, s->chroma_x_shift, s->chroma_y_shift);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
if (!s->plane[0].xbsep || !s->plane[0].ybsep || s->plane[0].xbsep < s->plane[0].xblen/2 || s->plane[0].ybsep < s->plane[0].yblen/2) {
|
if (!s->plane[0].xbsep || !s->plane[0].ybsep || s->plane[0].xbsep < s->plane[0].xblen/2 || s->plane[0].ybsep < s->plane[0].yblen/2) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "Block separation too small\n");
|
av_log(s->avctx, AV_LOG_ERROR, "Block separation too small\n");
|
||||||
return -1;
|
return -1;
|
||||||
@ -1553,7 +1564,7 @@ static void select_dsp_funcs(DiracContext *s, int width, int height, int xblen,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void interpolate_refplane(DiracContext *s, DiracFrame *ref, int plane, int width, int height)
|
static int interpolate_refplane(DiracContext *s, DiracFrame *ref, int plane, int width, int height)
|
||||||
{
|
{
|
||||||
/* chroma allocates an edge of 8 when subsampled
|
/* chroma allocates an edge of 8 when subsampled
|
||||||
which for 4:2:2 means an h edge of 16 and v edge of 8
|
which for 4:2:2 means an h edge of 16 and v edge of 8
|
||||||
@ -1565,11 +1576,14 @@ static void interpolate_refplane(DiracContext *s, DiracFrame *ref, int plane, in
|
|||||||
|
|
||||||
/* no need for hpel if we only have fpel vectors */
|
/* no need for hpel if we only have fpel vectors */
|
||||||
if (!s->mv_precision)
|
if (!s->mv_precision)
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
for (i = 1; i < 4; i++) {
|
for (i = 1; i < 4; i++) {
|
||||||
if (!ref->hpel_base[plane][i])
|
if (!ref->hpel_base[plane][i])
|
||||||
ref->hpel_base[plane][i] = av_malloc((height+2*edge) * ref->avframe->linesize[plane] + 32);
|
ref->hpel_base[plane][i] = av_malloc((height+2*edge) * ref->avframe->linesize[plane] + 32);
|
||||||
|
if (!ref->hpel_base[plane][i]) {
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
}
|
||||||
/* we need to be 16-byte aligned even for chroma */
|
/* we need to be 16-byte aligned even for chroma */
|
||||||
ref->hpel[plane][i] = ref->hpel_base[plane][i] + edge*ref->avframe->linesize[plane] + 16;
|
ref->hpel[plane][i] = ref->hpel_base[plane][i] + edge*ref->avframe->linesize[plane] + 16;
|
||||||
}
|
}
|
||||||
@ -1583,6 +1597,8 @@ static void interpolate_refplane(DiracContext *s, DiracFrame *ref, int plane, in
|
|||||||
s->mpvencdsp.draw_edges(ref->hpel[plane][3], ref->avframe->linesize[plane], width, height, edge, edge, EDGE_TOP | EDGE_BOTTOM);
|
s->mpvencdsp.draw_edges(ref->hpel[plane][3], ref->avframe->linesize[plane], width, height, edge, edge, EDGE_TOP | EDGE_BOTTOM);
|
||||||
}
|
}
|
||||||
ref->interpolated[plane] = 1;
|
ref->interpolated[plane] = 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1635,8 +1651,11 @@ static int dirac_decode_frame_internal(DiracContext *s)
|
|||||||
|
|
||||||
select_dsp_funcs(s, p->width, p->height, p->xblen, p->yblen);
|
select_dsp_funcs(s, p->width, p->height, p->xblen, p->yblen);
|
||||||
|
|
||||||
for (i = 0; i < s->num_refs; i++)
|
for (i = 0; i < s->num_refs; i++) {
|
||||||
interpolate_refplane(s, s->ref_pics[i], comp, p->width, p->height);
|
int ret = interpolate_refplane(s, s->ref_pics[i], comp, p->width, p->height);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
memset(s->mctmp, 0, 4*p->yoffset*p->stride);
|
memset(s->mctmp, 0, 4*p->yoffset*p->stride);
|
||||||
|
|
||||||
@ -1742,6 +1761,12 @@ static int dirac_decode_picture_header(DiracContext *s)
|
|||||||
get_buffer_with_edge(s->avctx, s->ref_pics[i]->avframe, AV_GET_BUFFER_FLAG_REF);
|
get_buffer_with_edge(s->avctx, s->ref_pics[i]->avframe, AV_GET_BUFFER_FLAG_REF);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!s->ref_pics[i]) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "Reference could not be allocated\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* retire the reference frames that are not used anymore */
|
/* retire the reference frames that are not used anymore */
|
||||||
@ -1937,8 +1962,8 @@ static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
data_unit_size = AV_RB32(buf+buf_idx+5);
|
data_unit_size = AV_RB32(buf+buf_idx+5);
|
||||||
if (buf_idx + data_unit_size > buf_size || !data_unit_size) {
|
if (data_unit_size > buf_size - buf_idx || !data_unit_size) {
|
||||||
if(buf_idx + data_unit_size > buf_size)
|
if(data_unit_size > buf_size - buf_idx)
|
||||||
av_log(s->avctx, AV_LOG_ERROR,
|
av_log(s->avctx, AV_LOG_ERROR,
|
||||||
"Data unit with size %d is larger than input buffer, discarding\n",
|
"Data unit with size %d is larger than input buffer, discarding\n",
|
||||||
data_unit_size);
|
data_unit_size);
|
||||||
|
@ -119,6 +119,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
|
|||||||
static const uint8_t header_prefix[] = { 0x00, 0x00, 0x02, 0x80, 0x01 };
|
static const uint8_t header_prefix[] = { 0x00, 0x00, 0x02, 0x80, 0x01 };
|
||||||
static const uint8_t header_prefix444[] = { 0x00, 0x00, 0x02, 0x80, 0x02 };
|
static const uint8_t header_prefix444[] = { 0x00, 0x00, 0x02, 0x80, 0x02 };
|
||||||
int i, cid, ret;
|
int i, cid, ret;
|
||||||
|
int old_bit_depth = ctx->bit_depth;
|
||||||
|
|
||||||
if (buf_size < 0x280) {
|
if (buf_size < 0x280) {
|
||||||
av_log(ctx->avctx, AV_LOG_ERROR, "buffer too small (%d < 640).\n",
|
av_log(ctx->avctx, AV_LOG_ERROR, "buffer too small (%d < 640).\n",
|
||||||
@ -143,10 +144,6 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
|
|||||||
|
|
||||||
av_dlog(ctx->avctx, "width %d, height %d\n", ctx->width, ctx->height);
|
av_dlog(ctx->avctx, "width %d, height %d\n", ctx->width, ctx->height);
|
||||||
|
|
||||||
if (!ctx->bit_depth) {
|
|
||||||
ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
|
|
||||||
ff_idctdsp_init(&ctx->idsp, ctx->avctx);
|
|
||||||
}
|
|
||||||
if (buf[0x21] == 0x58) { /* 10 bit */
|
if (buf[0x21] == 0x58) { /* 10 bit */
|
||||||
ctx->bit_depth = ctx->avctx->bits_per_raw_sample = 10;
|
ctx->bit_depth = ctx->avctx->bits_per_raw_sample = 10;
|
||||||
|
|
||||||
@ -157,17 +154,23 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
|
|||||||
} else {
|
} else {
|
||||||
ctx->decode_dct_block = dnxhd_decode_dct_block_10;
|
ctx->decode_dct_block = dnxhd_decode_dct_block_10;
|
||||||
ctx->pix_fmt = AV_PIX_FMT_YUV422P10;
|
ctx->pix_fmt = AV_PIX_FMT_YUV422P10;
|
||||||
|
ctx->is_444 = 0;
|
||||||
}
|
}
|
||||||
} else if (buf[0x21] == 0x38) { /* 8 bit */
|
} else if (buf[0x21] == 0x38) { /* 8 bit */
|
||||||
ctx->bit_depth = ctx->avctx->bits_per_raw_sample = 8;
|
ctx->bit_depth = ctx->avctx->bits_per_raw_sample = 8;
|
||||||
|
|
||||||
ctx->pix_fmt = AV_PIX_FMT_YUV422P;
|
ctx->pix_fmt = AV_PIX_FMT_YUV422P;
|
||||||
|
ctx->is_444 = 0;
|
||||||
ctx->decode_dct_block = dnxhd_decode_dct_block_8;
|
ctx->decode_dct_block = dnxhd_decode_dct_block_8;
|
||||||
} else {
|
} else {
|
||||||
av_log(ctx->avctx, AV_LOG_ERROR, "invalid bit depth value (%d).\n",
|
av_log(ctx->avctx, AV_LOG_ERROR, "invalid bit depth value (%d).\n",
|
||||||
buf[0x21]);
|
buf[0x21]);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
if (ctx->bit_depth != old_bit_depth) {
|
||||||
|
ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
|
||||||
|
ff_idctdsp_init(&ctx->idsp, ctx->avctx);
|
||||||
|
}
|
||||||
|
|
||||||
cid = AV_RB32(buf + 0x28);
|
cid = AV_RB32(buf + 0x28);
|
||||||
av_dlog(ctx->avctx, "compression id %d\n", cid);
|
av_dlog(ctx->avctx, "compression id %d\n", cid);
|
||||||
@ -373,7 +376,7 @@ static int dnxhd_decode_macroblock(DNXHDContext *ctx, AVFrame *frame,
|
|||||||
dest_u = frame->data[1] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444));
|
dest_u = frame->data[1] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444));
|
||||||
dest_v = frame->data[2] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444));
|
dest_v = frame->data[2] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444));
|
||||||
|
|
||||||
if (ctx->cur_field) {
|
if (frame->interlaced_frame && ctx->cur_field) {
|
||||||
dest_y += frame->linesize[0];
|
dest_y += frame->linesize[0];
|
||||||
dest_u += frame->linesize[1];
|
dest_u += frame->linesize[1];
|
||||||
dest_v += frame->linesize[2];
|
dest_v += frame->linesize[2];
|
||||||
|
@ -75,17 +75,20 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define write16(p, value) \
|
static av_always_inline void write16_internal(int big_endian, void *p, int value)
|
||||||
do { \
|
{
|
||||||
if (s->big_endian) AV_WB16(p, value); \
|
if (big_endian) AV_WB16(p, value);
|
||||||
else AV_WL16(p, value); \
|
else AV_WL16(p, value);
|
||||||
} while(0)
|
}
|
||||||
|
|
||||||
#define write32(p, value) \
|
static av_always_inline void write32_internal(int big_endian, void *p, int value)
|
||||||
do { \
|
{
|
||||||
if (s->big_endian) AV_WB32(p, value); \
|
if (big_endian) AV_WB32(p, value);
|
||||||
else AV_WL32(p, value); \
|
else AV_WL32(p, value);
|
||||||
} while(0)
|
}
|
||||||
|
|
||||||
|
#define write16(p, value) write16_internal(s->big_endian, p, value)
|
||||||
|
#define write32(p, value) write32_internal(s->big_endian, p, value)
|
||||||
|
|
||||||
static void encode_rgb48_10bit(AVCodecContext *avctx, const AVPicture *pic, uint8_t *dst)
|
static void encode_rgb48_10bit(AVCodecContext *avctx, const AVPicture *pic, uint8_t *dst)
|
||||||
{
|
{
|
||||||
|
@ -1197,8 +1197,12 @@ static int dvbsub_parse_region_segment(AVCodecContext *avctx,
|
|||||||
region->buf_size = region->width * region->height;
|
region->buf_size = region->width * region->height;
|
||||||
|
|
||||||
region->pbuf = av_malloc(region->buf_size);
|
region->pbuf = av_malloc(region->buf_size);
|
||||||
if (!region->pbuf)
|
if (!region->pbuf) {
|
||||||
|
region->buf_size =
|
||||||
|
region->width =
|
||||||
|
region->height = 0;
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
}
|
||||||
|
|
||||||
fill = 1;
|
fill = 1;
|
||||||
region->dirty = 0;
|
region->dirty = 0;
|
||||||
@ -1417,7 +1421,7 @@ static void save_display_set(DVBSubContext *ctx)
|
|||||||
|
|
||||||
pbuf = av_malloc(width * height * 4);
|
pbuf = av_malloc(width * height * 4);
|
||||||
if (!pbuf)
|
if (!pbuf)
|
||||||
return AVERROR(ENOMEM);
|
return;
|
||||||
|
|
||||||
for (display = ctx->display_list; display; display = display->next) {
|
for (display = ctx->display_list; display; display = display->next) {
|
||||||
region = get_region(ctx, display->region_id);
|
region = get_region(ctx, display->region_id);
|
||||||
@ -1499,10 +1503,10 @@ static int dvbsub_parse_display_definition_segment(AVCodecContext *avctx,
|
|||||||
avctx->height = display_def->height;
|
avctx->height = display_def->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (info_byte & 1<<3) { // display_window_flag
|
||||||
if (buf_size < 13)
|
if (buf_size < 13)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
if (info_byte & 1<<3) { // display_window_flag
|
|
||||||
display_def->x = bytestream_get_be16(&buf);
|
display_def->x = bytestream_get_be16(&buf);
|
||||||
display_def->width = bytestream_get_be16(&buf) - display_def->x + 1;
|
display_def->width = bytestream_get_be16(&buf) - display_def->x + 1;
|
||||||
display_def->y = bytestream_get_be16(&buf);
|
display_def->y = bytestream_get_be16(&buf);
|
||||||
|
@ -63,7 +63,7 @@ typedef enum {
|
|||||||
|
|
||||||
#define EAC3_SR_CODE_REDUCED 3
|
#define EAC3_SR_CODE_REDUCED 3
|
||||||
|
|
||||||
void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
|
static void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
|
||||||
{
|
{
|
||||||
int bin, bnd, ch, i;
|
int bin, bnd, ch, i;
|
||||||
uint8_t wrapflag[SPX_MAX_BANDS]={1,0,}, num_copy_sections, copy_sizes[SPX_MAX_BANDS];
|
uint8_t wrapflag[SPX_MAX_BANDS]={1,0,}, num_copy_sections, copy_sizes[SPX_MAX_BANDS];
|
||||||
@ -101,7 +101,7 @@ void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
|
|||||||
for (i = 0; i < num_copy_sections; i++) {
|
for (i = 0; i < num_copy_sections; i++) {
|
||||||
memcpy(&s->transform_coeffs[ch][bin],
|
memcpy(&s->transform_coeffs[ch][bin],
|
||||||
&s->transform_coeffs[ch][s->spx_dst_start_freq],
|
&s->transform_coeffs[ch][s->spx_dst_start_freq],
|
||||||
copy_sizes[i]*sizeof(float));
|
copy_sizes[i]*sizeof(INTFLOAT));
|
||||||
bin += copy_sizes[i];
|
bin += copy_sizes[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
|
|||||||
bin = s->spx_src_start_freq - 2;
|
bin = s->spx_src_start_freq - 2;
|
||||||
for (bnd = 0; bnd < s->num_spx_bands; bnd++) {
|
for (bnd = 0; bnd < s->num_spx_bands; bnd++) {
|
||||||
if (wrapflag[bnd]) {
|
if (wrapflag[bnd]) {
|
||||||
float *coeffs = &s->transform_coeffs[ch][bin];
|
INTFLOAT *coeffs = &s->transform_coeffs[ch][bin];
|
||||||
coeffs[0] *= atten_tab[0];
|
coeffs[0] *= atten_tab[0];
|
||||||
coeffs[1] *= atten_tab[1];
|
coeffs[1] *= atten_tab[1];
|
||||||
coeffs[2] *= atten_tab[2];
|
coeffs[2] *= atten_tab[2];
|
||||||
@ -142,6 +142,11 @@ void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
|
|||||||
for (bnd = 0; bnd < s->num_spx_bands; bnd++) {
|
for (bnd = 0; bnd < s->num_spx_bands; bnd++) {
|
||||||
float nscale = s->spx_noise_blend[ch][bnd] * rms_energy[bnd] * (1.0f / INT32_MIN);
|
float nscale = s->spx_noise_blend[ch][bnd] * rms_energy[bnd] * (1.0f / INT32_MIN);
|
||||||
float sscale = s->spx_signal_blend[ch][bnd];
|
float sscale = s->spx_signal_blend[ch][bnd];
|
||||||
|
#if USE_FIXED
|
||||||
|
// spx_noise_blend and spx_signal_blend are both FP.23
|
||||||
|
nscale *= 1.0 / (1<<23);
|
||||||
|
sscale *= 1.0 / (1<<23);
|
||||||
|
#endif
|
||||||
for (i = 0; i < s->spx_band_sizes[bnd]; i++) {
|
for (i = 0; i < s->spx_band_sizes[bnd]; i++) {
|
||||||
float noise = nscale * (int32_t)av_lfg_get(&s->dith_state);
|
float noise = nscale * (int32_t)av_lfg_get(&s->dith_state);
|
||||||
s->transform_coeffs[ch][bin] *= sscale;
|
s->transform_coeffs[ch][bin] *= sscale;
|
||||||
@ -195,7 +200,7 @@ static void idct6(int pre_mant[6])
|
|||||||
pre_mant[5] = even0 - odd0;
|
pre_mant[5] = even0 - odd0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch)
|
static void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch)
|
||||||
{
|
{
|
||||||
int bin, blk, gs;
|
int bin, blk, gs;
|
||||||
int end_bap, gaq_mode;
|
int end_bap, gaq_mode;
|
||||||
@ -288,7 +293,7 @@ void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ff_eac3_parse_header(AC3DecodeContext *s)
|
static int ff_eac3_parse_header(AC3DecodeContext *s)
|
||||||
{
|
{
|
||||||
int i, blk, ch;
|
int i, blk, ch;
|
||||||
int ac3_exponent_strategy, parse_aht_info, parse_spx_atten_data;
|
int ac3_exponent_strategy, parse_aht_info, parse_spx_atten_data;
|
||||||
|
@ -322,7 +322,7 @@ static uint16_t reverse_lut(const uint8_t *bitmap, uint16_t *lut)
|
|||||||
|
|
||||||
i = k - 1;
|
i = k - 1;
|
||||||
|
|
||||||
memset(lut + k * 2, 0, (USHORT_RANGE - k) * 2);
|
memset(lut + k, 0, (USHORT_RANGE - k) * 2);
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@ -1010,6 +1010,22 @@ static int decode_header(EXRContext *s)
|
|||||||
int current_channel_offset = 0;
|
int current_channel_offset = 0;
|
||||||
int magic_number, version, flags, i;
|
int magic_number, version, flags, i;
|
||||||
|
|
||||||
|
s->xmin = ~0;
|
||||||
|
s->xmax = ~0;
|
||||||
|
s->ymin = ~0;
|
||||||
|
s->ymax = ~0;
|
||||||
|
s->xdelta = ~0;
|
||||||
|
s->ydelta = ~0;
|
||||||
|
s->channel_offsets[0] = -1;
|
||||||
|
s->channel_offsets[1] = -1;
|
||||||
|
s->channel_offsets[2] = -1;
|
||||||
|
s->channel_offsets[3] = -1;
|
||||||
|
s->pixel_type = EXR_UNKNOWN;
|
||||||
|
s->compression = EXR_UNKN;
|
||||||
|
s->nb_channels = 0;
|
||||||
|
s->w = 0;
|
||||||
|
s->h = 0;
|
||||||
|
|
||||||
if (bytestream2_get_bytes_left(&s->gb) < 10) {
|
if (bytestream2_get_bytes_left(&s->gb) < 10) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "Header too short to parse.\n");
|
av_log(s->avctx, AV_LOG_ERROR, "Header too short to parse.\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
@ -1350,21 +1366,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
|||||||
float one_gamma = 1.0f / s->gamma;
|
float one_gamma = 1.0f / s->gamma;
|
||||||
|
|
||||||
s->avctx = avctx;
|
s->avctx = avctx;
|
||||||
s->xmin = ~0;
|
|
||||||
s->xmax = ~0;
|
|
||||||
s->ymin = ~0;
|
|
||||||
s->ymax = ~0;
|
|
||||||
s->xdelta = ~0;
|
|
||||||
s->ydelta = ~0;
|
|
||||||
s->channel_offsets[0] = -1;
|
|
||||||
s->channel_offsets[1] = -1;
|
|
||||||
s->channel_offsets[2] = -1;
|
|
||||||
s->channel_offsets[3] = -1;
|
|
||||||
s->pixel_type = EXR_UNKNOWN;
|
|
||||||
s->compression = EXR_UNKN;
|
|
||||||
s->nb_channels = 0;
|
|
||||||
s->w = 0;
|
|
||||||
s->h = 0;
|
|
||||||
|
|
||||||
if (one_gamma > 0.9999f && one_gamma < 1.0001f) {
|
if (one_gamma > 0.9999f && one_gamma < 1.0001f) {
|
||||||
for (i = 0; i < 65536; ++i)
|
for (i = 0; i < 65536; ++i)
|
||||||
|
@ -546,6 +546,12 @@ static int read_extra_header(FFV1Context *f)
|
|||||||
f->num_h_slices = 1 + get_symbol(c, state, 0);
|
f->num_h_slices = 1 + get_symbol(c, state, 0);
|
||||||
f->num_v_slices = 1 + get_symbol(c, state, 0);
|
f->num_v_slices = 1 + get_symbol(c, state, 0);
|
||||||
|
|
||||||
|
if (f->chroma_h_shift > 4U || f->chroma_v_shift > 4U) {
|
||||||
|
av_log(f->avctx, AV_LOG_ERROR, "chroma shift parameters %d %d are invalid\n",
|
||||||
|
f->chroma_h_shift, f->chroma_v_shift);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
if (f->num_h_slices > (unsigned)f->width || !f->num_h_slices ||
|
if (f->num_h_slices > (unsigned)f->width || !f->num_h_slices ||
|
||||||
f->num_v_slices > (unsigned)f->height || !f->num_v_slices
|
f->num_v_slices > (unsigned)f->height || !f->num_v_slices
|
||||||
) {
|
) {
|
||||||
@ -651,6 +657,12 @@ static int read_header(FFV1Context *f)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (chroma_h_shift > 4U || chroma_v_shift > 4U) {
|
||||||
|
av_log(f->avctx, AV_LOG_ERROR, "chroma shift parameters %d %d are invalid\n",
|
||||||
|
chroma_h_shift, chroma_v_shift);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
f->colorspace = colorspace;
|
f->colorspace = colorspace;
|
||||||
f->avctx->bits_per_raw_sample = bits_per_raw_sample;
|
f->avctx->bits_per_raw_sample = bits_per_raw_sample;
|
||||||
f->chroma_planes = chroma_planes;
|
f->chroma_planes = chroma_planes;
|
||||||
|
@ -663,7 +663,7 @@ static uint64_t calc_rice_params(RiceContext *rc, int pmin, int pmax,
|
|||||||
bits[pmin] = UINT32_MAX;
|
bits[pmin] = UINT32_MAX;
|
||||||
for (i = pmax; ; ) {
|
for (i = pmax; ; ) {
|
||||||
bits[i] = calc_optimal_rice_params(&tmp_rc, i, sums, n, pred_order);
|
bits[i] = calc_optimal_rice_params(&tmp_rc, i, sums, n, pred_order);
|
||||||
if (bits[i] < bits[opt_porder]) {
|
if (bits[i] < bits[opt_porder] || pmax == pmin) {
|
||||||
opt_porder = i;
|
opt_porder = i;
|
||||||
*rc = tmp_rc;
|
*rc = tmp_rc;
|
||||||
}
|
}
|
||||||
|
@ -337,8 +337,16 @@ static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit,
|
|||||||
|
|
||||||
if (i < limit - 1) {
|
if (i < limit - 1) {
|
||||||
if (k) {
|
if (k) {
|
||||||
|
if (k > MIN_CACHE_BITS - 1) {
|
||||||
|
buf = SHOW_UBITS(re, gb, 16) << (k-16);
|
||||||
|
LAST_SKIP_BITS(re, gb, 16);
|
||||||
|
UPDATE_CACHE(re, gb);
|
||||||
|
buf |= SHOW_UBITS(re, gb, k-16);
|
||||||
|
LAST_SKIP_BITS(re, gb, k-16);
|
||||||
|
} else {
|
||||||
buf = SHOW_UBITS(re, gb, k);
|
buf = SHOW_UBITS(re, gb, k);
|
||||||
LAST_SKIP_BITS(re, gb, k);
|
LAST_SKIP_BITS(re, gb, k);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
buf = 0;
|
buf = 0;
|
||||||
}
|
}
|
||||||
|
@ -1499,9 +1499,6 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
again:
|
again:
|
||||||
if ( (!(avctx->active_thread_type & FF_THREAD_FRAME) || nals_needed >= nal_index)
|
|
||||||
&& !h->current_slice)
|
|
||||||
h->au_pps_id = -1;
|
|
||||||
/* Ignore per frame NAL unit type during extradata
|
/* Ignore per frame NAL unit type during extradata
|
||||||
* parsing. Decoding slices is not possible in codec init
|
* parsing. Decoding slices is not possible in codec init
|
||||||
* with frame-mt */
|
* with frame-mt */
|
||||||
@ -1537,8 +1534,14 @@ again:
|
|||||||
ret = -1;
|
ret = -1;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if(!idr_cleared)
|
if(!idr_cleared) {
|
||||||
|
if (h->current_slice && (avctx->active_thread_type & FF_THREAD_SLICE)) {
|
||||||
|
av_log(h, AV_LOG_ERROR, "invalid mixed IDR / non IDR frames cannot be decoded in slice multithreading mode\n");
|
||||||
|
ret = AVERROR_INVALIDDATA;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
idr(h); // FIXME ensure we don't lose some frames if there is reordering
|
idr(h); // FIXME ensure we don't lose some frames if there is reordering
|
||||||
|
}
|
||||||
idr_cleared = 1;
|
idr_cleared = 1;
|
||||||
h->has_recovery_point = 1;
|
h->has_recovery_point = 1;
|
||||||
case NAL_SLICE:
|
case NAL_SLICE:
|
||||||
@ -1546,6 +1549,10 @@ again:
|
|||||||
hx->intra_gb_ptr =
|
hx->intra_gb_ptr =
|
||||||
hx->inter_gb_ptr = &hx->gb;
|
hx->inter_gb_ptr = &hx->gb;
|
||||||
|
|
||||||
|
if ( nals_needed >= nal_index
|
||||||
|
|| (!(avctx->active_thread_type & FF_THREAD_FRAME) && !context_count))
|
||||||
|
h->au_pps_id = -1;
|
||||||
|
|
||||||
if ((err = ff_h264_decode_slice_header(hx, h)))
|
if ((err = ff_h264_decode_slice_header(hx, h)))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1629,7 +1636,9 @@ again:
|
|||||||
break;
|
break;
|
||||||
case NAL_SPS:
|
case NAL_SPS:
|
||||||
init_get_bits(&h->gb, ptr, bit_length);
|
init_get_bits(&h->gb, ptr, bit_length);
|
||||||
if (ff_h264_decode_seq_parameter_set(h) < 0 && (h->is_avc ? nalsize : 1)) {
|
if (ff_h264_decode_seq_parameter_set(h, 0) >= 0)
|
||||||
|
break;
|
||||||
|
if (h->is_avc ? nalsize : 1) {
|
||||||
av_log(h->avctx, AV_LOG_DEBUG,
|
av_log(h->avctx, AV_LOG_DEBUG,
|
||||||
"SPS decoding failure, trying again with the complete NAL\n");
|
"SPS decoding failure, trying again with the complete NAL\n");
|
||||||
if (h->is_avc)
|
if (h->is_avc)
|
||||||
@ -1638,8 +1647,11 @@ again:
|
|||||||
break;
|
break;
|
||||||
init_get_bits(&h->gb, &buf[buf_index + 1 - consumed],
|
init_get_bits(&h->gb, &buf[buf_index + 1 - consumed],
|
||||||
8*(next_avc - buf_index + consumed - 1));
|
8*(next_avc - buf_index + consumed - 1));
|
||||||
ff_h264_decode_seq_parameter_set(h);
|
if (ff_h264_decode_seq_parameter_set(h, 0) >= 0)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
init_get_bits(&h->gb, ptr, bit_length);
|
||||||
|
ff_h264_decode_seq_parameter_set(h, 1);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case NAL_PPS:
|
case NAL_PPS:
|
||||||
@ -1672,8 +1684,14 @@ again:
|
|||||||
if (err < 0 || err == SLICE_SKIPED) {
|
if (err < 0 || err == SLICE_SKIPED) {
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
av_log(h->avctx, AV_LOG_ERROR, "decode_slice_header error\n");
|
av_log(h->avctx, AV_LOG_ERROR, "decode_slice_header error\n");
|
||||||
h->ref_count[0] = h->ref_count[1] = h->list_count = 0;
|
hx->ref_count[0] = hx->ref_count[1] = hx->list_count = 0;
|
||||||
} else if (err == SLICE_SINGLETHREAD) {
|
} else if (err == SLICE_SINGLETHREAD) {
|
||||||
|
if (context_count > 1) {
|
||||||
|
ret = ff_h264_execute_decode_slices(h, context_count - 1);
|
||||||
|
if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
|
||||||
|
goto end;
|
||||||
|
context_count = 0;
|
||||||
|
}
|
||||||
/* Slice could not be decoded in parallel mode, copy down
|
/* Slice could not be decoded in parallel mode, copy down
|
||||||
* NAL unit stuff to context 0 and restart. Note that
|
* NAL unit stuff to context 0 and restart. Note that
|
||||||
* rbsp_buffer is not transferred, but since we no longer
|
* rbsp_buffer is not transferred, but since we no longer
|
||||||
|
@ -536,6 +536,7 @@ typedef struct H264Context {
|
|||||||
int mb_x, mb_y;
|
int mb_x, mb_y;
|
||||||
int resync_mb_x;
|
int resync_mb_x;
|
||||||
int resync_mb_y;
|
int resync_mb_y;
|
||||||
|
int mb_index_end;
|
||||||
int mb_skip_run;
|
int mb_skip_run;
|
||||||
int mb_height, mb_width;
|
int mb_height, mb_width;
|
||||||
int mb_stride;
|
int mb_stride;
|
||||||
@ -776,7 +777,7 @@ int ff_h264_decode_sei(H264Context *h);
|
|||||||
/**
|
/**
|
||||||
* Decode SPS
|
* Decode SPS
|
||||||
*/
|
*/
|
||||||
int ff_h264_decode_seq_parameter_set(H264Context *h);
|
int ff_h264_decode_seq_parameter_set(H264Context *h, int ignore_truncation);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* compute profile from sps
|
* compute profile from sps
|
||||||
|
@ -280,7 +280,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
|
|||||||
init_get_bits(&h->gb, ptr, 8 * dst_length);
|
init_get_bits(&h->gb, ptr, 8 * dst_length);
|
||||||
switch (h->nal_unit_type) {
|
switch (h->nal_unit_type) {
|
||||||
case NAL_SPS:
|
case NAL_SPS:
|
||||||
ff_h264_decode_seq_parameter_set(h);
|
ff_h264_decode_seq_parameter_set(h, 0);
|
||||||
break;
|
break;
|
||||||
case NAL_PPS:
|
case NAL_PPS:
|
||||||
ff_h264_decode_picture_parameter_set(h, h->gb.size_in_bits);
|
ff_h264_decode_picture_parameter_set(h, h->gb.size_in_bits);
|
||||||
|
@ -241,12 +241,6 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_bits_left(&h->gb) < 0) {
|
|
||||||
av_log(h->avctx, AV_LOG_ERROR,
|
|
||||||
"Overread VUI by %d bits\n", -get_bits_left(&h->gb));
|
|
||||||
return AVERROR_INVALIDDATA;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,7 +297,7 @@ static void decode_scaling_matrices(H264Context *h, SPS *sps,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ff_h264_decode_seq_parameter_set(H264Context *h)
|
int ff_h264_decode_seq_parameter_set(H264Context *h, int ignore_truncation)
|
||||||
{
|
{
|
||||||
int profile_idc, level_idc, constraint_set_flags = 0;
|
int profile_idc, level_idc, constraint_set_flags = 0;
|
||||||
unsigned int sps_id;
|
unsigned int sps_id;
|
||||||
@ -523,6 +517,13 @@ int ff_h264_decode_seq_parameter_set(H264Context *h)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (get_bits_left(&h->gb) < 0) {
|
||||||
|
av_log(h->avctx, ignore_truncation ? AV_LOG_WARNING : AV_LOG_ERROR,
|
||||||
|
"Overread %s by %d bits\n", sps->vui_parameters_present_flag ? "VUI" : "SPS", -get_bits_left(&h->gb));
|
||||||
|
if (!ignore_truncation)
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
if (!sps->sar.den)
|
if (!sps->sar.den)
|
||||||
sps->sar.den = 1;
|
sps->sar.den = 1;
|
||||||
|
|
||||||
|
@ -705,7 +705,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count)
|
|||||||
*/
|
*/
|
||||||
if (h->short_ref_count && h->short_ref[0] == h->cur_pic_ptr) {
|
if (h->short_ref_count && h->short_ref[0] == h->cur_pic_ptr) {
|
||||||
/* Just mark the second field valid */
|
/* Just mark the second field valid */
|
||||||
h->cur_pic_ptr->reference = PICT_FRAME;
|
h->cur_pic_ptr->reference |= h->picture_structure;
|
||||||
} else if (h->cur_pic_ptr->long_ref) {
|
} else if (h->cur_pic_ptr->long_ref) {
|
||||||
av_log(h->avctx, AV_LOG_ERROR, "illegal short term reference "
|
av_log(h->avctx, AV_LOG_ERROR, "illegal short term reference "
|
||||||
"assignment for second field "
|
"assignment for second field "
|
||||||
|
@ -242,11 +242,11 @@ static int alloc_picture(H264Context *h, H264Picture *pic)
|
|||||||
av_pix_fmt_get_chroma_sub_sample(pic->f.format,
|
av_pix_fmt_get_chroma_sub_sample(pic->f.format,
|
||||||
&h_chroma_shift, &v_chroma_shift);
|
&h_chroma_shift, &v_chroma_shift);
|
||||||
|
|
||||||
for(i=0; i<FF_CEIL_RSHIFT(h->avctx->height, v_chroma_shift); i++) {
|
for(i=0; i<FF_CEIL_RSHIFT(pic->f.height, v_chroma_shift); i++) {
|
||||||
memset(pic->f.data[1] + pic->f.linesize[1]*i,
|
memset(pic->f.data[1] + pic->f.linesize[1]*i,
|
||||||
0x80, FF_CEIL_RSHIFT(h->avctx->width, h_chroma_shift));
|
0x80, FF_CEIL_RSHIFT(pic->f.width, h_chroma_shift));
|
||||||
memset(pic->f.data[2] + pic->f.linesize[2]*i,
|
memset(pic->f.data[2] + pic->f.linesize[2]*i,
|
||||||
0x80, FF_CEIL_RSHIFT(h->avctx->width, h_chroma_shift));
|
0x80, FF_CEIL_RSHIFT(pic->f.width, h_chroma_shift));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1289,6 +1289,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
|||||||
int field_pic_flag, bottom_field_flag;
|
int field_pic_flag, bottom_field_flag;
|
||||||
int first_slice = h == h0 && !h0->current_slice;
|
int first_slice = h == h0 && !h0->current_slice;
|
||||||
int frame_num, picture_structure, droppable;
|
int frame_num, picture_structure, droppable;
|
||||||
|
int mb_aff_frame, last_mb_aff_frame;
|
||||||
PPS *pps;
|
PPS *pps;
|
||||||
|
|
||||||
h->qpel_put = h->h264qpel.put_h264_qpel_pixels_tab;
|
h->qpel_put = h->h264qpel.put_h264_qpel_pixels_tab;
|
||||||
@ -1416,7 +1417,8 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
|||||||
|| h->mb_width != h->sps.mb_width
|
|| h->mb_width != h->sps.mb_width
|
||||||
|| h->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag)
|
|| h->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag)
|
||||||
));
|
));
|
||||||
if (non_j_pixfmt(h0->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h0, 0)))
|
if (h0->avctx->pix_fmt == AV_PIX_FMT_NONE
|
||||||
|
|| (non_j_pixfmt(h0->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h0, 0))))
|
||||||
must_reinit = 1;
|
must_reinit = 1;
|
||||||
|
|
||||||
if (first_slice && av_cmp_q(h->sps.sar, h->avctx->sample_aspect_ratio))
|
if (first_slice && av_cmp_q(h->sps.sar, h->avctx->sample_aspect_ratio))
|
||||||
@ -1452,6 +1454,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
|||||||
|
|
||||||
if (h->context_initialized &&
|
if (h->context_initialized &&
|
||||||
(must_reinit || needs_reinit)) {
|
(must_reinit || needs_reinit)) {
|
||||||
|
h->context_initialized = 0;
|
||||||
if (h != h0) {
|
if (h != h0) {
|
||||||
av_log(h->avctx, AV_LOG_ERROR,
|
av_log(h->avctx, AV_LOG_ERROR,
|
||||||
"changing width %d -> %d / height %d -> %d on "
|
"changing width %d -> %d / height %d -> %d on "
|
||||||
@ -1512,7 +1515,8 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
h->mb_mbaff = 0;
|
h->mb_mbaff = 0;
|
||||||
h->mb_aff_frame = 0;
|
mb_aff_frame = 0;
|
||||||
|
last_mb_aff_frame = h0->mb_aff_frame;
|
||||||
last_pic_structure = h0->picture_structure;
|
last_pic_structure = h0->picture_structure;
|
||||||
last_pic_droppable = h0->droppable;
|
last_pic_droppable = h0->droppable;
|
||||||
droppable = h->nal_ref_idc == 0;
|
droppable = h->nal_ref_idc == 0;
|
||||||
@ -1530,12 +1534,13 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
|||||||
picture_structure = PICT_TOP_FIELD + bottom_field_flag;
|
picture_structure = PICT_TOP_FIELD + bottom_field_flag;
|
||||||
} else {
|
} else {
|
||||||
picture_structure = PICT_FRAME;
|
picture_structure = PICT_FRAME;
|
||||||
h->mb_aff_frame = h->sps.mb_aff;
|
mb_aff_frame = h->sps.mb_aff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (h0->current_slice) {
|
if (h0->current_slice) {
|
||||||
if (last_pic_structure != picture_structure ||
|
if (last_pic_structure != picture_structure ||
|
||||||
last_pic_droppable != droppable) {
|
last_pic_droppable != droppable ||
|
||||||
|
last_mb_aff_frame != mb_aff_frame) {
|
||||||
av_log(h->avctx, AV_LOG_ERROR,
|
av_log(h->avctx, AV_LOG_ERROR,
|
||||||
"Changing field mode (%d -> %d) between slices is not allowed\n",
|
"Changing field mode (%d -> %d) between slices is not allowed\n",
|
||||||
last_pic_structure, h->picture_structure);
|
last_pic_structure, h->picture_structure);
|
||||||
@ -1551,6 +1556,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
|||||||
h->picture_structure = picture_structure;
|
h->picture_structure = picture_structure;
|
||||||
h->droppable = droppable;
|
h->droppable = droppable;
|
||||||
h->frame_num = frame_num;
|
h->frame_num = frame_num;
|
||||||
|
h->mb_aff_frame = mb_aff_frame;
|
||||||
h->mb_field_decoding_flag = picture_structure != PICT_FRAME;
|
h->mb_field_decoding_flag = picture_structure != PICT_FRAME;
|
||||||
|
|
||||||
if (h0->current_slice == 0) {
|
if (h0->current_slice == 0) {
|
||||||
@ -1663,14 +1669,17 @@ int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
|
|||||||
* vectors. Given we are concealing a lost frame, this probably
|
* vectors. Given we are concealing a lost frame, this probably
|
||||||
* is not noticeable by comparison, but it should be fixed. */
|
* is not noticeable by comparison, but it should be fixed. */
|
||||||
if (h->short_ref_count) {
|
if (h->short_ref_count) {
|
||||||
if (prev) {
|
if (prev &&
|
||||||
|
h->short_ref[0]->f.width == prev->f.width &&
|
||||||
|
h->short_ref[0]->f.height == prev->f.height &&
|
||||||
|
h->short_ref[0]->f.format == prev->f.format) {
|
||||||
av_image_copy(h->short_ref[0]->f.data,
|
av_image_copy(h->short_ref[0]->f.data,
|
||||||
h->short_ref[0]->f.linesize,
|
h->short_ref[0]->f.linesize,
|
||||||
(const uint8_t **)prev->f.data,
|
(const uint8_t **)prev->f.data,
|
||||||
prev->f.linesize,
|
prev->f.linesize,
|
||||||
h->avctx->pix_fmt,
|
prev->f.format,
|
||||||
h->mb_width * 16,
|
prev->f.width,
|
||||||
h->mb_height * 16);
|
prev->f.height);
|
||||||
h->short_ref[0]->poc = prev->poc + 2;
|
h->short_ref[0]->poc = prev->poc + 2;
|
||||||
}
|
}
|
||||||
h->short_ref[0]->frame_num = h->prev_frame_num;
|
h->short_ref[0]->frame_num = h->prev_frame_num;
|
||||||
@ -2424,8 +2433,17 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg)
|
|||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
// START_TIMER
|
// START_TIMER
|
||||||
int ret = ff_h264_decode_mb_cabac(h);
|
int ret, eos;
|
||||||
int eos;
|
|
||||||
|
if (h->mb_x + h->mb_y * h->mb_width >= h->mb_index_end) {
|
||||||
|
av_log(h->avctx, AV_LOG_ERROR, "Slice overlaps next at %d\n",
|
||||||
|
h->mb_index_end);
|
||||||
|
er_add_slice(h, h->resync_mb_x, h->resync_mb_y, h->mb_x,
|
||||||
|
h->mb_y, ER_MB_ERROR);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ff_h264_decode_mb_cabac(h);
|
||||||
// STOP_TIMER("decode_mb_cabac")
|
// STOP_TIMER("decode_mb_cabac")
|
||||||
|
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
@ -2487,7 +2505,17 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int ret = ff_h264_decode_mb_cavlc(h);
|
int ret;
|
||||||
|
|
||||||
|
if (h->mb_x + h->mb_y * h->mb_width >= h->mb_index_end) {
|
||||||
|
av_log(h->avctx, AV_LOG_ERROR, "Slice overlaps next at %d\n",
|
||||||
|
h->mb_index_end);
|
||||||
|
er_add_slice(h, h->resync_mb_x, h->resync_mb_y, h->mb_x,
|
||||||
|
h->mb_y, ER_MB_ERROR);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ff_h264_decode_mb_cavlc(h);
|
||||||
|
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
ff_h264_hl_decode_mb(h);
|
ff_h264_hl_decode_mb(h);
|
||||||
@ -2575,19 +2603,33 @@ int ff_h264_execute_decode_slices(H264Context *h, unsigned context_count)
|
|||||||
|
|
||||||
av_assert0(h->mb_y < h->mb_height);
|
av_assert0(h->mb_y < h->mb_height);
|
||||||
|
|
||||||
|
h->mb_index_end = INT_MAX;
|
||||||
|
|
||||||
if (h->avctx->hwaccel ||
|
if (h->avctx->hwaccel ||
|
||||||
h->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
|
h->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
|
||||||
return 0;
|
return 0;
|
||||||
if (context_count == 1) {
|
if (context_count == 1) {
|
||||||
return decode_slice(avctx, &h);
|
return decode_slice(avctx, &h);
|
||||||
} else {
|
} else {
|
||||||
|
int j, mb_index;
|
||||||
av_assert0(context_count > 0);
|
av_assert0(context_count > 0);
|
||||||
for (i = 1; i < context_count; i++) {
|
for (i = 0; i < context_count; i++) {
|
||||||
|
int mb_index_end = h->mb_width * h->mb_height;
|
||||||
hx = h->thread_context[i];
|
hx = h->thread_context[i];
|
||||||
if (CONFIG_ERROR_RESILIENCE) {
|
mb_index = hx->resync_mb_x + hx->resync_mb_y * h->mb_width;
|
||||||
|
if (CONFIG_ERROR_RESILIENCE && i) {
|
||||||
hx->er.error_count = 0;
|
hx->er.error_count = 0;
|
||||||
}
|
}
|
||||||
hx->x264_build = h->x264_build;
|
hx->x264_build = h->x264_build;
|
||||||
|
for (j = 0; j < context_count; j++) {
|
||||||
|
H264Context *sl2 = h->thread_context[j];
|
||||||
|
int mb_index2 = sl2->resync_mb_x + sl2->resync_mb_y * h->mb_width;
|
||||||
|
|
||||||
|
if (i==j || mb_index > mb_index2)
|
||||||
|
continue;
|
||||||
|
mb_index_end = FFMIN(mb_index_end, mb_index2);
|
||||||
|
}
|
||||||
|
hx->mb_index_end = mb_index_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
avctx->execute(avctx, decode_slice, h->thread_context,
|
avctx->execute(avctx, decode_slice, h->thread_context,
|
||||||
|
@ -440,7 +440,7 @@ static int hls_slice_header(HEVCContext *s)
|
|||||||
|
|
||||||
slice_address_length = av_ceil_log2(s->sps->ctb_width *
|
slice_address_length = av_ceil_log2(s->sps->ctb_width *
|
||||||
s->sps->ctb_height);
|
s->sps->ctb_height);
|
||||||
sh->slice_segment_addr = get_bits(gb, slice_address_length);
|
sh->slice_segment_addr = slice_address_length ? get_bits(gb, slice_address_length) : 0;
|
||||||
if (sh->slice_segment_addr >= s->sps->ctb_width * s->sps->ctb_height) {
|
if (sh->slice_segment_addr >= s->sps->ctb_width * s->sps->ctb_height) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR,
|
av_log(s->avctx, AV_LOG_ERROR,
|
||||||
"Invalid slice segment address: %u.\n",
|
"Invalid slice segment address: %u.\n",
|
||||||
@ -694,11 +694,25 @@ static int hls_slice_header(HEVCContext *s)
|
|||||||
|
|
||||||
sh->num_entry_point_offsets = 0;
|
sh->num_entry_point_offsets = 0;
|
||||||
if (s->pps->tiles_enabled_flag || s->pps->entropy_coding_sync_enabled_flag) {
|
if (s->pps->tiles_enabled_flag || s->pps->entropy_coding_sync_enabled_flag) {
|
||||||
sh->num_entry_point_offsets = get_ue_golomb_long(gb);
|
unsigned num_entry_point_offsets = get_ue_golomb_long(gb);
|
||||||
|
// It would be possible to bound this tighter but this here is simpler
|
||||||
|
if (num_entry_point_offsets > get_bits_left(gb)) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "num_entry_point_offsets %d is invalid\n", num_entry_point_offsets);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
|
sh->num_entry_point_offsets = num_entry_point_offsets;
|
||||||
if (sh->num_entry_point_offsets > 0) {
|
if (sh->num_entry_point_offsets > 0) {
|
||||||
int offset_len = get_ue_golomb_long(gb) + 1;
|
int offset_len = get_ue_golomb_long(gb) + 1;
|
||||||
int segments = offset_len >> 4;
|
int segments = offset_len >> 4;
|
||||||
int rest = (offset_len & 15);
|
int rest = (offset_len & 15);
|
||||||
|
|
||||||
|
if (offset_len < 1 || offset_len > 32) {
|
||||||
|
sh->num_entry_point_offsets = 0;
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "offset_len %d is invalid\n", offset_len);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
av_freep(&sh->entry_point_offset);
|
av_freep(&sh->entry_point_offset);
|
||||||
av_freep(&sh->offset);
|
av_freep(&sh->offset);
|
||||||
av_freep(&sh->size);
|
av_freep(&sh->size);
|
||||||
@ -2600,6 +2614,7 @@ static int hevc_frame_start(HEVCContext *s)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
if (!s->avctx->hwaccel)
|
||||||
ff_thread_finish_setup(s->avctx);
|
ff_thread_finish_setup(s->avctx);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -2982,7 +2997,6 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
|
|||||||
|
|
||||||
/* parse the NAL units */
|
/* parse the NAL units */
|
||||||
for (i = 0; i < s->nb_nals; i++) {
|
for (i = 0; i < s->nb_nals; i++) {
|
||||||
int ret;
|
|
||||||
s->skipped_bytes = s->skipped_bytes_nal[i];
|
s->skipped_bytes = s->skipped_bytes_nal[i];
|
||||||
s->skipped_bytes_pos = s->skipped_bytes_pos_nal[i];
|
s->skipped_bytes_pos = s->skipped_bytes_pos_nal[i];
|
||||||
|
|
||||||
|
@ -298,10 +298,10 @@ typedef struct RefPicListTab {
|
|||||||
} RefPicListTab;
|
} RefPicListTab;
|
||||||
|
|
||||||
typedef struct HEVCWindow {
|
typedef struct HEVCWindow {
|
||||||
int left_offset;
|
unsigned int left_offset;
|
||||||
int right_offset;
|
unsigned int right_offset;
|
||||||
int top_offset;
|
unsigned int top_offset;
|
||||||
int bottom_offset;
|
unsigned int bottom_offset;
|
||||||
} HEVCWindow;
|
} HEVCWindow;
|
||||||
|
|
||||||
typedef struct VUI {
|
typedef struct VUI {
|
||||||
|
@ -200,7 +200,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx
|
|||||||
|
|
||||||
slice_address_length = av_ceil_log2_c(h->sps->ctb_width *
|
slice_address_length = av_ceil_log2_c(h->sps->ctb_width *
|
||||||
h->sps->ctb_height);
|
h->sps->ctb_height);
|
||||||
sh->slice_segment_addr = get_bits(gb, slice_address_length);
|
sh->slice_segment_addr = slice_address_length ? get_bits(gb, slice_address_length) : 0;
|
||||||
if (sh->slice_segment_addr >= h->sps->ctb_width * h->sps->ctb_height) {
|
if (sh->slice_segment_addr >= h->sps->ctb_width * h->sps->ctb_height) {
|
||||||
av_log(h->avctx, AV_LOG_ERROR, "Invalid slice segment address: %u.\n",
|
av_log(h->avctx, AV_LOG_ERROR, "Invalid slice segment address: %u.\n",
|
||||||
sh->slice_segment_addr);
|
sh->slice_segment_addr);
|
||||||
|
@ -424,7 +424,8 @@ int ff_hevc_decode_nal_vps(HEVCContext *s)
|
|||||||
|
|
||||||
vps->vps_max_layer_id = get_bits(gb, 6);
|
vps->vps_max_layer_id = get_bits(gb, 6);
|
||||||
vps->vps_num_layer_sets = get_ue_golomb_long(gb) + 1;
|
vps->vps_num_layer_sets = get_ue_golomb_long(gb) + 1;
|
||||||
if ((vps->vps_num_layer_sets - 1LL) * (vps->vps_max_layer_id + 1LL) > get_bits_left(gb)) {
|
if (vps->vps_num_layer_sets < 1 || vps->vps_num_layer_sets > 1024 ||
|
||||||
|
(vps->vps_num_layer_sets - 1LL) * (vps->vps_max_layer_id + 1LL) > get_bits_left(gb)) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "too many layer_id_included_flags\n");
|
av_log(s->avctx, AV_LOG_ERROR, "too many layer_id_included_flags\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@ -441,6 +442,11 @@ int ff_hevc_decode_nal_vps(HEVCContext *s)
|
|||||||
if (vps->vps_poc_proportional_to_timing_flag)
|
if (vps->vps_poc_proportional_to_timing_flag)
|
||||||
vps->vps_num_ticks_poc_diff_one = get_ue_golomb_long(gb) + 1;
|
vps->vps_num_ticks_poc_diff_one = get_ue_golomb_long(gb) + 1;
|
||||||
vps->vps_num_hrd_parameters = get_ue_golomb_long(gb);
|
vps->vps_num_hrd_parameters = get_ue_golomb_long(gb);
|
||||||
|
if (vps->vps_num_hrd_parameters > (unsigned)vps->vps_num_layer_sets) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR,
|
||||||
|
"vps_num_hrd_parameters %d is invalid\n", vps->vps_num_hrd_parameters);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
for (i = 0; i < vps->vps_num_hrd_parameters; i++) {
|
for (i = 0; i < vps->vps_num_hrd_parameters; i++) {
|
||||||
int common_inf_present = 1;
|
int common_inf_present = 1;
|
||||||
|
|
||||||
@ -455,6 +461,7 @@ int ff_hevc_decode_nal_vps(HEVCContext *s)
|
|||||||
if (get_bits_left(gb) < 0) {
|
if (get_bits_left(gb) < 0) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR,
|
av_log(s->avctx, AV_LOG_ERROR,
|
||||||
"Overread VPS by %d bits\n", -get_bits_left(gb));
|
"Overread VPS by %d bits\n", -get_bits_left(gb));
|
||||||
|
if (s->vps_list[vps_id])
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1039,7 +1046,8 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
|
|||||||
(sps->output_window.left_offset + sps->output_window.right_offset);
|
(sps->output_window.left_offset + sps->output_window.right_offset);
|
||||||
sps->output_height = sps->height -
|
sps->output_height = sps->height -
|
||||||
(sps->output_window.top_offset + sps->output_window.bottom_offset);
|
(sps->output_window.top_offset + sps->output_window.bottom_offset);
|
||||||
if (sps->output_width <= 0 || sps->output_height <= 0) {
|
if (sps->width <= sps->output_window.left_offset + (int64_t)sps->output_window.right_offset ||
|
||||||
|
sps->height <= sps->output_window.top_offset + (int64_t)sps->output_window.bottom_offset) {
|
||||||
av_log(s->avctx, AV_LOG_WARNING, "Invalid visible frame dimensions: %dx%d.\n",
|
av_log(s->avctx, AV_LOG_WARNING, "Invalid visible frame dimensions: %dx%d.\n",
|
||||||
sps->output_width, sps->output_height);
|
sps->output_width, sps->output_height);
|
||||||
if (s->avctx->err_recognition & AV_EF_EXPLODE) {
|
if (s->avctx->err_recognition & AV_EF_EXPLODE) {
|
||||||
@ -1315,14 +1323,14 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
|
|||||||
if (pps->tiles_enabled_flag) {
|
if (pps->tiles_enabled_flag) {
|
||||||
pps->num_tile_columns = get_ue_golomb_long(gb) + 1;
|
pps->num_tile_columns = get_ue_golomb_long(gb) + 1;
|
||||||
pps->num_tile_rows = get_ue_golomb_long(gb) + 1;
|
pps->num_tile_rows = get_ue_golomb_long(gb) + 1;
|
||||||
if (pps->num_tile_columns == 0 ||
|
if (pps->num_tile_columns <= 0 ||
|
||||||
pps->num_tile_columns >= sps->width) {
|
pps->num_tile_columns >= sps->width) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "num_tile_columns_minus1 out of range: %d\n",
|
av_log(s->avctx, AV_LOG_ERROR, "num_tile_columns_minus1 out of range: %d\n",
|
||||||
pps->num_tile_columns - 1);
|
pps->num_tile_columns - 1);
|
||||||
ret = AVERROR_INVALIDDATA;
|
ret = AVERROR_INVALIDDATA;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (pps->num_tile_rows == 0 ||
|
if (pps->num_tile_rows <= 0 ||
|
||||||
pps->num_tile_rows >= sps->height) {
|
pps->num_tile_rows >= sps->height) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "num_tile_rows_minus1 out of range: %d\n",
|
av_log(s->avctx, AV_LOG_ERROR, "num_tile_rows_minus1 out of range: %d\n",
|
||||||
pps->num_tile_rows - 1);
|
pps->num_tile_rows - 1);
|
||||||
|
@ -126,6 +126,11 @@ static int active_parameter_sets(HEVCContext *s)
|
|||||||
get_bits(gb, 1); // num_sps_ids_minus1
|
get_bits(gb, 1); // num_sps_ids_minus1
|
||||||
num_sps_ids_minus1 = get_ue_golomb_long(gb); // num_sps_ids_minus1
|
num_sps_ids_minus1 = get_ue_golomb_long(gb); // num_sps_ids_minus1
|
||||||
|
|
||||||
|
if (num_sps_ids_minus1 < 0 || num_sps_ids_minus1 > 15) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "num_sps_ids_minus1 %d invalid\n", num_sps_ids_minus1);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
active_seq_parameter_set_id = get_ue_golomb_long(gb);
|
active_seq_parameter_set_id = get_ue_golomb_long(gb);
|
||||||
if (active_seq_parameter_set_id >= MAX_SPS_COUNT) {
|
if (active_seq_parameter_set_id >= MAX_SPS_COUNT) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "active_parameter_set_id %d invalid\n", active_seq_parameter_set_id);
|
av_log(s->avctx, AV_LOG_ERROR, "active_parameter_set_id %d invalid\n", active_seq_parameter_set_id);
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "huffyuv.h"
|
#include "huffyuv.h"
|
||||||
#include "huffyuvdsp.h"
|
#include "huffyuvdsp.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
#include "libavutil/imgutils.h"
|
||||||
#include "libavutil/pixdesc.h"
|
#include "libavutil/pixdesc.h"
|
||||||
|
|
||||||
#define classic_shift_luma_table_size 42
|
#define classic_shift_luma_table_size 42
|
||||||
@ -291,6 +292,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
|||||||
HYuvContext *s = avctx->priv_data;
|
HYuvContext *s = avctx->priv_data;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ff_huffyuvdsp_init(&s->hdsp);
|
ff_huffyuvdsp_init(&s->hdsp);
|
||||||
memset(s->vlc, 0, 4 * sizeof(VLC));
|
memset(s->vlc, 0, 4 * sizeof(VLC));
|
||||||
|
|
||||||
|
@ -426,7 +426,7 @@ static void imc_decode_level_coefficients_raw(IMCContext *q, int *levlCoeffBuf,
|
|||||||
|
|
||||||
pos = q->coef0_pos;
|
pos = q->coef0_pos;
|
||||||
flcoeffs1[pos] = 20000.0 / pow (2, levlCoeffBuf[0] * 0.18945); // 0.18945 = log2(10) * 0.05703125
|
flcoeffs1[pos] = 20000.0 / pow (2, levlCoeffBuf[0] * 0.18945); // 0.18945 = log2(10) * 0.05703125
|
||||||
flcoeffs2[pos] = log2f(flcoeffs1[0]);
|
flcoeffs2[pos] = log2f(flcoeffs1[pos]);
|
||||||
tmp = flcoeffs1[pos];
|
tmp = flcoeffs1[pos];
|
||||||
tmp2 = flcoeffs2[pos];
|
tmp2 = flcoeffs2[pos];
|
||||||
|
|
||||||
|
@ -1148,11 +1148,16 @@ static inline void mct_decode(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)
|
|||||||
int i, csize = 1;
|
int i, csize = 1;
|
||||||
void *src[3];
|
void *src[3];
|
||||||
|
|
||||||
for (i = 1; i < 3; i++)
|
for (i = 1; i < 3; i++) {
|
||||||
if (tile->codsty[0].transform != tile->codsty[i].transform) {
|
if (tile->codsty[0].transform != tile->codsty[i].transform) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "Transforms mismatch, MCT not supported\n");
|
av_log(s->avctx, AV_LOG_ERROR, "Transforms mismatch, MCT not supported\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (memcmp(tile->comp[0].coord, tile->comp[i].coord, sizeof(tile->comp[0].coord))) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "Coords mismatch, MCT not supported\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
if (tile->codsty[0].transform == FF_DWT97)
|
if (tile->codsty[0].transform == FF_DWT97)
|
||||||
@ -1559,7 +1564,7 @@ static int jp2_find_codestream(Jpeg2000DecoderContext *s)
|
|||||||
int cn = bytestream2_get_be16(&s->g);
|
int cn = bytestream2_get_be16(&s->g);
|
||||||
int av_unused typ = bytestream2_get_be16(&s->g);
|
int av_unused typ = bytestream2_get_be16(&s->g);
|
||||||
int asoc = bytestream2_get_be16(&s->g);
|
int asoc = bytestream2_get_be16(&s->g);
|
||||||
if (cn < 4 || asoc < 4)
|
if (cn < 4 && asoc < 4)
|
||||||
s->cdef[cn] = asoc;
|
s->cdef[cn] = asoc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -358,6 +358,15 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < image->numcomps; i++) {
|
||||||
|
if (!image->comps[i].data) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
|
"Image component %d contains no data.\n", i);
|
||||||
|
ret = AVERROR_INVALIDDATA;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
desc = av_pix_fmt_desc_get(avctx->pix_fmt);
|
desc = av_pix_fmt_desc_get(avctx->pix_fmt);
|
||||||
pixel_size = desc->comp[0].step_minus1 + 1;
|
pixel_size = desc->comp[0].step_minus1 + 1;
|
||||||
ispacked = libopenjpeg_ispacked(avctx->pix_fmt);
|
ispacked = libopenjpeg_ispacked(avctx->pix_fmt);
|
||||||
|
@ -200,6 +200,9 @@ static opj_image_t *mj2_create_image(AVCodecContext *avctx, opj_cparameters_t *p
|
|||||||
|
|
||||||
img = opj_image_create(numcomps, cmptparm, color_space);
|
img = opj_image_create(numcomps, cmptparm, color_space);
|
||||||
|
|
||||||
|
if (!img)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
// x0, y0 is the top left corner of the image
|
// x0, y0 is the top left corner of the image
|
||||||
// x1, y1 is the width, height of the reference grid
|
// x1, y1 is the width, height of the reference grid
|
||||||
img->x0 = 0;
|
img->x0 = 0;
|
||||||
|
@ -111,6 +111,8 @@ static int get_stats(AVCodecContext *avctx, int eos)
|
|||||||
// libtheora generates a summary header at the end
|
// libtheora generates a summary header at the end
|
||||||
memcpy(h->stats, buf, bytes);
|
memcpy(h->stats, buf, bytes);
|
||||||
avctx->stats_out = av_malloc(b64_size);
|
avctx->stats_out = av_malloc(b64_size);
|
||||||
|
if (!avctx->stats_out)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
av_base64_encode(avctx->stats_out, b64_size, h->stats, h->stats_offset);
|
av_base64_encode(avctx->stats_out, b64_size, h->stats, h->stats_offset);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -441,9 +441,10 @@ static av_cold int vpx_init(AVCodecContext *avctx,
|
|||||||
codecctl_int(avctx, VP8E_SET_ARNR_STRENGTH, ctx->arnr_strength);
|
codecctl_int(avctx, VP8E_SET_ARNR_STRENGTH, ctx->arnr_strength);
|
||||||
if (ctx->arnr_type >= 0)
|
if (ctx->arnr_type >= 0)
|
||||||
codecctl_int(avctx, VP8E_SET_ARNR_TYPE, ctx->arnr_type);
|
codecctl_int(avctx, VP8E_SET_ARNR_TYPE, ctx->arnr_type);
|
||||||
|
if (avctx->codec_id == AV_CODEC_ID_VP8) {
|
||||||
codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY, avctx->noise_reduction);
|
codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY, avctx->noise_reduction);
|
||||||
if (avctx->codec_id == AV_CODEC_ID_VP8)
|
|
||||||
codecctl_int(avctx, VP8E_SET_TOKEN_PARTITIONS, av_log2(avctx->slices));
|
codecctl_int(avctx, VP8E_SET_TOKEN_PARTITIONS, av_log2(avctx->slices));
|
||||||
|
}
|
||||||
#if FF_API_MPV_OPT
|
#if FF_API_MPV_OPT
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
if (avctx->mb_threshold) {
|
if (avctx->mb_threshold) {
|
||||||
|
@ -182,7 +182,7 @@ int ff_mjpeg_decode_dqt(MJpegDecodeContext *s)
|
|||||||
s->quant_matrixes[index][s->scantable.permutated[8]]) >> 1;
|
s->quant_matrixes[index][s->scantable.permutated[8]]) >> 1;
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "qscale[%d]: %d\n",
|
av_log(s->avctx, AV_LOG_DEBUG, "qscale[%d]: %d\n",
|
||||||
index, s->qscale[index]);
|
index, s->qscale[index]);
|
||||||
len -= 65;
|
len -= 1 + 64 * (1+pr);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -337,20 +337,30 @@ void ff_mjpeg_escape_FF(PutBitContext *pb, int start)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_mjpeg_encode_stuffing(MpegEncContext *s)
|
int ff_mjpeg_encode_stuffing(MpegEncContext *s)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
PutBitContext *pbc = &s->pb;
|
PutBitContext *pbc = &s->pb;
|
||||||
int mb_y = s->mb_y - !s->mb_x;
|
int mb_y = s->mb_y - !s->mb_x;
|
||||||
|
|
||||||
|
int ret = ff_mpv_reallocate_putbitbuffer(s, put_bits_count(&s->pb) / 8 + 100,
|
||||||
|
put_bits_count(&s->pb) / 4 + 1000);
|
||||||
|
if (ret < 0) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "Buffer reallocation failed\n");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
ff_mjpeg_escape_FF(pbc, s->esc_pos);
|
ff_mjpeg_escape_FF(pbc, s->esc_pos);
|
||||||
|
|
||||||
if((s->avctx->active_thread_type & FF_THREAD_SLICE) && mb_y < s->mb_height)
|
if((s->avctx->active_thread_type & FF_THREAD_SLICE) && mb_y < s->mb_height)
|
||||||
put_marker(pbc, RST0 + (mb_y&7));
|
put_marker(pbc, RST0 + (mb_y&7));
|
||||||
s->esc_pos = put_bits_count(pbc) >> 3;
|
s->esc_pos = put_bits_count(pbc) >> 3;
|
||||||
|
fail:
|
||||||
|
|
||||||
for(i=0; i<3; i++)
|
for(i=0; i<3; i++)
|
||||||
s->last_dc[i] = 128 << s->intra_dc_precision;
|
s->last_dc[i] = 128 << s->intra_dc_precision;
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_mjpeg_encode_picture_trailer(PutBitContext *pb, int header_bits)
|
void ff_mjpeg_encode_picture_trailer(PutBitContext *pb, int header_bits)
|
||||||
|
@ -34,7 +34,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
|
|||||||
uint16_t chroma_intra_matrix[64]);
|
uint16_t chroma_intra_matrix[64]);
|
||||||
void ff_mjpeg_encode_picture_trailer(PutBitContext *pb, int header_bits);
|
void ff_mjpeg_encode_picture_trailer(PutBitContext *pb, int header_bits);
|
||||||
void ff_mjpeg_escape_FF(PutBitContext *pb, int start);
|
void ff_mjpeg_escape_FF(PutBitContext *pb, int start);
|
||||||
void ff_mjpeg_encode_stuffing(MpegEncContext *s);
|
int ff_mjpeg_encode_stuffing(MpegEncContext *s);
|
||||||
void ff_mjpeg_init_hvsample(AVCodecContext *avctx, int hsample[3], int vsample[3]);
|
void ff_mjpeg_init_hvsample(AVCodecContext *avctx, int hsample[3], int vsample[3]);
|
||||||
|
|
||||||
void ff_mjpeg_encode_dc(PutBitContext *pb, int val,
|
void ff_mjpeg_encode_dc(PutBitContext *pb, int val,
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#include "libavutil/attributes.h"
|
#include "libavutil/attributes.h"
|
||||||
|
#include "libavutil/imgutils.h"
|
||||||
#include "libavutil/internal.h"
|
#include "libavutil/internal.h"
|
||||||
#include "libavutil/stereo3d.h"
|
#include "libavutil/stereo3d.h"
|
||||||
|
|
||||||
@ -1315,7 +1316,13 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
|
|||||||
}
|
}
|
||||||
} // MPEG-2
|
} // MPEG-2
|
||||||
|
|
||||||
ff_set_sar(s->avctx, s->avctx->sample_aspect_ratio);
|
if (av_image_check_sar(s->width, s->height,
|
||||||
|
avctx->sample_aspect_ratio) < 0) {
|
||||||
|
av_log(avctx, AV_LOG_WARNING, "ignoring invalid SAR: %u/%u\n",
|
||||||
|
avctx->sample_aspect_ratio.num,
|
||||||
|
avctx->sample_aspect_ratio.den);
|
||||||
|
avctx->sample_aspect_ratio = (AVRational){ 0, 1 };
|
||||||
|
}
|
||||||
|
|
||||||
if ((s1->mpeg_enc_ctx_allocated == 0) ||
|
if ((s1->mpeg_enc_ctx_allocated == 0) ||
|
||||||
avctx->coded_width != s->width ||
|
avctx->coded_width != s->width ||
|
||||||
|
@ -102,7 +102,7 @@ enum AudioObjectType {
|
|||||||
AOT_USAC, ///< N Unified Speech and Audio Coding
|
AOT_USAC, ///< N Unified Speech and Audio Coding
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_PCE_SIZE 304 ///<Maximum size of a PCE including the 3-bit ID_PCE
|
#define MAX_PCE_SIZE 320 ///<Maximum size of a PCE including the 3-bit ID_PCE
|
||||||
///<marker and the comment
|
///<marker and the comment
|
||||||
|
|
||||||
int avpriv_copy_pce_data(PutBitContext *pb, GetBitContext *gb);
|
int avpriv_copy_pce_data(PutBitContext *pb, GetBitContext *gb);
|
||||||
|
@ -189,14 +189,14 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
|||||||
int x = 0, y = 0;
|
int x = 0, y = 0;
|
||||||
|
|
||||||
length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3);
|
length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3);
|
||||||
if (length)
|
if (length > 0)
|
||||||
x = get_xbits(gb, length);
|
x = get_xbits(gb, length);
|
||||||
|
|
||||||
if (!(ctx->divx_version == 500 && ctx->divx_build == 413))
|
if (!(ctx->divx_version == 500 && ctx->divx_build == 413))
|
||||||
skip_bits1(gb); /* marker bit */
|
skip_bits1(gb); /* marker bit */
|
||||||
|
|
||||||
length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3);
|
length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3);
|
||||||
if (length)
|
if (length > 0)
|
||||||
y = get_xbits(gb, length);
|
y = get_xbits(gb, length);
|
||||||
|
|
||||||
skip_bits1(gb); /* marker bit */
|
skip_bits1(gb); /* marker bit */
|
||||||
|
@ -1893,6 +1893,7 @@ static av_cold int decode_init_mp3on4(AVCodecContext * avctx)
|
|||||||
s->mp3decctx[i]->adu_mode = 1;
|
s->mp3decctx[i]->adu_mode = 1;
|
||||||
s->mp3decctx[i]->avctx = avctx;
|
s->mp3decctx[i]->avctx = avctx;
|
||||||
s->mp3decctx[i]->mpadsp = s->mp3decctx[0]->mpadsp;
|
s->mp3decctx[i]->mpadsp = s->mp3decctx[0]->mpadsp;
|
||||||
|
s->mp3decctx[i]->fdsp = s->mp3decctx[0]->fdsp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1288,6 +1288,82 @@ fail:
|
|||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void clear_context(MpegEncContext *s)
|
||||||
|
{
|
||||||
|
int i, j, k;
|
||||||
|
|
||||||
|
memset(&s->next_picture, 0, sizeof(s->next_picture));
|
||||||
|
memset(&s->last_picture, 0, sizeof(s->last_picture));
|
||||||
|
memset(&s->current_picture, 0, sizeof(s->current_picture));
|
||||||
|
memset(&s->new_picture, 0, sizeof(s->new_picture));
|
||||||
|
|
||||||
|
memset(s->thread_context, 0, sizeof(s->thread_context));
|
||||||
|
|
||||||
|
s->me.map = NULL;
|
||||||
|
s->me.score_map = NULL;
|
||||||
|
s->dct_error_sum = NULL;
|
||||||
|
s->block = NULL;
|
||||||
|
s->blocks = NULL;
|
||||||
|
memset(s->pblocks, 0, sizeof(s->pblocks));
|
||||||
|
s->ac_val_base = NULL;
|
||||||
|
s->ac_val[0] =
|
||||||
|
s->ac_val[1] =
|
||||||
|
s->ac_val[2] =NULL;
|
||||||
|
s->edge_emu_buffer = NULL;
|
||||||
|
s->me.scratchpad = NULL;
|
||||||
|
s->me.temp =
|
||||||
|
s->rd_scratchpad =
|
||||||
|
s->b_scratchpad =
|
||||||
|
s->obmc_scratchpad = NULL;
|
||||||
|
|
||||||
|
s->parse_context.buffer = NULL;
|
||||||
|
s->parse_context.buffer_size = 0;
|
||||||
|
s->bitstream_buffer = NULL;
|
||||||
|
s->allocated_bitstream_buffer_size = 0;
|
||||||
|
s->picture = NULL;
|
||||||
|
s->mb_type = NULL;
|
||||||
|
s->p_mv_table_base = NULL;
|
||||||
|
s->b_forw_mv_table_base = NULL;
|
||||||
|
s->b_back_mv_table_base = NULL;
|
||||||
|
s->b_bidir_forw_mv_table_base = NULL;
|
||||||
|
s->b_bidir_back_mv_table_base = NULL;
|
||||||
|
s->b_direct_mv_table_base = NULL;
|
||||||
|
s->p_mv_table = NULL;
|
||||||
|
s->b_forw_mv_table = NULL;
|
||||||
|
s->b_back_mv_table = NULL;
|
||||||
|
s->b_bidir_forw_mv_table = NULL;
|
||||||
|
s->b_bidir_back_mv_table = NULL;
|
||||||
|
s->b_direct_mv_table = NULL;
|
||||||
|
for (i = 0; i < 2; i++) {
|
||||||
|
for (j = 0; j < 2; j++) {
|
||||||
|
for (k = 0; k < 2; k++) {
|
||||||
|
s->b_field_mv_table_base[i][j][k] = NULL;
|
||||||
|
s->b_field_mv_table[i][j][k] = NULL;
|
||||||
|
}
|
||||||
|
s->b_field_select_table[i][j] = NULL;
|
||||||
|
s->p_field_mv_table_base[i][j] = NULL;
|
||||||
|
s->p_field_mv_table[i][j] = NULL;
|
||||||
|
}
|
||||||
|
s->p_field_select_table[i] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
s->dc_val_base = NULL;
|
||||||
|
s->coded_block_base = NULL;
|
||||||
|
s->mbintra_table = NULL;
|
||||||
|
s->cbp_table = NULL;
|
||||||
|
s->pred_dir_table = NULL;
|
||||||
|
|
||||||
|
s->mbskip_table = NULL;
|
||||||
|
|
||||||
|
s->er.error_status_table = NULL;
|
||||||
|
s->er.er_temp_buffer = NULL;
|
||||||
|
s->mb_index2xy = NULL;
|
||||||
|
s->lambda_table = NULL;
|
||||||
|
|
||||||
|
s->cplx_tab = NULL;
|
||||||
|
s->bits_tab = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* init common structure for both encoder and decoder.
|
* init common structure for both encoder and decoder.
|
||||||
* this assumes that some variables like width/height are already set
|
* this assumes that some variables like width/height are already set
|
||||||
@ -1299,6 +1375,8 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
|
|||||||
s->avctx->active_thread_type & FF_THREAD_SLICE) ?
|
s->avctx->active_thread_type & FF_THREAD_SLICE) ?
|
||||||
s->avctx->thread_count : 1;
|
s->avctx->thread_count : 1;
|
||||||
|
|
||||||
|
clear_context(s);
|
||||||
|
|
||||||
if (s->encoding && s->avctx->slices)
|
if (s->encoding && s->avctx->slices)
|
||||||
nb_slices = s->avctx->slices;
|
nb_slices = s->avctx->slices;
|
||||||
|
|
||||||
@ -1346,10 +1424,6 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
|
|||||||
if (!s->picture[i].f)
|
if (!s->picture[i].f)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
memset(&s->next_picture, 0, sizeof(s->next_picture));
|
|
||||||
memset(&s->last_picture, 0, sizeof(s->last_picture));
|
|
||||||
memset(&s->current_picture, 0, sizeof(s->current_picture));
|
|
||||||
memset(&s->new_picture, 0, sizeof(s->new_picture));
|
|
||||||
s->next_picture.f = av_frame_alloc();
|
s->next_picture.f = av_frame_alloc();
|
||||||
if (!s->next_picture.f)
|
if (!s->next_picture.f)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -770,6 +770,7 @@ void ff_mpv_encode_init_x86(MpegEncContext *s);
|
|||||||
int ff_mpv_encode_end(AVCodecContext *avctx);
|
int ff_mpv_encode_end(AVCodecContext *avctx);
|
||||||
int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
|
int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
|
||||||
const AVFrame *frame, int *got_packet);
|
const AVFrame *frame, int *got_packet);
|
||||||
|
int ff_mpv_reallocate_putbitbuffer(MpegEncContext *s, size_t threshold, size_t size_increase);
|
||||||
|
|
||||||
void ff_clean_intra_table_entries(MpegEncContext *s);
|
void ff_clean_intra_table_entries(MpegEncContext *s);
|
||||||
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h);
|
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h);
|
||||||
|
@ -2721,6 +2721,35 @@ static void update_mb_info(MpegEncContext *s, int startcode)
|
|||||||
write_mb_info(s);
|
write_mb_info(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ff_mpv_reallocate_putbitbuffer(MpegEncContext *s, size_t threshold, size_t size_increase)
|
||||||
|
{
|
||||||
|
if ( s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < threshold
|
||||||
|
&& s->slice_context_count == 1
|
||||||
|
&& s->pb.buf == s->avctx->internal->byte_buffer) {
|
||||||
|
int lastgob_pos = s->ptr_lastgob - s->pb.buf;
|
||||||
|
int vbv_pos = s->vbv_delay_ptr - s->pb.buf;
|
||||||
|
|
||||||
|
uint8_t *new_buffer = NULL;
|
||||||
|
int new_buffer_size = 0;
|
||||||
|
|
||||||
|
av_fast_padded_malloc(&new_buffer, &new_buffer_size,
|
||||||
|
s->avctx->internal->byte_buffer_size + size_increase);
|
||||||
|
if (!new_buffer)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
|
memcpy(new_buffer, s->avctx->internal->byte_buffer, s->avctx->internal->byte_buffer_size);
|
||||||
|
av_free(s->avctx->internal->byte_buffer);
|
||||||
|
s->avctx->internal->byte_buffer = new_buffer;
|
||||||
|
s->avctx->internal->byte_buffer_size = new_buffer_size;
|
||||||
|
rebase_put_bits(&s->pb, new_buffer, new_buffer_size);
|
||||||
|
s->ptr_lastgob = s->pb.buf + lastgob_pos;
|
||||||
|
s->vbv_delay_ptr = s->pb.buf + vbv_pos;
|
||||||
|
}
|
||||||
|
if (s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < threshold)
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int encode_thread(AVCodecContext *c, void *arg){
|
static int encode_thread(AVCodecContext *c, void *arg){
|
||||||
MpegEncContext *s= *(void**)arg;
|
MpegEncContext *s= *(void**)arg;
|
||||||
int mb_x, mb_y, pdif = 0;
|
int mb_x, mb_y, pdif = 0;
|
||||||
@ -2797,30 +2826,10 @@ static int encode_thread(AVCodecContext *c, void *arg){
|
|||||||
// int d;
|
// int d;
|
||||||
int dmin= INT_MAX;
|
int dmin= INT_MAX;
|
||||||
int dir;
|
int dir;
|
||||||
|
int size_increase = s->avctx->internal->byte_buffer_size/4
|
||||||
if ( s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < MAX_MB_BYTES
|
|
||||||
&& s->slice_context_count == 1
|
|
||||||
&& s->pb.buf == s->avctx->internal->byte_buffer) {
|
|
||||||
int new_size = s->avctx->internal->byte_buffer_size
|
|
||||||
+ s->avctx->internal->byte_buffer_size/4
|
|
||||||
+ s->mb_width*MAX_MB_BYTES;
|
+ s->mb_width*MAX_MB_BYTES;
|
||||||
int lastgob_pos = s->ptr_lastgob - s->pb.buf;
|
|
||||||
int vbv_pos = s->vbv_delay_ptr - s->pb.buf;
|
|
||||||
|
|
||||||
uint8_t *new_buffer = NULL;
|
ff_mpv_reallocate_putbitbuffer(s, MAX_MB_BYTES, size_increase);
|
||||||
int new_buffer_size = 0;
|
|
||||||
|
|
||||||
av_fast_padded_malloc(&new_buffer, &new_buffer_size, new_size);
|
|
||||||
if (new_buffer) {
|
|
||||||
memcpy(new_buffer, s->avctx->internal->byte_buffer, s->avctx->internal->byte_buffer_size);
|
|
||||||
av_free(s->avctx->internal->byte_buffer);
|
|
||||||
s->avctx->internal->byte_buffer = new_buffer;
|
|
||||||
s->avctx->internal->byte_buffer_size = new_buffer_size;
|
|
||||||
rebase_put_bits(&s->pb, new_buffer, new_buffer_size);
|
|
||||||
s->ptr_lastgob = s->pb.buf + lastgob_pos;
|
|
||||||
s->vbv_delay_ptr = s->pb.buf + vbv_pos;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < MAX_MB_BYTES){
|
if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < MAX_MB_BYTES){
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
|
av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
|
||||||
return -1;
|
return -1;
|
||||||
@ -3733,6 +3742,8 @@ static int encode_picture(MpegEncContext *s, int picture_number)
|
|||||||
}
|
}
|
||||||
s->avctx->execute(s->avctx, encode_thread, &s->thread_context[0], NULL, context_count, sizeof(void*));
|
s->avctx->execute(s->avctx, encode_thread, &s->thread_context[0], NULL, context_count, sizeof(void*));
|
||||||
for(i=1; i<context_count; i++){
|
for(i=1; i<context_count; i++){
|
||||||
|
if (s->pb.buf_end == s->thread_context[i]->pb.buf)
|
||||||
|
set_put_bits_buffer_size(&s->pb, FFMIN(s->thread_context[i]->pb.buf_end - s->pb.buf, INT_MAX/8-32));
|
||||||
merge_context_after_encode(s, s->thread_context[i]);
|
merge_context_after_encode(s, s->thread_context[i]);
|
||||||
}
|
}
|
||||||
emms_c();
|
emms_c();
|
||||||
|
@ -36,17 +36,15 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
|
|||||||
unsigned char rle_code;
|
unsigned char rle_code;
|
||||||
unsigned char extra_byte, odd_pixel;
|
unsigned char extra_byte, odd_pixel;
|
||||||
unsigned char stream_byte;
|
unsigned char stream_byte;
|
||||||
unsigned int pixel_ptr = 0;
|
int pixel_ptr = 0;
|
||||||
int row_dec = pic->linesize[0];
|
int line = avctx->height - 1;
|
||||||
int row_ptr = (avctx->height - 1) * row_dec;
|
|
||||||
int frame_size = row_dec * avctx->height;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
while (row_ptr >= 0) {
|
while (line >= 0 && pixel_ptr <= avctx->width) {
|
||||||
if (bytestream2_get_bytes_left(gb) <= 0) {
|
if (bytestream2_get_bytes_left(gb) <= 0) {
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
"MS RLE: bytestream overrun, %d rows left\n",
|
"MS RLE: bytestream overrun, %dx%d left\n",
|
||||||
row_ptr);
|
avctx->width - pixel_ptr, line);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
rle_code = stream_byte = bytestream2_get_byteu(gb);
|
rle_code = stream_byte = bytestream2_get_byteu(gb);
|
||||||
@ -55,7 +53,7 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
|
|||||||
stream_byte = bytestream2_get_byte(gb);
|
stream_byte = bytestream2_get_byte(gb);
|
||||||
if (stream_byte == 0) {
|
if (stream_byte == 0) {
|
||||||
/* line is done, goto the next one */
|
/* line is done, goto the next one */
|
||||||
row_ptr -= row_dec;
|
line--;
|
||||||
pixel_ptr = 0;
|
pixel_ptr = 0;
|
||||||
} else if (stream_byte == 1) {
|
} else if (stream_byte == 1) {
|
||||||
/* decode is done */
|
/* decode is done */
|
||||||
@ -65,13 +63,12 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
|
|||||||
stream_byte = bytestream2_get_byte(gb);
|
stream_byte = bytestream2_get_byte(gb);
|
||||||
pixel_ptr += stream_byte;
|
pixel_ptr += stream_byte;
|
||||||
stream_byte = bytestream2_get_byte(gb);
|
stream_byte = bytestream2_get_byte(gb);
|
||||||
row_ptr -= stream_byte * row_dec;
|
|
||||||
} else {
|
} else {
|
||||||
// copy pixels from encoded stream
|
// copy pixels from encoded stream
|
||||||
odd_pixel = stream_byte & 1;
|
odd_pixel = stream_byte & 1;
|
||||||
rle_code = (stream_byte + 1) / 2;
|
rle_code = (stream_byte + 1) / 2;
|
||||||
extra_byte = rle_code & 0x01;
|
extra_byte = rle_code & 0x01;
|
||||||
if (row_ptr + pixel_ptr + stream_byte > frame_size ||
|
if (pixel_ptr + 2*rle_code - odd_pixel > avctx->width ||
|
||||||
bytestream2_get_bytes_left(gb) < rle_code) {
|
bytestream2_get_bytes_left(gb) < rle_code) {
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
"MS RLE: frame/stream ptr just went out of bounds (copy)\n");
|
"MS RLE: frame/stream ptr just went out of bounds (copy)\n");
|
||||||
@ -82,13 +79,13 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
|
|||||||
if (pixel_ptr >= avctx->width)
|
if (pixel_ptr >= avctx->width)
|
||||||
break;
|
break;
|
||||||
stream_byte = bytestream2_get_byteu(gb);
|
stream_byte = bytestream2_get_byteu(gb);
|
||||||
pic->data[0][row_ptr + pixel_ptr] = stream_byte >> 4;
|
pic->data[0][line * pic->linesize[0] + pixel_ptr] = stream_byte >> 4;
|
||||||
pixel_ptr++;
|
pixel_ptr++;
|
||||||
if (i + 1 == rle_code && odd_pixel)
|
if (i + 1 == rle_code && odd_pixel)
|
||||||
break;
|
break;
|
||||||
if (pixel_ptr >= avctx->width)
|
if (pixel_ptr >= avctx->width)
|
||||||
break;
|
break;
|
||||||
pic->data[0][row_ptr + pixel_ptr] = stream_byte & 0x0F;
|
pic->data[0][line * pic->linesize[0] + pixel_ptr] = stream_byte & 0x0F;
|
||||||
pixel_ptr++;
|
pixel_ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +95,7 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// decode a run of data
|
// decode a run of data
|
||||||
if (row_ptr + pixel_ptr + stream_byte > frame_size) {
|
if (pixel_ptr + rle_code > avctx->width + 1) {
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
"MS RLE: frame ptr just went out of bounds (run)\n");
|
"MS RLE: frame ptr just went out of bounds (run)\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
@ -108,9 +105,9 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
|
|||||||
if (pixel_ptr >= avctx->width)
|
if (pixel_ptr >= avctx->width)
|
||||||
break;
|
break;
|
||||||
if ((i & 1) == 0)
|
if ((i & 1) == 0)
|
||||||
pic->data[0][row_ptr + pixel_ptr] = stream_byte >> 4;
|
pic->data[0][line * pic->linesize[0] + pixel_ptr] = stream_byte >> 4;
|
||||||
else
|
else
|
||||||
pic->data[0][row_ptr + pixel_ptr] = stream_byte & 0x0F;
|
pic->data[0][line * pic->linesize[0] + pixel_ptr] = stream_byte & 0x0F;
|
||||||
pixel_ptr++;
|
pixel_ptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,12 +119,12 @@ static int on2avc_decode_band_types(On2AVCContext *c, GetBitContext *gb)
|
|||||||
run_len = 1;
|
run_len = 1;
|
||||||
do {
|
do {
|
||||||
run = get_bits(gb, bits_per_sect);
|
run = get_bits(gb, bits_per_sect);
|
||||||
run_len += run;
|
if (run > num_bands - band - run_len) {
|
||||||
} while (run == esc_val);
|
|
||||||
if (band + run_len > num_bands) {
|
|
||||||
av_log(c->avctx, AV_LOG_ERROR, "Invalid band type run\n");
|
av_log(c->avctx, AV_LOG_ERROR, "Invalid band type run\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
run_len += run;
|
||||||
|
} while (run == esc_val);
|
||||||
for (i = band; i < band + run_len; i++) {
|
for (i = band; i < band + run_len; i++) {
|
||||||
c->band_type[i] = band_type;
|
c->band_type[i] = band_type;
|
||||||
c->band_run_end[i] = band + run_len;
|
c->band_run_end[i] = band + run_len;
|
||||||
|
@ -103,7 +103,6 @@ static const AVOption avcodec_options[] = {
|
|||||||
{"hex", "hex motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_HEX }, INT_MIN, INT_MAX, V|E, "me_method" },
|
{"hex", "hex motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_HEX }, INT_MIN, INT_MAX, V|E, "me_method" },
|
||||||
{"umh", "umh motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_UMH }, INT_MIN, INT_MAX, V|E, "me_method" },
|
{"umh", "umh motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_UMH }, INT_MIN, INT_MAX, V|E, "me_method" },
|
||||||
{"iter", "iter motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_ITER }, INT_MIN, INT_MAX, V|E, "me_method" },
|
{"iter", "iter motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_ITER }, INT_MIN, INT_MAX, V|E, "me_method" },
|
||||||
{"extradata_size", NULL, OFFSET(extradata_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
|
|
||||||
{"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, INT_MIN, INT_MAX},
|
{"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, INT_MIN, INT_MAX},
|
||||||
{"g", "set the group of picture (GOP) size", OFFSET(gop_size), AV_OPT_TYPE_INT, {.i64 = 12 }, INT_MIN, INT_MAX, V|E},
|
{"g", "set the group of picture (GOP) size", OFFSET(gop_size), AV_OPT_TYPE_INT, {.i64 = 12 }, INT_MIN, INT_MAX, V|E},
|
||||||
{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D|E},
|
{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D|E},
|
||||||
|
@ -449,6 +449,14 @@ static int opus_decode_packet(AVCodecContext *avctx, void *data,
|
|||||||
int coded_samples = 0;
|
int coded_samples = 0;
|
||||||
int decoded_samples = 0;
|
int decoded_samples = 0;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
int delayed_samples = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < c->nb_streams; i++) {
|
||||||
|
OpusStreamContext *s = &c->streams[i];
|
||||||
|
s->out[0] =
|
||||||
|
s->out[1] = NULL;
|
||||||
|
delayed_samples = FFMAX(delayed_samples, s->delayed_samples);
|
||||||
|
}
|
||||||
|
|
||||||
/* decode the header of the first sub-packet to find out the sample count */
|
/* decode the header of the first sub-packet to find out the sample count */
|
||||||
if (buf) {
|
if (buf) {
|
||||||
@ -462,7 +470,7 @@ static int opus_decode_packet(AVCodecContext *avctx, void *data,
|
|||||||
c->streams[0].silk_samplerate = get_silk_samplerate(pkt->config);
|
c->streams[0].silk_samplerate = get_silk_samplerate(pkt->config);
|
||||||
}
|
}
|
||||||
|
|
||||||
frame->nb_samples = coded_samples + c->streams[0].delayed_samples;
|
frame->nb_samples = coded_samples + delayed_samples;
|
||||||
|
|
||||||
/* no input or buffered data => nothing to do */
|
/* no input or buffered data => nothing to do */
|
||||||
if (!frame->nb_samples) {
|
if (!frame->nb_samples) {
|
||||||
|
@ -539,6 +539,11 @@ static int decode_ihdr_chunk(AVCodecContext *avctx, PNGDecContext *s,
|
|||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (s->state & PNG_IHDR) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Multiple IHDR\n");
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
s->width = s->cur_w = bytestream2_get_be32(&s->gb);
|
s->width = s->cur_w = bytestream2_get_be32(&s->gb);
|
||||||
s->height = s->cur_h = bytestream2_get_be32(&s->gb);
|
s->height = s->cur_h = bytestream2_get_be32(&s->gb);
|
||||||
if (av_image_check_size(s->width, s->height, 0, avctx)) {
|
if (av_image_check_size(s->width, s->height, 0, avctx)) {
|
||||||
@ -618,7 +623,7 @@ static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s,
|
|||||||
} else if ((s->bits_per_pixel == 1 || s->bits_per_pixel == 2 || s->bits_per_pixel == 4 || s->bits_per_pixel == 8) &&
|
} else if ((s->bits_per_pixel == 1 || s->bits_per_pixel == 2 || s->bits_per_pixel == 4 || s->bits_per_pixel == 8) &&
|
||||||
s->color_type == PNG_COLOR_TYPE_PALETTE) {
|
s->color_type == PNG_COLOR_TYPE_PALETTE) {
|
||||||
avctx->pix_fmt = AV_PIX_FMT_PAL8;
|
avctx->pix_fmt = AV_PIX_FMT_PAL8;
|
||||||
} else if (s->bit_depth == 1 && s->bits_per_pixel == 1) {
|
} else if (s->bit_depth == 1 && s->bits_per_pixel == 1 && avctx->codec_id != AV_CODEC_ID_APNG) {
|
||||||
avctx->pix_fmt = AV_PIX_FMT_MONOBLACK;
|
avctx->pix_fmt = AV_PIX_FMT_MONOBLACK;
|
||||||
} else if (s->bit_depth == 8 &&
|
} else if (s->bit_depth == 8 &&
|
||||||
s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
|
s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
|
||||||
@ -805,28 +810,34 @@ static int decode_fctl_chunk(AVCodecContext *avctx, PNGDecContext *s,
|
|||||||
uint32_t length)
|
uint32_t length)
|
||||||
{
|
{
|
||||||
uint32_t sequence_number;
|
uint32_t sequence_number;
|
||||||
|
int cur_w, cur_h, x_offset, y_offset, dispose_op, blend_op;
|
||||||
|
|
||||||
if (length != 26)
|
if (length != 26)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
|
if (!(s->state & PNG_IHDR)) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "fctl before IHDR\n");
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
sequence_number = bytestream2_get_be32(&s->gb);
|
sequence_number = bytestream2_get_be32(&s->gb);
|
||||||
s->cur_w = bytestream2_get_be32(&s->gb);
|
cur_w = bytestream2_get_be32(&s->gb);
|
||||||
s->cur_h = bytestream2_get_be32(&s->gb);
|
cur_h = bytestream2_get_be32(&s->gb);
|
||||||
s->x_offset = bytestream2_get_be32(&s->gb);
|
x_offset = bytestream2_get_be32(&s->gb);
|
||||||
s->y_offset = bytestream2_get_be32(&s->gb);
|
y_offset = bytestream2_get_be32(&s->gb);
|
||||||
bytestream2_skip(&s->gb, 4); /* delay_num (2), delay_den (2) */
|
bytestream2_skip(&s->gb, 4); /* delay_num (2), delay_den (2) */
|
||||||
s->dispose_op = bytestream2_get_byte(&s->gb);
|
dispose_op = bytestream2_get_byte(&s->gb);
|
||||||
s->blend_op = bytestream2_get_byte(&s->gb);
|
blend_op = bytestream2_get_byte(&s->gb);
|
||||||
bytestream2_skip(&s->gb, 4); /* crc */
|
bytestream2_skip(&s->gb, 4); /* crc */
|
||||||
|
|
||||||
if (sequence_number == 0 &&
|
if (sequence_number == 0 &&
|
||||||
(s->cur_w != s->width ||
|
(cur_w != s->width ||
|
||||||
s->cur_h != s->height ||
|
cur_h != s->height ||
|
||||||
s->x_offset != 0 ||
|
x_offset != 0 ||
|
||||||
s->y_offset != 0) ||
|
y_offset != 0) ||
|
||||||
s->cur_w <= 0 || s->cur_h <= 0 ||
|
cur_w <= 0 || cur_h <= 0 ||
|
||||||
s->x_offset < 0 || s->y_offset < 0 ||
|
x_offset < 0 || y_offset < 0 ||
|
||||||
s->cur_w > s->width - s->x_offset|| s->cur_h > s->height - s->y_offset)
|
cur_w > s->width - x_offset|| cur_h > s->height - y_offset)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
/* always (re)start with a clean frame */
|
/* always (re)start with a clean frame */
|
||||||
@ -840,6 +851,13 @@ static int decode_fctl_chunk(AVCodecContext *avctx, PNGDecContext *s,
|
|||||||
s->dispose_op = APNG_DISPOSE_OP_NONE;
|
s->dispose_op = APNG_DISPOSE_OP_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s->cur_w = cur_w;
|
||||||
|
s->cur_h = cur_h;
|
||||||
|
s->x_offset = x_offset;
|
||||||
|
s->y_offset = y_offset;
|
||||||
|
s->dispose_op = dispose_op;
|
||||||
|
s->blend_op = blend_op;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -968,7 +986,7 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
|
|||||||
AVDictionary *metadata = NULL;
|
AVDictionary *metadata = NULL;
|
||||||
uint32_t tag, length;
|
uint32_t tag, length;
|
||||||
int decode_next_dat = 0;
|
int decode_next_dat = 0;
|
||||||
int ret = AVERROR_INVALIDDATA;
|
int ret;
|
||||||
AVFrame *ref;
|
AVFrame *ref;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@ -984,12 +1002,14 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
|
|||||||
if ( s->state & PNG_ALLIMAGE
|
if ( s->state & PNG_ALLIMAGE
|
||||||
&& avctx->strict_std_compliance <= FF_COMPLIANCE_NORMAL)
|
&& avctx->strict_std_compliance <= FF_COMPLIANCE_NORMAL)
|
||||||
goto exit_loop;
|
goto exit_loop;
|
||||||
|
ret = AVERROR_INVALIDDATA;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
length = bytestream2_get_be32(&s->gb);
|
length = bytestream2_get_be32(&s->gb);
|
||||||
if (length > 0x7fffffff || length > bytestream2_get_bytes_left(&s->gb)) {
|
if (length > 0x7fffffff || length > bytestream2_get_bytes_left(&s->gb)) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "chunk too big\n");
|
av_log(avctx, AV_LOG_ERROR, "chunk too big\n");
|
||||||
|
ret = AVERROR_INVALIDDATA;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
tag = bytestream2_get_le32(&s->gb);
|
tag = bytestream2_get_le32(&s->gb);
|
||||||
@ -1001,11 +1021,11 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
|
|||||||
((tag >> 24) & 0xff), length);
|
((tag >> 24) & 0xff), length);
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case MKTAG('I', 'H', 'D', 'R'):
|
case MKTAG('I', 'H', 'D', 'R'):
|
||||||
if (decode_ihdr_chunk(avctx, s, length) < 0)
|
if ((ret = decode_ihdr_chunk(avctx, s, length)) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
break;
|
break;
|
||||||
case MKTAG('p', 'H', 'Y', 's'):
|
case MKTAG('p', 'H', 'Y', 's'):
|
||||||
if (decode_phys_chunk(avctx, s) < 0)
|
if ((ret = decode_phys_chunk(avctx, s)) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
break;
|
break;
|
||||||
case MKTAG('f', 'c', 'T', 'L'):
|
case MKTAG('f', 'c', 'T', 'L'):
|
||||||
@ -1018,15 +1038,17 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
|
|||||||
case MKTAG('f', 'd', 'A', 'T'):
|
case MKTAG('f', 'd', 'A', 'T'):
|
||||||
if (!CONFIG_APNG_DECODER || avctx->codec_id != AV_CODEC_ID_APNG)
|
if (!CONFIG_APNG_DECODER || avctx->codec_id != AV_CODEC_ID_APNG)
|
||||||
goto skip_tag;
|
goto skip_tag;
|
||||||
if (!decode_next_dat)
|
if (!decode_next_dat) {
|
||||||
|
ret = AVERROR_INVALIDDATA;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
}
|
||||||
bytestream2_get_be32(&s->gb);
|
bytestream2_get_be32(&s->gb);
|
||||||
length -= 4;
|
length -= 4;
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
case MKTAG('I', 'D', 'A', 'T'):
|
case MKTAG('I', 'D', 'A', 'T'):
|
||||||
if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && !decode_next_dat)
|
if (CONFIG_APNG_DECODER && avctx->codec_id == AV_CODEC_ID_APNG && !decode_next_dat)
|
||||||
goto skip_tag;
|
goto skip_tag;
|
||||||
if (decode_idat_chunk(avctx, s, length, p) < 0)
|
if ((ret = decode_idat_chunk(avctx, s, length, p)) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
break;
|
break;
|
||||||
case MKTAG('P', 'L', 'T', 'E'):
|
case MKTAG('P', 'L', 'T', 'E'):
|
||||||
@ -1051,6 +1073,7 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
|
|||||||
if (!(s->state & PNG_ALLIMAGE))
|
if (!(s->state & PNG_ALLIMAGE))
|
||||||
av_log(avctx, AV_LOG_ERROR, "IEND without all image\n");
|
av_log(avctx, AV_LOG_ERROR, "IEND without all image\n");
|
||||||
if (!(s->state & (PNG_ALLIMAGE|PNG_IDAT))) {
|
if (!(s->state & (PNG_ALLIMAGE|PNG_IDAT))) {
|
||||||
|
ret = AVERROR_INVALIDDATA;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
bytestream2_skip(&s->gb, 4); /* crc */
|
bytestream2_skip(&s->gb, 4); /* crc */
|
||||||
@ -1070,7 +1093,7 @@ exit_loop:
|
|||||||
/* handle p-frames only if a predecessor frame is available */
|
/* handle p-frames only if a predecessor frame is available */
|
||||||
ref = s->dispose_op == APNG_DISPOSE_OP_PREVIOUS ?
|
ref = s->dispose_op == APNG_DISPOSE_OP_PREVIOUS ?
|
||||||
s->previous_picture.f : s->last_picture.f;
|
s->previous_picture.f : s->last_picture.f;
|
||||||
if (ref->data[0]) {
|
if (ref->data[0] && s->last_picture.f->data[0]) {
|
||||||
if ( !(avpkt->flags & AV_PKT_FLAG_KEY) && avctx->codec_tag != AV_RL32("MPNG")
|
if ( !(avpkt->flags & AV_PKT_FLAG_KEY) && avctx->codec_tag != AV_RL32("MPNG")
|
||||||
&& ref->width == p->width
|
&& ref->width == p->width
|
||||||
&& ref->height== p->height
|
&& ref->height== p->height
|
||||||
|
@ -183,6 +183,7 @@ static int decode_picture_header(AVCodecContext *avctx, const uint8_t *buf, cons
|
|||||||
|
|
||||||
if (ctx->slice_count != slice_count || !ctx->slices) {
|
if (ctx->slice_count != slice_count || !ctx->slices) {
|
||||||
av_freep(&ctx->slices);
|
av_freep(&ctx->slices);
|
||||||
|
ctx->slice_count = 0;
|
||||||
ctx->slices = av_mallocz_array(slice_count, sizeof(*ctx->slices));
|
ctx->slices = av_mallocz_array(slice_count, sizeof(*ctx->slices));
|
||||||
if (!ctx->slices)
|
if (!ctx->slices)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
@ -453,6 +453,9 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
|
|||||||
*got_picture_ptr = p->got_frame;
|
*got_picture_ptr = p->got_frame;
|
||||||
picture->pkt_dts = p->avpkt.dts;
|
picture->pkt_dts = p->avpkt.dts;
|
||||||
|
|
||||||
|
if (p->result < 0)
|
||||||
|
err = p->result;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A later call with avkpt->size == 0 may loop over all threads,
|
* A later call with avkpt->size == 0 may loop over all threads,
|
||||||
* including this one, searching for a frame to return before being
|
* including this one, searching for a frame to return before being
|
||||||
@ -470,6 +473,14 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
|
|||||||
|
|
||||||
fctx->next_finished = finished;
|
fctx->next_finished = finished;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When no frame was found while flushing, but an error occured in
|
||||||
|
* any thread, return it instead of 0.
|
||||||
|
* Otherwise the error can get lost.
|
||||||
|
*/
|
||||||
|
if (!avpkt->size && !*got_picture_ptr)
|
||||||
|
return err;
|
||||||
|
|
||||||
/* return the size of the consumed packet if no error occurred */
|
/* return the size of the consumed packet if no error occurred */
|
||||||
return (p->result >= 0) ? avpkt->size : p->result;
|
return (p->result >= 0) ? avpkt->size : p->result;
|
||||||
}
|
}
|
||||||
@ -571,7 +582,7 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
|
|||||||
pthread_join(p->thread, NULL);
|
pthread_join(p->thread, NULL);
|
||||||
p->thread_init=0;
|
p->thread_init=0;
|
||||||
|
|
||||||
if (codec->close)
|
if (codec->close && p->avctx)
|
||||||
codec->close(p->avctx);
|
codec->close(p->avctx);
|
||||||
|
|
||||||
avctx->codec = NULL;
|
avctx->codec = NULL;
|
||||||
@ -591,11 +602,12 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
|
|||||||
av_packet_unref(&p->avpkt);
|
av_packet_unref(&p->avpkt);
|
||||||
av_freep(&p->released_buffers);
|
av_freep(&p->released_buffers);
|
||||||
|
|
||||||
if (i) {
|
if (i && p->avctx) {
|
||||||
av_freep(&p->avctx->priv_data);
|
av_freep(&p->avctx->priv_data);
|
||||||
av_freep(&p->avctx->slice_offset);
|
av_freep(&p->avctx->slice_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p->avctx)
|
||||||
av_freep(&p->avctx->internal);
|
av_freep(&p->avctx->internal);
|
||||||
av_freep(&p->avctx);
|
av_freep(&p->avctx);
|
||||||
}
|
}
|
||||||
@ -668,6 +680,7 @@ int ff_frame_thread_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
copy->internal = av_malloc(sizeof(AVCodecInternal));
|
copy->internal = av_malloc(sizeof(AVCodecInternal));
|
||||||
if (!copy->internal) {
|
if (!copy->internal) {
|
||||||
|
copy->priv_data = NULL;
|
||||||
err = AVERROR(ENOMEM);
|
err = AVERROR(ENOMEM);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -229,6 +229,7 @@ static inline void skip_put_bytes(PutBitContext *s, int n)
|
|||||||
{
|
{
|
||||||
av_assert2((put_bits_count(s) & 7) == 0);
|
av_assert2((put_bits_count(s) & 7) == 0);
|
||||||
av_assert2(s->bit_left == 32);
|
av_assert2(s->bit_left == 32);
|
||||||
|
av_assert0(n <= s->buf_end - s->buf_ptr);
|
||||||
s->buf_ptr += n;
|
s->buf_ptr += n;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,6 +253,7 @@ static inline void skip_put_bits(PutBitContext *s, int n)
|
|||||||
static inline void set_put_bits_buffer_size(PutBitContext *s, int size)
|
static inline void set_put_bits_buffer_size(PutBitContext *s, int size)
|
||||||
{
|
{
|
||||||
s->buf_end = s->buf + size;
|
s->buf_end = s->buf + size;
|
||||||
|
s->size_in_bits = 8*size;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* AVCODEC_PUT_BITS_H */
|
#endif /* AVCODEC_PUT_BITS_H */
|
||||||
|
@ -51,7 +51,7 @@ static int raw_encode(AVCodecContext *avctx, AVPacket *pkt,
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if ((ret = ff_alloc_packet2(avctx, pkt, ret)) < 0)
|
if ((ret = ff_alloc_packet(pkt, ret)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
if ((ret = avpicture_layout((const AVPicture *)frame, avctx->pix_fmt, avctx->width,
|
if ((ret = avpicture_layout((const AVPicture *)frame, avctx->pix_fmt, avctx->width,
|
||||||
avctx->height, pkt->data, pkt->size)) < 0)
|
avctx->height, pkt->data, pkt->size)) < 0)
|
||||||
|
@ -999,6 +999,8 @@ static av_cold int roq_encode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
av_lfg_init(&enc->randctx, 1);
|
av_lfg_init(&enc->randctx, 1);
|
||||||
|
|
||||||
|
enc->avctx = avctx;
|
||||||
|
|
||||||
enc->framesSinceKeyframe = 0;
|
enc->framesSinceKeyframe = 0;
|
||||||
if ((avctx->width & 0xf) || (avctx->height & 0xf)) {
|
if ((avctx->width & 0xf) || (avctx->height & 0xf)) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Dimensions must be divisible by 16\n");
|
av_log(avctx, AV_LOG_ERROR, "Dimensions must be divisible by 16\n");
|
||||||
|
@ -1534,7 +1534,14 @@ int ff_rv34_decode_init_thread_copy(AVCodecContext *avctx)
|
|||||||
|
|
||||||
if (avctx->internal->is_copy) {
|
if (avctx->internal->is_copy) {
|
||||||
r->tmp_b_block_base = NULL;
|
r->tmp_b_block_base = NULL;
|
||||||
|
r->cbp_chroma = NULL;
|
||||||
|
r->cbp_luma = NULL;
|
||||||
|
r->deblock_coefs = NULL;
|
||||||
|
r->intra_types_hist = NULL;
|
||||||
|
r->mb_type = NULL;
|
||||||
|
|
||||||
ff_mpv_idct_init(&r->s);
|
ff_mpv_idct_init(&r->s);
|
||||||
|
|
||||||
if ((err = ff_mpv_common_init(&r->s)) < 0)
|
if ((err = ff_mpv_common_init(&r->s)) < 0)
|
||||||
return err;
|
return err;
|
||||||
if ((err = rv34_decoder_alloc(r)) < 0) {
|
if ((err = rv34_decoder_alloc(r)) < 0) {
|
||||||
|
@ -91,6 +91,7 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src)
|
|||||||
break;
|
break;
|
||||||
if (*p == '>')
|
if (*p == '>')
|
||||||
p++;
|
p++;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (!av_isspace(*p))
|
if (!av_isspace(*p))
|
||||||
av_bprint_chars(dst, *p, 1);
|
av_bprint_chars(dst, *p, 1);
|
||||||
|
@ -457,6 +457,7 @@ static void destroy_buffers(SANMVideoContext *ctx)
|
|||||||
ctx->frm0_size =
|
ctx->frm0_size =
|
||||||
ctx->frm1_size =
|
ctx->frm1_size =
|
||||||
ctx->frm2_size = 0;
|
ctx->frm2_size = 0;
|
||||||
|
init_sizes(ctx, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold int init_buffers(SANMVideoContext *ctx)
|
static av_cold int init_buffers(SANMVideoContext *ctx)
|
||||||
|
@ -137,6 +137,7 @@ typedef struct AACSBRContext {
|
|||||||
struct SpectralBandReplication {
|
struct SpectralBandReplication {
|
||||||
int sample_rate;
|
int sample_rate;
|
||||||
int start;
|
int start;
|
||||||
|
int id_aac;
|
||||||
int reset;
|
int reset;
|
||||||
SpectrumParameters spectrum_params;
|
SpectrumParameters spectrum_params;
|
||||||
int bs_amp_res_header;
|
int bs_amp_res_header;
|
||||||
|
@ -129,8 +129,7 @@ static int allocate_buffers(ShortenContext *s)
|
|||||||
av_log(s->avctx, AV_LOG_ERROR, "nmean too large\n");
|
av_log(s->avctx, AV_LOG_ERROR, "nmean too large\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
if (s->blocksize + s->nwrap >= UINT_MAX / sizeof(int32_t) ||
|
if (s->blocksize + (uint64_t)s->nwrap >= UINT_MAX / sizeof(int32_t)) {
|
||||||
s->blocksize + s->nwrap <= (unsigned)s->nwrap) {
|
|
||||||
av_log(s->avctx, AV_LOG_ERROR,
|
av_log(s->avctx, AV_LOG_ERROR,
|
||||||
"s->blocksize + s->nwrap too large\n");
|
"s->blocksize + s->nwrap too large\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
@ -278,7 +277,7 @@ static int decode_subframe_lpc(ShortenContext *s, int command, int channel,
|
|||||||
if (command == FN_QLPC) {
|
if (command == FN_QLPC) {
|
||||||
/* read/validate prediction order */
|
/* read/validate prediction order */
|
||||||
pred_order = get_ur_golomb_shorten(&s->gb, LPCQSIZE);
|
pred_order = get_ur_golomb_shorten(&s->gb, LPCQSIZE);
|
||||||
if (pred_order > s->nwrap) {
|
if ((unsigned)pred_order > s->nwrap) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "invalid pred_order %d\n",
|
av_log(s->avctx, AV_LOG_ERROR, "invalid pred_order %d\n",
|
||||||
pred_order);
|
pred_order);
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
@ -370,6 +369,11 @@ static int read_header(ShortenContext *s)
|
|||||||
s->nmean = get_uint(s, 0);
|
s->nmean = get_uint(s, 0);
|
||||||
|
|
||||||
skip_bytes = get_uint(s, NSKIPSIZE);
|
skip_bytes = get_uint(s, NSKIPSIZE);
|
||||||
|
if ((unsigned)skip_bytes > get_bits_left(&s->gb)/8) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "invalid skip_bytes: %d\n", skip_bytes);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < skip_bytes; i++)
|
for (i = 0; i < skip_bytes; i++)
|
||||||
skip_bits(&s->gb, 8);
|
skip_bits(&s->gb, 8);
|
||||||
}
|
}
|
||||||
|
@ -155,6 +155,10 @@ static int smvjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_siz
|
|||||||
if (!cur_frame) {
|
if (!cur_frame) {
|
||||||
av_frame_unref(mjpeg_data);
|
av_frame_unref(mjpeg_data);
|
||||||
ret = avcodec_decode_video2(s->avctx, mjpeg_data, &s->mjpeg_data_size, avpkt);
|
ret = avcodec_decode_video2(s->avctx, mjpeg_data, &s->mjpeg_data_size, avpkt);
|
||||||
|
if (ret < 0) {
|
||||||
|
s->mjpeg_data_size = 0;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
} else if (!s->mjpeg_data_size)
|
} else if (!s->mjpeg_data_size)
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
|
|
||||||
|
@ -303,6 +303,8 @@ static av_always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer
|
|||||||
BlockNode *lb= lt+b_stride;
|
BlockNode *lb= lt+b_stride;
|
||||||
BlockNode *rb= lb+1;
|
BlockNode *rb= lb+1;
|
||||||
uint8_t *block[4];
|
uint8_t *block[4];
|
||||||
|
// When src_stride is large enough, it is possible to interleave the blocks.
|
||||||
|
// Otherwise the blocks are written sequentially in the tmp buffer.
|
||||||
int tmp_step= src_stride >= 7*MB_SIZE ? MB_SIZE : MB_SIZE*src_stride;
|
int tmp_step= src_stride >= 7*MB_SIZE ? MB_SIZE : MB_SIZE*src_stride;
|
||||||
uint8_t *tmp = s->scratchbuf;
|
uint8_t *tmp = s->scratchbuf;
|
||||||
uint8_t *ptmp;
|
uint8_t *ptmp;
|
||||||
@ -346,8 +348,6 @@ static av_always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer
|
|||||||
|
|
||||||
if(b_w<=0 || b_h<=0) return;
|
if(b_w<=0 || b_h<=0) return;
|
||||||
|
|
||||||
av_assert2(src_stride > 2*MB_SIZE + 5);
|
|
||||||
|
|
||||||
if(!sliced && offset_dst)
|
if(!sliced && offset_dst)
|
||||||
dst += src_x + src_y*dst_stride;
|
dst += src_x + src_y*dst_stride;
|
||||||
dst8+= src_x + src_y*src_stride;
|
dst8+= src_x + src_y*src_stride;
|
||||||
|
@ -497,12 +497,15 @@ static int predictor_calc_error(int *k, int *state, int order, int error)
|
|||||||
// copes better with quantization, and calculates the
|
// copes better with quantization, and calculates the
|
||||||
// actual whitened result as it goes.
|
// actual whitened result as it goes.
|
||||||
|
|
||||||
static void modified_levinson_durbin(int *window, int window_entries,
|
static int modified_levinson_durbin(int *window, int window_entries,
|
||||||
int *out, int out_entries, int channels, int *tap_quant)
|
int *out, int out_entries, int channels, int *tap_quant)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int *state = av_calloc(window_entries, sizeof(*state));
|
int *state = av_calloc(window_entries, sizeof(*state));
|
||||||
|
|
||||||
|
if (!state)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
memcpy(state, window, 4* window_entries);
|
memcpy(state, window, 4* window_entries);
|
||||||
|
|
||||||
for (i = 0; i < out_entries; i++)
|
for (i = 0; i < out_entries; i++)
|
||||||
@ -567,6 +570,7 @@ static void modified_levinson_durbin(int *window, int window_entries,
|
|||||||
}
|
}
|
||||||
|
|
||||||
av_free(state);
|
av_free(state);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int code_samplerate(int samplerate)
|
static inline int code_samplerate(int samplerate)
|
||||||
@ -627,6 +631,9 @@ static av_cold int sonic_encode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
// generate taps
|
// generate taps
|
||||||
s->tap_quant = av_calloc(s->num_taps, sizeof(*s->tap_quant));
|
s->tap_quant = av_calloc(s->num_taps, sizeof(*s->tap_quant));
|
||||||
|
if (!s->tap_quant)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
for (i = 0; i < s->num_taps; i++)
|
for (i = 0; i < s->num_taps; i++)
|
||||||
s->tap_quant[i] = ff_sqrt(i+1);
|
s->tap_quant[i] = ff_sqrt(i+1);
|
||||||
|
|
||||||
@ -656,7 +663,7 @@ static av_cold int sonic_encode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
s->window_size = ((2*s->tail_size)+s->frame_size);
|
s->window_size = ((2*s->tail_size)+s->frame_size);
|
||||||
s->window = av_calloc(s->window_size, sizeof(*s->window));
|
s->window = av_calloc(s->window_size, sizeof(*s->window));
|
||||||
if (!s->window)
|
if (!s->window || !s->int_samples)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
avctx->extradata = av_mallocz(16);
|
avctx->extradata = av_mallocz(16);
|
||||||
@ -769,8 +776,11 @@ static int sonic_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
|||||||
s->tail[i] = s->int_samples[s->frame_size - s->tail_size + i];
|
s->tail[i] = s->int_samples[s->frame_size - s->tail_size + i];
|
||||||
|
|
||||||
// generate taps
|
// generate taps
|
||||||
modified_levinson_durbin(s->window, s->window_size,
|
ret = modified_levinson_durbin(s->window, s->window_size,
|
||||||
s->predictor_k, s->num_taps, s->channels, s->tap_quant);
|
s->predictor_k, s->num_taps, s->channels, s->tap_quant);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
if ((ret = intlist_write(&c, state, s->predictor_k, s->num_taps, 0)) < 0)
|
if ((ret = intlist_write(&c, state, s->predictor_k, s->num_taps, 0)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@ -873,17 +883,24 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
if (s->version >= 1)
|
if (s->version >= 1)
|
||||||
{
|
{
|
||||||
|
int sample_rate_index;
|
||||||
s->channels = get_bits(&gb, 2);
|
s->channels = get_bits(&gb, 2);
|
||||||
s->samplerate = samplerate_table[get_bits(&gb, 4)];
|
sample_rate_index = get_bits(&gb, 4);
|
||||||
|
if (sample_rate_index >= FF_ARRAY_ELEMS(samplerate_table)) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Invalid sample_rate_index %d\n", sample_rate_index);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
s->samplerate = samplerate_table[sample_rate_index];
|
||||||
av_log(avctx, AV_LOG_INFO, "Sonicv2 chans: %d samprate: %d\n",
|
av_log(avctx, AV_LOG_INFO, "Sonicv2 chans: %d samprate: %d\n",
|
||||||
s->channels, s->samplerate);
|
s->channels, s->samplerate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->channels > MAX_CHANNELS)
|
if (s->channels > MAX_CHANNELS || s->channels < 1)
|
||||||
{
|
{
|
||||||
av_log(avctx, AV_LOG_ERROR, "Only mono and stereo streams are supported by now\n");
|
av_log(avctx, AV_LOG_ERROR, "Only mono and stereo streams are supported by now\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
avctx->channels = s->channels;
|
||||||
|
|
||||||
s->lossless = get_bits1(&gb);
|
s->lossless = get_bits1(&gb);
|
||||||
if (!s->lossless)
|
if (!s->lossless)
|
||||||
@ -913,6 +930,9 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
// generate taps
|
// generate taps
|
||||||
s->tap_quant = av_calloc(s->num_taps, sizeof(*s->tap_quant));
|
s->tap_quant = av_calloc(s->num_taps, sizeof(*s->tap_quant));
|
||||||
|
if (!s->tap_quant)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
for (i = 0; i < s->num_taps; i++)
|
for (i = 0; i < s->num_taps; i++)
|
||||||
s->tap_quant[i] = ff_sqrt(i+1);
|
s->tap_quant[i] = ff_sqrt(i+1);
|
||||||
|
|
||||||
@ -932,6 +952,8 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
|
|||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
s->int_samples = av_calloc(s->frame_size, sizeof(*s->int_samples));
|
s->int_samples = av_calloc(s->frame_size, sizeof(*s->int_samples));
|
||||||
|
if (!s->int_samples)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -801,6 +801,12 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
if (s->mcdparams[i].present) {
|
if (s->mcdparams[i].present) {
|
||||||
s->mcdparams[i].index = get_bits(gb, 2);
|
s->mcdparams[i].index = get_bits(gb, 2);
|
||||||
s->mcdparams[i].chan2 = get_bits(gb, 4);
|
s->mcdparams[i].chan2 = get_bits(gb, 4);
|
||||||
|
if (s->mcdparams[i].chan2 >= avctx->channels) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
|
"invalid channel 2 (%d) for %d channel(s)\n",
|
||||||
|
s->mcdparams[i].chan2, avctx->channels);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
if (s->mcdparams[i].index == 1) {
|
if (s->mcdparams[i].index == 1) {
|
||||||
if ((nbit == s->mcdparams[i].chan2) ||
|
if ((nbit == s->mcdparams[i].chan2) ||
|
||||||
(ch_mask & 1 << s->mcdparams[i].chan2))
|
(ch_mask & 1 << s->mcdparams[i].chan2))
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user