Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c1ecb057d |
@@ -1,323 +1,7 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 4.0.4:
|
||||
- avcodec/hevcdec: Avoid only partly skiping duplicate first slices
|
||||
- lavc/bmp: Avoid a heap buffer overwrite for 1bpp input.
|
||||
- avcodec/mpegpicture: Check size of edge_emu_buffer
|
||||
- avformat/mov: Fix potential integer overflow in entry check in mov_read_trun()
|
||||
- avcodec/truemotion2: Fix integer overflow in tm2_null_res_block()
|
||||
- avcodec/dfa: Check the chunk header is not truncated
|
||||
- avcodec/clearvideo: Check remaining data in P frames
|
||||
- avcodec/dvbsubdec: Check object position
|
||||
- avcodec/cdgraphics: Use ff_set_dimensions()
|
||||
- avformat/gdv: Check fps
|
||||
- configure: use vpx_codec_vp8_dx/cx for libvpx-vp8 checking
|
||||
- configure: add missing pthreads extralibs dependency for libvpx-vp9
|
||||
- avcodec/mpeg4videodec: Check idx in mpeg4_decode_studio_block()
|
||||
- avcodec/dxv: Correct integer overflow in get_opcodes()
|
||||
- avcodec/scpr: Fix use of uninitialized variable
|
||||
- avcodec/qpeg: Limit copy in qpeg_decode_intra() to the available bytes
|
||||
- avcodec/aic: Check remaining bits in aic_decode_coeffs()
|
||||
- avcodec/gdv: Check for truncated tags in decompress_5()
|
||||
- avcodec/bethsoftvideo: Check block_type
|
||||
- avcodec/jpeg2000dwt: Fix integer overflow in dwt_decode97_int()
|
||||
- avcodec/error_resilience: Use a symmetric check for skipping MV estimation
|
||||
- avcodec/mlpdec: Insuffient typo
|
||||
- avcodec/zmbv: obtain frame later
|
||||
- avcodec/jvdec: Check available input space before decode8x8()
|
||||
- avcodec/h264_direct: Fix overflow in POC comparission
|
||||
- avformat/webmdashenc: Check id in adaption_sets
|
||||
- avformat/http: Fix Out-of-Bounds access in process_line()
|
||||
- avformat/ftp: Fix Out-of-Bounds Access and Information Leak in ftp.c:393
|
||||
- avcodec/htmlsubtitles: Fixes denial of service due to use of sscanf in inner loop for handling braces
|
||||
- avcodec/htmlsubtitles: Fixes denial of service due to use of sscanf in inner loop for tag scaning
|
||||
- avformat/matroskadec: Do not leak queued packets on sync errors
|
||||
- avcodec/mpeg4videodec: Clear interlaced_dct for studio profile
|
||||
- avformat/mov: Do not use reference stream in mov_read_sidx() if there is no reference stream
|
||||
- avcodec/sbrdsp_fixed.c: remove input value limit for sbr_sum_square_c()
|
||||
- avformat/mov: validate chunk_count vs stsc_data
|
||||
- avformat/mov.c: require tfhd to begin parsing trun
|
||||
- avcodec/pgssubdec: Check for duplicate display segments
|
||||
- avformat/rtsp: Check number of streams in sdp_parse_line()
|
||||
- avformat/rtsp: Clear reply in every iteration in ff_rtsp_connect()
|
||||
- avcodec/fic: Check that there is input left in fic_decode_block()
|
||||
- avcodec/tiff: Check for 12bit gray fax
|
||||
- avutil/imgutils: Optimize memset_bytes() by using av_memcpy_backptr()
|
||||
- avutil/mem: Optimize fill32() by unrolling and using 64bit
|
||||
- configure: bump year
|
||||
- avcodec/diracdec: Check component quant
|
||||
- avcodec/tests/rangecoder: initialize array to avoid valgrind warning
|
||||
- avcodec/h264_slice: Fix integer overflow in implicit_weight_table()
|
||||
- avcodec/exr: set layer_match in all branches
|
||||
- avcodec/exr: Check for duplicate channel index
|
||||
- avcodec/4xm: Fix returned error codes
|
||||
- avformat/libopenmpt: Fix successfull typo
|
||||
- avcodec/v4l2_m2m: fix cant typo
|
||||
- avcodec/mjpegbdec: Fix some misplaced {} and spaces
|
||||
- avformat/wvdec: detect and error out on WavPack DSD files
|
||||
- avcodec/mips: Fix failed case: hevc-conformance-AMP_A_Samsung_* when enable msa
|
||||
- avcodec/fic: Fail on invalid slice size/off
|
||||
- postproc/postprocess_template: remove FF_REG_sp from clobber list
|
||||
- postproc/postprocess_template: Avoid using %4 for the threshold compare
|
||||
- avcodec/rpza: Check that there is enough data for all the blocks
|
||||
- avcodec/rpza: Move frame allocation to a later point
|
||||
- avcodec/avcodec: Document the data type for AV_PKT_DATA_MPEGTS_STREAM_ID
|
||||
- avformat/mpegts: Fix side data type for stream id
|
||||
- tests/fate/filter-video: increase fuzz for fate-filter-refcmp-psnr-rgb
|
||||
- avcodec/mjpegdec: Fix indention of ljpeg_decode_yuv_scan()
|
||||
- lavf/id3v2: fail read_apic on EOF reading mimetype
|
||||
- avformat/nutenc: Document trailer index assert better
|
||||
- lavf/mov: ensure only one tkhd per trak
|
||||
- avcodec/clearvideo: Check remaining input bits in P macro block loop
|
||||
- avcodec/dxv: Check that there is enough data to decompress
|
||||
- avcodec/ppc/hevcdsp: Fix build failures with powerpc-linux-gnu-gcc-4.8 with --disable-optimizations
|
||||
- avcodec/msvideo1: Check for too small dimensions
|
||||
- avcodec/wmv2dec: Skip I frame if its smaller than 1/8 of the minimal size
|
||||
- avcodec/msmpeg4dec: Skip frame if its smaller than 1/8 of the minimal size
|
||||
- avcodec/truemotion2rt: Fix rounding in input size check
|
||||
- avcodec/truemotion2: fix integer overflows in tm2_low_chroma()
|
||||
- avcodec/pngdec: Check compression method
|
||||
- fftools/ffmpeg: Repair reinit_filter feature
|
||||
- avcodec/shorten: Fix integer overflow with offset
|
||||
- h264_redundant_pps: Fix logging context
|
||||
- avcodec/cavsdec: Propagate error codes inside decode_mb_i()
|
||||
- avcodec/mpeg4videodec: Clear partitioned frame in decode_studio_vop_header()
|
||||
- avcodec/mpegaudio_parser: Consume more than 0 bytes in case of the unsupported mp3adu case
|
||||
- avcodec/hevcdec: decode at most one slice reporting being the first in the picture
|
||||
- avformat/dsfdec: fix calculation of size of data chunk
|
||||
- avformat/dsfdec: properly handle padded last packet
|
||||
- avcodec/hevcdec: fix non-ref frame judgement
|
||||
- avcodec/libaomenc: remove AVOption related to frame partitions
|
||||
|
||||
version 4.0.3:
|
||||
- avutil/integer: Fix integer overflow in av_mul_i()
|
||||
- avcodec/msrle: Check that the input is large enough to contain a end of picture code
|
||||
- avformat/ftp: return AVERROR_EOF for EOF
|
||||
- avcodec/libx264: remove FF_CODEC_CAP_INIT_THREADSAFE flag
|
||||
- avcodec/jpeg2000dec: Fix off by 1 error in JPEG2000_PGOD_CPRL handling
|
||||
- avcodec/mpeg4videodec: Fix typo in sprite delta check
|
||||
- avcodec/h264_cavlc: Check mb_skip_run
|
||||
- avcodec/ra144: Fix integer overflow in add_wav()
|
||||
- avformat/utils: Never store negative values in last_IP_duration
|
||||
- avformat/utils: Fix integer overflow in discontinuity check
|
||||
- Revert "avcodec/cbs_h264: silence errors about end_of_seq nalus"
|
||||
- avcodec/cbs: ensure user_data is padded for GBC parsing
|
||||
- avcodec/cbs: fix crash in sei_pic_timestamp
|
||||
- avcodec/cbs_h264: silence errors about end_of_seq nalus
|
||||
- avcodec/cuviddec: properly take deinterlacing and display delay into account for buffer_full check
|
||||
- avcodec/h2645_parse: skip NALUs with no content after stripping all the trailing zeros
|
||||
- configure: <fflib>_deps: validate, reduce sensitivity
|
||||
- configure: speed up check_deps()
|
||||
- configure: speed up print_enabled_components()
|
||||
- configure: speed up flatten_extralibs_wrapper()
|
||||
- avformat/utils: Fix potential integer overflow in extract_extradata()
|
||||
- avcodec/unary: Improve get_unary() docs
|
||||
- avcodec/gdv: Replace divisions by shifts in rescale()
|
||||
- avcodec/ac3dec: Fix shift signedness in mask creation
|
||||
- avcodec/eac3dec: Check that channel_map does not contain more than EAC3_MAX_CHANNELS
|
||||
- doc/examples/vaapi_transcode: Fix the typo
|
||||
- avcodec/dvdsubdec: Sanity check len in decode_rle()
|
||||
- avcodec/mpeg4videodec: Fix undefined shift in get_amv()
|
||||
- avcodec/zmbv: Check that the decompressed data size is correct
|
||||
- avcodec/zmbv: Update decomp_len in raw frames
|
||||
- avcodec/shorten: Fix bitstream end check in read_header()
|
||||
- avcodec/dvdsubdec: Avoid branch in decode_run_8bit()
|
||||
- avcodec/h264_refs: Document last if() in ff_h264_execute_ref_pic_marking()
|
||||
- avcodec/ra144: Fix undefined integer overflow in add_wav()
|
||||
- avcodec/indeo4: Check dimensions in decode_pic_hdr()
|
||||
- avformat/mov: Error on too large stsd entry counts.
|
||||
- examples: Fix use of AV_CODEC_FLAG_GLOBAL_HEADER
|
||||
- avcodec/hq_hqa: Check remaining input bits in hqa_decode_mb()
|
||||
- avcodec/vb: Check for end of bytestream before reading blocktype
|
||||
- avcodec/snowdec: Fix integer overflow with motion vector residual
|
||||
- avcodec/mpeg4videodec: Fix slice end detection in mpeg4_decode_studio_mb()
|
||||
- avformat/nsvdec: Do not parse multiple NSVf
|
||||
- avformat/dashdec: Fix strlen(rep_id_val) with it being NULL
|
||||
- avformat/mlvdec: read_string() received unsigned size, make the argument unsigned
|
||||
- avformat/rmdec: Fix EOF check in the stream loop in ivr_read_header()
|
||||
- avcodec/scpr: Check for min > max in decompress_p()
|
||||
- avcodec/shorten: Fix signed 32bit overflow in shift in shorten_decode_frame()
|
||||
- avcodec/shorten: Fix integer overflow in residual/LPC combination
|
||||
- avcodec/shorten: Check verbatim length
|
||||
- avcodec/mpegaudio_parser: Initialize poutbuf*
|
||||
- avcodec/aacpsdsp_template: Fix integer overflow in ps_stereo_interpolate_c()
|
||||
- avformat/flvenc: Check audio packet size
|
||||
- lavc/svq3: Fix regression decoding some files.
|
||||
- avcodec/mlp_parser: Check if synccode is within buffer
|
||||
- avcodec/qtrle: Check remaining bytestream in qtrle_decode_XYbpp()
|
||||
- avcodec/diracdec: Check bytes count in else branch in decode_lowdelay() too
|
||||
- avcodec/diracdec: Check slice numbers for overflows in relation to picture dimensions
|
||||
- avcodec/diracdec: Change frame_number to 64bit as its a 32bit from the bitstream and we also have a -1 special case
|
||||
- avcodec/dirac_dwt_template: Fix several integer overflows in horizontal_compose_daub97i()
|
||||
- avcodec/diracdec: Prevent integer overflow in intermediate in global_mv()
|
||||
- swresample/swresample: Fix input channel count in resample_first computation
|
||||
- avutil/pixfmt: Document chroma plane size for odd resolutions
|
||||
- lavf/libsmbclient: return AVERROR_EOF for EOF.
|
||||
- lavc/videotoolboxenc: Fix compilation on osx 10.10.5 Yosemite
|
||||
- avcodec/mediacodecdec: fix SEGV on modern nvidia decoders
|
||||
- avcodec/bitstream_filters: check the input argument of av_bsf_get_by_name() for NULL
|
||||
- avformat/librtmp: fix returning EOF from Read/Write
|
||||
- avcodec/videotoolboxenc: fix undefined behavior with rc_max_rate=0
|
||||
|
||||
|
||||
version 4.0.2:
|
||||
- avcodec/dvdsub_parser: Allocate input padding
|
||||
- avcodec/dvdsub_parser: Init output buf/size
|
||||
- avcodec/dirac_dwt_template: Fix signedness regression in interleave()
|
||||
- avformat/mov: Simplify last element computation in mov_estimate_video_delay()
|
||||
- avformat/mov: Break out of inner loop early in mov_estimate_video_delay()
|
||||
- avformat/mov: Eliminate variable buf_size from mov_estimate_video_delay()
|
||||
- avformat/mov: remove modulo operations from mov_estimate_video_delay()
|
||||
- avformat/movenc: Write version 2 of audio atom if channels is not known
|
||||
- swresample/arm: rename labels to fix xcode build error
|
||||
- avformat/movenc: Check input sample count
|
||||
- avcodec/mjpegdec: Check for odd progressive RGB
|
||||
- avcodec/vp8_parser: Do not leave data/size uninitialized
|
||||
- avformat/mms: Add missing chunksize check
|
||||
- avformat/pva: Check for EOF before retrying in read_part_of_packet()
|
||||
- avformat/rmdec: Do not pass mime type in rm_read_multi() to ff_rm_read_mdpr_codecdata()
|
||||
- avformat/asfdec_o: Check size_bmp more fully
|
||||
- avformat/mxfdec: Fix av_log context
|
||||
- avcodec/mpeg4videodec: Check for bitstream end in read_quant_matrix_ext()
|
||||
- avcodec/indeo4: Check for end of bitstream in decode_mb_info()
|
||||
- avcodec/ac3dec: Check channel_map index
|
||||
- avcodec/mpeg4videodec: Remove use of FF_PROFILE_MPEG4_SIMPLE_STUDIO as indicator of studio profile
|
||||
- avcodec/shorten: Fix undefined addition in shorten_decode_frame()
|
||||
- avcodec/shorten: Fix undefined integer overflow
|
||||
- avcodec/jpeg2000dec: Fixes invalid shifts in jpeg2000_decode_packets_po_iteration()
|
||||
- avcodec/jpeg2000dec: Check that there are enough bytes for all tiles
|
||||
- avformat/movenc: Use mov->fc consistently for av_log()
|
||||
- avcodec/mpeg4videodec: Check read profile before setting it
|
||||
- avformat/movenc: Do not pass AVCodecParameters in avpriv_request_sample
|
||||
- avcodec/ac3_parser: Check init_get_bits8() for failure
|
||||
- avformat/movenc: Check that frame_types other than EAC3_FRAME_TYPE_INDEPENDENT have a supported substream id
|
||||
- avcodec/dpx: Check elements in 12bps planar path
|
||||
- avcodec/escape124: Fix spelling errors in comment
|
||||
- avcodec/ra144: Fix integer overflow in ff_eval_refl()
|
||||
- avcodec/cscd: Check output buffer size for lzo.
|
||||
- avcodec/escape124: Check buf_size against num_superblocks
|
||||
- avcodec/h264_parser: Reduce needed history for parsing mb index
|
||||
- avcodec/magicyuv: Check bits left in flags&1 branch
|
||||
- avcodec/mjpegdec: Check for end of bitstream in ljpeg_decode_rgb_scan()
|
||||
- ffmpeg: fix -stream_loop with multiple inputs
|
||||
- ffmpeg: factorize input thread creation and destruction
|
||||
- avformat/mpegts: parse large PMTs with multiple tables
|
||||
- Revert "avcodec/mediacodecdec: wait on first frame after input buffers are full"
|
||||
- avcodec/videotoolboxenc: fix invalid session on iOS
|
||||
- avcodec/videotoolboxenc: split initialization
|
||||
- avcodec/videotoolboxenc: fix mutex/cond leak in error path
|
||||
|
||||
version 4.0.1:
|
||||
- avcodec/aacdec_fixed: Fix undefined integer overflow in apply_independent_coupling_fixed()
|
||||
- avcodec/dirac_dwt_template: Fix undefined behavior in interleave()
|
||||
- avutil/common: Fix undefined behavior in av_clip_uintp2_c()
|
||||
- fftools/ffmpeg: Fallback to duration if sample rate is unavailable
|
||||
- avformat/mov: Only set pkt->duration to non negative values
|
||||
- avcodec/mpeg4videodec: Clear bits_per_raw_sample if it has originated from a previous instance
|
||||
- avformat/movenc: fix recognization of cover image streams
|
||||
- avformat/movenc: properly handle cover image codecs
|
||||
- avcodec/h264_slice: Fix overflow in recovery_frame computation
|
||||
- avcodec/h264_ps: Move MAX_LOG2_MAX_FRAME_NUM to header so it can be used in h264_sei
|
||||
- avcodec/h264_mc_template: Only prefetch motion if the list is used.
|
||||
- avcodec/xwddec: Use ff_set_dimensions()
|
||||
- avcodec/wavpack: Fix overflow in adding tail
|
||||
- avcodec/shorten: Fix multiple integer overflows
|
||||
- avcodec/shorten: Fix undefined shift in fix_bitshift()
|
||||
- avcodec/shorten: Fix a negative left shift in shorten_decode_frame()
|
||||
- avcodec/shorten: Sanity check nmeans
|
||||
- avcodec/shorten: Check non COMM chunk len before skip in decode_aiff_header()
|
||||
- avcodec/mjpegdec: Fix integer overflow in ljpeg_decode_rgb_scan()
|
||||
- avcodec/truemotion2: Fix overflow in tm2_apply_deltas()
|
||||
- avcodec/opus_silk: Change silk_lsf2lpc() slightly toward silk/NLSF2A.c
|
||||
- avcodec/amrwbdec: Fix division by 0 in find_hb_gain()
|
||||
- avcodec/h263dec: Reinitialize idct context if it has not been setup for the active profile
|
||||
- avcodec/idctdsp: Clear idct/idct_add for studio profile
|
||||
- avformat/mov: replace a value error by clipping into valid range in mov_read_stsc()
|
||||
- avformat/bintext: Reduce detection for random .bin files as it more likely is not a multimedia related file
|
||||
- avformat/mov: Break out early if chunk_count is 0 in mov_build_index()
|
||||
- avcodec/fic: Avoid some magic numbers related to cursors
|
||||
- avcodec/mpeg4video: Detect reference studio streams as studio streams
|
||||
- avcodec/mpeg4videodec: Do not corrupt bits_per_raw_sample
|
||||
- avcodec/mpeg4videode: Eliminate out of loop VOP startcode reading for studio profile
|
||||
- avcodec/g2meet: ask for sample with overflowing RGB
|
||||
- avcodec/idctdsp: Transmit studio_profile to init instead of using AVCodecContext profile
|
||||
- avcodec/ac3dec: Check that the number of channels with dependant streams is valid
|
||||
- avcodec/ac3dec: Fix null pointer dereference in ac3_decode_frame()
|
||||
- avcodec/aacdec_fixed: use 64bit to avoid overflow in rounding in apply_dependent_coupling_fixed()
|
||||
- oavcodec/aacpsdsp_template: Use unsigned for hs0X to prevent undefined behavior
|
||||
- avcodec/g723_1dec: Clip bits2 in both directions
|
||||
- avcodec/mpeg4videoenc: Use 64 bit for times in mpeg4_encode_gop_header()
|
||||
- avcodec/mlpdec: Only change noise_type if the related fields are valid
|
||||
- indeo4: Decode all or nothing of a band header.
|
||||
- avcodec/ac3dec: Use frame_size if superframe_size is 0
|
||||
- avformat/mov: Only fail for STCO/STSC contradictions if both exist
|
||||
- avcodec/dirac_dwt: Fix integer overflow in COMPOSE_DD97iH0 / COMPOSE_DD137iL0
|
||||
- avcodec/fic: Check available input space for cursor
|
||||
- avcodec/mpeg4videodec: Check bps (VOL header) before VOP for studio profile
|
||||
- avcodec/g2meet: Check RGB upper limit
|
||||
- avcodec/jpeg2000dec: Fix undefined shift in the jpeg2000_decode_packets_po_iteration() CPRL case
|
||||
- avcodec/jpeg2000dec: Skip init for component in CPRL if nothing is to be done
|
||||
- avcodec/g2meet: Change order of operations to avoid undefined behavior
|
||||
- avcodec/flac_parser: Fix infinite loop
|
||||
- avcodec/mpeg4videodec: Split decode_studio_vol_header() out of decode_studiovisualobject()
|
||||
- avcodec/mpeg4videodec: Move decode_studiovisualobject() parsing in the branch for visual object parsing
|
||||
- avcodec/mpeg4video_parser: Avoid litteral 0x1B6, use named constant instead
|
||||
- avcodec/mpeg4video_parser: Fix incorrect spliting of MPEG-4 studio frames
|
||||
- avformat/m4vdec: Use the same constant names as libavcodec
|
||||
- avformat/m4vdec: Fix detection of raw MPEG-4 ES Studio
|
||||
- avcodec/wavpack: Fix integer overflow in DEC_MED() / INC_MED()
|
||||
- avcodec/wavpack: Fix integer overflow in wv_unpack_stereo()
|
||||
- avcodec/error_resilience: Fix integer overflow in filter181()
|
||||
- avcodec/h263dec: Check slice_ret in mspeg4 slice loop
|
||||
- avcodec/elsdec: Fix memleaks
|
||||
- avcodec/vc1_block: simplify ac_val computation
|
||||
- avcodec/ffv1enc: Check that the crc + version combination is supported
|
||||
- configure: The eac3_core bitstream filter needs the ac3 parser.
|
||||
- configure: fix arm inline asm checks
|
||||
- lavf/libssh: translate a read of 0 to EOF
|
||||
- ffprobe: fix SEGV when new streams are added
|
||||
- avformat/mpegts: fix incorrect indentation
|
||||
- avformat/mpegts: initialize section_buf to fix valgrind test failure
|
||||
- avformat/mpegts: reindent after last change
|
||||
- avformat/mpegts: parse sections with multiple tables
|
||||
- avformat/mpegts: clean up whitespace
|
||||
- avformat/mpegts: use MAX_SECTION_SIZE instead of hardcoded value
|
||||
- avformat/mpegts: skip non-PMT tids earlier
|
||||
- avcodec/mediacodecdec: add workaround for buggy amlogic mpeg2 decoder
|
||||
- avcodec/mediacodecdec: wait on first frame after input buffers are full
|
||||
- avcodec/mediacodecdec: restructure mediacodec_receive_frame
|
||||
- avcodec/mediacodec_wrapper: add helper to fetch SDK_INT
|
||||
- avcodec/mediacodecdec: refactor pts handling
|
||||
- avcodec/mediacodecdec: use AV_TIME_BASE_Q
|
||||
- avcodec/mediacodecdec: clarify delay_flush specific code
|
||||
- avcodec/videotoolbox: fix decoding of some HEVC videos
|
||||
- avcodec/hevc: remove videotoolbox hack
|
||||
- avcodec/videotoolbox: split h264/hevc callbacks
|
||||
- avcodec/videotoolbox: cleanups
|
||||
- avcodec/videotoolbox: fix kVTCouldNotFindVideoDecoderErr trying to decode HEVC on iOS
|
||||
- avcodec/videotoolbox: improve logging of decoder errors
|
||||
- avcodec/xwddec: fix palette alpha
|
||||
- avformat/webm_chunk: always use a static buffer for get_chunk_filename
|
||||
- configure: fix configure check for lilv-0
|
||||
- avcodec/nvdec_hevc: fix scaling lists
|
||||
- avcodec/hevcdec: make ff_hevc_frame_nb_refs take a const pointer
|
||||
- lavf/bluray: translate a read of 0 to EOF
|
||||
- lavf/dashenc: don't call flush_init_segment before avformat_write_header
|
||||
- avdevice/decklink_dec: unref packets on avpacket_queue_put error
|
||||
- avcodec/hnm4video: fix palette alpha
|
||||
- avcodec/anm: fix palette alpha
|
||||
- avformat/qtpalette: parse color table according to the QuickTime file format specs
|
||||
- ffplay: Fix realloc_texture when input texture is NULL.
|
||||
- hwcontext_vaapi: Fix compilation with libva versions < 1.4.0
|
||||
- lavf/qsv: clone the frame which may be managed by framework
|
||||
- lavf: make overlay_qsv work based on framesync
|
||||
- avformat/segafilm - revert keyframe detection
|
||||
- avformat/utils: refactor upstream_stream_timings
|
||||
- avformat/utils: ignore outlier durations on subtitle/data streams as well
|
||||
|
||||
|
||||
version 4.0:
|
||||
version <next>:
|
||||
- Bitstream filters for editing metadata in H.264, HEVC and MPEG-2 streams
|
||||
- Dropped support for OpenJPEG versions 2.0 and below. Using OpenJPEG now
|
||||
requires 2.1 (or later) and pkg-config.
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
|
||||
┌───────────────────────────────────┐
|
||||
│ RELEASE NOTES for FFmpeg 4.0 "Wu" │
|
||||
└───────────────────────────────────┘
|
||||
|
||||
The FFmpeg Project proudly presents FFmpeg 4.0 "Wu", about 6
|
||||
months after the release of FFmpeg 3.4.
|
||||
|
||||
A complete Changelog is available at the root of the project, and the
|
||||
complete Git history on https://git.ffmpeg.org/gitweb/ffmpeg.git
|
||||
|
||||
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.
|
||||
@@ -668,10 +668,13 @@ disable_sanitized(){
|
||||
do_enable_deep(){
|
||||
for var; do
|
||||
enabled $var && continue
|
||||
set -- $var
|
||||
eval enable_deep \$${var}_select
|
||||
var=$1
|
||||
eval enable_deep_weak \$${var}_suggest
|
||||
eval sel="\$${var}_select"
|
||||
eval sgs="\$${var}_suggest"
|
||||
pushvar var sgs
|
||||
enable_deep $sel
|
||||
popvar sgs
|
||||
enable_deep_weak $sgs
|
||||
popvar var
|
||||
done
|
||||
}
|
||||
|
||||
@@ -683,9 +686,9 @@ enable_deep(){
|
||||
enable_deep_weak(){
|
||||
for var; do
|
||||
disabled $var && continue
|
||||
set -- $var
|
||||
pushvar var
|
||||
do_enable_deep $var
|
||||
var=$1
|
||||
popvar var
|
||||
enable_weak $var
|
||||
done
|
||||
}
|
||||
@@ -745,49 +748,40 @@ is_in(){
|
||||
return 1
|
||||
}
|
||||
|
||||
# The cfg loop is very hot (several thousands iterations), and in bash also
|
||||
# potentialy quite slow. Try to abort the iterations early, preferably without
|
||||
# calling functions. 70%+ of the time cfg is already done or without deps.
|
||||
check_deps(){
|
||||
for cfg; do
|
||||
eval [ x\$${cfg}_checking = xdone ] && continue
|
||||
eval [ x\$${cfg}_checking = xinprogress ] && die "Circular dependency for $cfg."
|
||||
enabled ${cfg}_checking && die "Circular dependency for $cfg."
|
||||
disabled ${cfg}_checking && continue
|
||||
enable ${cfg}_checking
|
||||
|
||||
eval "
|
||||
dep_all=\$${cfg}_deps
|
||||
dep_any=\$${cfg}_deps_any
|
||||
dep_con=\$${cfg}_conflict
|
||||
dep_sel=\$${cfg}_select
|
||||
dep_sgs=\$${cfg}_suggest
|
||||
dep_ifa=\$${cfg}_if
|
||||
dep_ifn=\$${cfg}_if_any
|
||||
"
|
||||
eval dep_all="\$${cfg}_deps"
|
||||
eval dep_any="\$${cfg}_deps_any"
|
||||
eval dep_con="\$${cfg}_conflict"
|
||||
eval dep_sel="\$${cfg}_select"
|
||||
eval dep_sgs="\$${cfg}_suggest"
|
||||
eval dep_ifa="\$${cfg}_if"
|
||||
eval dep_ifn="\$${cfg}_if_any"
|
||||
|
||||
# most of the time here $cfg has no deps - avoid costly no-op work
|
||||
if [ "$dep_all$dep_any$dep_con$dep_sel$dep_sgs$dep_ifa$dep_ifn" ]; then
|
||||
eval ${cfg}_checking=inprogress
|
||||
pushvar cfg dep_all dep_any dep_con dep_sel dep_sgs dep_ifa dep_ifn
|
||||
check_deps $dep_all $dep_any $dep_con $dep_sel $dep_sgs $dep_ifa $dep_ifn
|
||||
popvar cfg dep_all dep_any dep_con dep_sel dep_sgs dep_ifa dep_ifn
|
||||
|
||||
set -- $cfg "$dep_all" "$dep_any" "$dep_con" "$dep_sel" "$dep_sgs" "$dep_ifa" "$dep_ifn"
|
||||
check_deps $dep_all $dep_any $dep_con $dep_sel $dep_sgs $dep_ifa $dep_ifn
|
||||
cfg=$1; dep_all=$2; dep_any=$3; dep_con=$4; dep_sel=$5 dep_sgs=$6; dep_ifa=$7; dep_ifn=$8
|
||||
[ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
|
||||
[ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
|
||||
enabled_all $dep_all || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but not all dependencies are satisfied: $dep_all"; }
|
||||
enabled_any $dep_any || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but not any dependency is satisfied: $dep_any"; }
|
||||
disabled_all $dep_con || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but some conflicting dependencies are unsatisfied: $dep_con"; }
|
||||
disabled_any $dep_sel && { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but some selected dependency is unsatisfied: $dep_sel"; }
|
||||
|
||||
[ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
|
||||
[ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
|
||||
enabled_all $dep_all || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but not all dependencies are satisfied: $dep_all"; }
|
||||
enabled_any $dep_any || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but not any dependency is satisfied: $dep_any"; }
|
||||
disabled_all $dep_con || { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but some conflicting dependencies are unsatisfied: $dep_con"; }
|
||||
disabled_any $dep_sel && { disable $cfg && requested $cfg && die "ERROR: $cfg requested, but some selected dependency is unsatisfied: $dep_sel"; }
|
||||
enabled $cfg && enable_deep_weak $dep_sel $dep_sgs
|
||||
|
||||
enabled $cfg && enable_deep_weak $dep_sel $dep_sgs
|
||||
for dep in $dep_all $dep_any $dep_sel $dep_sgs; do
|
||||
# filter out library deps, these do not belong in extralibs
|
||||
is_in $dep $LIBRARY_LIST && continue
|
||||
enabled $dep && eval append ${cfg}_extralibs ${dep}_extralibs
|
||||
done
|
||||
|
||||
for dep in $dep_all $dep_any $dep_sel $dep_sgs; do
|
||||
# filter out library deps, these do not belong in extralibs
|
||||
is_in $dep $LIBRARY_LIST && continue
|
||||
enabled $dep && eval append ${cfg}_extralibs ${dep}_extralibs
|
||||
done
|
||||
fi
|
||||
|
||||
eval ${cfg}_checking=done
|
||||
disable ${cfg}_checking
|
||||
done
|
||||
}
|
||||
|
||||
@@ -842,37 +836,22 @@ prepend(){
|
||||
eval "$var=\"$* \$$var\""
|
||||
}
|
||||
|
||||
reverse () {
|
||||
eval '
|
||||
reverse_out=
|
||||
for v in $'$1'; do
|
||||
reverse_out="$v $reverse_out"
|
||||
done
|
||||
'$1'=$reverse_out
|
||||
'
|
||||
}
|
||||
|
||||
# keeps the last occurence of each non-unique item
|
||||
unique(){
|
||||
unique_out=
|
||||
eval unique_in=\$$1
|
||||
reverse unique_in
|
||||
for v in $unique_in; do
|
||||
# " $unique_out" +space such that every item is surrounded with spaces
|
||||
case " $unique_out" in *" $v "*) continue; esac # already in list
|
||||
unique_out="$unique_out$v "
|
||||
var=$1
|
||||
uniq_list=""
|
||||
for tok in $(eval echo \$$var); do
|
||||
uniq_list="$(filter_out $tok $uniq_list) $tok"
|
||||
done
|
||||
reverse unique_out
|
||||
eval $1=\$unique_out
|
||||
eval "$var=\"${uniq_list}\""
|
||||
}
|
||||
|
||||
resolve(){
|
||||
resolve_out=
|
||||
eval resolve_in=\$$1
|
||||
for v in $resolve_in; do
|
||||
eval 'resolve_out="$resolve_out$'$v' "'
|
||||
var=$1
|
||||
tmpvar=
|
||||
for entry in $(eval echo \$$var); do
|
||||
tmpvar="$tmpvar $(eval echo \$${entry})"
|
||||
done
|
||||
eval $1=\$resolve_out
|
||||
eval "$var=\"${tmpvar}\""
|
||||
}
|
||||
|
||||
add_cppflags(){
|
||||
@@ -1057,7 +1036,7 @@ EOF
|
||||
|
||||
check_insn(){
|
||||
log check_insn "$@"
|
||||
check_inline_asm ${1}_inline "\"$2\""
|
||||
check_inline_asm ${1}_inline "$2"
|
||||
check_as ${1}_external "$2"
|
||||
}
|
||||
|
||||
@@ -1805,17 +1784,16 @@ FEATURE_LIST="
|
||||
swscale_alpha
|
||||
"
|
||||
|
||||
# this list should be kept in linking order
|
||||
LIBRARY_LIST="
|
||||
avcodec
|
||||
avdevice
|
||||
avfilter
|
||||
swscale
|
||||
postproc
|
||||
avformat
|
||||
avcodec
|
||||
swresample
|
||||
avresample
|
||||
avutil
|
||||
postproc
|
||||
swresample
|
||||
swscale
|
||||
"
|
||||
|
||||
LICENSE_LIST="
|
||||
@@ -2394,7 +2372,6 @@ CMDLINE_SET="
|
||||
malloc_prefix
|
||||
nm
|
||||
optflags
|
||||
nvcc
|
||||
nvccflags
|
||||
pkg_config
|
||||
pkg_config_flags
|
||||
@@ -3001,7 +2978,6 @@ vc1_parser_select="vc1dsp"
|
||||
|
||||
# bitstream_filters
|
||||
aac_adtstoasc_bsf_select="adts_header"
|
||||
eac3_core_bsf_select="ac3_parser"
|
||||
filter_units_bsf_select="cbs"
|
||||
h264_metadata_bsf_deps="const_nan"
|
||||
h264_metadata_bsf_select="cbs_h264"
|
||||
@@ -3457,7 +3433,7 @@ vaapi_transcode_example_deps="avcodec avformat avutil h264_vaapi_encoder"
|
||||
cpu_init_extralibs="pthreads_extralibs"
|
||||
cws2fws_extralibs="zlib_extralibs"
|
||||
|
||||
# libraries, in any order
|
||||
# libraries, in linking order
|
||||
avcodec_deps="avutil"
|
||||
avcodec_suggest="libm"
|
||||
avcodec_select="null_bsf"
|
||||
@@ -4434,7 +4410,7 @@ probe_cc(){
|
||||
_flags_filter=msvc_flags
|
||||
_ld_lib='lib%.a'
|
||||
_ld_path='-libpath:'
|
||||
elif $_cc -nologo- 2>&1 | grep -q Microsoft || { $_cc -v 2>&1 | grep -q clang && $_cc -? > /dev/null 2>&1; }; then
|
||||
elif $_cc -nologo- 2>&1 | grep -q Microsoft || $_cc -v 2>&1 | grep -q clang && $_cc -? > /dev/null 2>&1; then
|
||||
_type=msvc
|
||||
_ident=$($_cc 2>&1 | head -n1 | tr -d '\r')
|
||||
_DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
|
||||
@@ -5852,8 +5828,7 @@ check_header asm/types.h
|
||||
check_builtin stdatomic stdatomic.h "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0); foo += bar"
|
||||
|
||||
check_lib advapi32 "windows.h" RegCloseKey -ladvapi32
|
||||
check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt &&
|
||||
check_cpp_condition bcrypt bcrypt.h "defined BCRYPT_RNG_ALGORITHM"
|
||||
check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt
|
||||
check_lib ole32 "windows.h" CoTaskMemFree -lole32
|
||||
check_lib shell32 "windows.h shellapi.h" CommandLineToArgvW -lshell32
|
||||
check_lib psapi "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
|
||||
@@ -5985,7 +5960,7 @@ enabled gnutls && require_pkg_config gnutls gnutls gnutls/gnutls.h gn
|
||||
enabled jni && { [ $target_os = "android" ] && check_header jni.h && enabled pthreads || die "ERROR: jni not found"; }
|
||||
enabled ladspa && require_header ladspa.h
|
||||
enabled libaom && require_pkg_config libaom "aom >= 0.1.0" aom/aom_codec.h aom_codec_version
|
||||
enabled lv2 && require_pkg_config lv2 lilv-0 "lilv/lilv.h" lilv_world_new
|
||||
enabled lv2 && require_pkg_config lv2 lilv-0 "lilv-0/lilv/lilv.h" lilv_world_new
|
||||
enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
|
||||
enabled libass && require_pkg_config libass libass ass/ass.h ass_library_init
|
||||
enabled libbluray && require_pkg_config libbluray libbluray libbluray/bluray.h bd_open
|
||||
@@ -6073,21 +6048,21 @@ enabled libvorbis && require_pkg_config libvorbis vorbis vorbis/codec.h
|
||||
enabled libvpx && {
|
||||
enabled libvpx_vp8_decoder && {
|
||||
check_pkg_config libvpx_vp8_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
|
||||
check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp8_dx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs" ||
|
||||
check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_dec_init_ver VPX_IMG_FMT_HIGHBITDEPTH" -lvpx ||
|
||||
die "ERROR: libvpx decoder version must be >=1.4.0";
|
||||
}
|
||||
enabled libvpx_vp8_encoder && {
|
||||
check_pkg_config libvpx_vp8_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
|
||||
check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp8_cx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs" ||
|
||||
check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_IMG_FMT_HIGHBITDEPTH" -lvpx ||
|
||||
die "ERROR: libvpx encoder version must be >=1.4.0";
|
||||
}
|
||||
enabled libvpx_vp9_decoder && {
|
||||
check_pkg_config libvpx_vp9_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
|
||||
check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs"
|
||||
check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs"
|
||||
}
|
||||
enabled libvpx_vp9_encoder && {
|
||||
check_pkg_config libvpx_vp9_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
|
||||
check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs"
|
||||
check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs"
|
||||
}
|
||||
if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder; then
|
||||
die "libvpx enabled but no supported decoders found"
|
||||
@@ -6704,19 +6679,14 @@ if test $target_os = "haiku"; then
|
||||
fi
|
||||
|
||||
flatten_extralibs(){
|
||||
nested_entries=
|
||||
unset nested_entries
|
||||
list_name=$1
|
||||
eval list=\$${1}
|
||||
for entry in $list; do
|
||||
entry_copy=$entry
|
||||
resolve entry_copy
|
||||
flat_entries=
|
||||
for e in $entry_copy; do
|
||||
case $e in
|
||||
*_extralibs) nested_entries="$nested_entries$e ";;
|
||||
*) flat_entries="$flat_entries$e ";;
|
||||
esac
|
||||
done
|
||||
append nested_entries $(filter '*_extralibs' $entry_copy)
|
||||
flat_entries=$(filter_out '*_extralibs' $entry_copy)
|
||||
eval $entry="\$flat_entries"
|
||||
done
|
||||
append $list_name "$nested_entries"
|
||||
@@ -6784,7 +6754,7 @@ done
|
||||
|
||||
enabled zlib && add_cppflags -DZLIB_CONST
|
||||
|
||||
# conditional library dependencies, in any order
|
||||
# conditional library dependencies, in linking order
|
||||
enabled afftfilt_filter && prepend avfilter_deps "avcodec"
|
||||
enabled afir_filter && prepend avfilter_deps "avcodec"
|
||||
enabled amovie_filter && prepend avfilter_deps "avformat avcodec"
|
||||
@@ -6826,36 +6796,11 @@ enabled sdl2_outdev && add_cflags $(filter_out '-Dmain=SDL_main' $sdl2_cflag
|
||||
|
||||
enabled opus_decoder && prepend avcodec_deps "swresample"
|
||||
|
||||
# reorder the items at var $1 to align with the items order at var $2 .
|
||||
# die if an item at $1 is not at $2 .
|
||||
reorder_by(){
|
||||
eval rb_in=\$$1
|
||||
eval rb_ordered=\$$2
|
||||
|
||||
for rb in $rb_in; do
|
||||
is_in $rb $rb_ordered || die "$rb at \$$1 is not at \$$2"
|
||||
done
|
||||
|
||||
rb_out=
|
||||
for rb in $rb_ordered; do
|
||||
is_in $rb $rb_in && rb_out="$rb_out$rb "
|
||||
done
|
||||
eval $1=\$rb_out
|
||||
}
|
||||
|
||||
# deps-expand fflib $1: N x {append all expanded deps; unique}
|
||||
# within a set of N items, N expansions are enough to expose a cycle.
|
||||
expand_deps(){
|
||||
unique ${1}_deps # required for the early break test.
|
||||
for dummy in $LIBRARY_LIST; do # N iteratios
|
||||
eval deps=\$${1}_deps
|
||||
append ${1}_deps $(map 'eval echo \$${v}_deps' $deps)
|
||||
unique ${1}_deps
|
||||
eval '[ ${#deps} = ${#'${1}_deps'} ]' && break # doesn't expand anymore
|
||||
done
|
||||
|
||||
eval is_in $1 \$${1}_deps && die "Dependency cycle at ${1}_deps"
|
||||
reorder_by ${1}_deps LIBRARY_LIST # linking order is expected later
|
||||
lib_deps=${1}_deps
|
||||
eval "deps=\$$lib_deps"
|
||||
append $lib_deps $(map 'eval echo \$${v}_deps' $deps)
|
||||
unique $lib_deps
|
||||
}
|
||||
|
||||
#we have to remove gpl from the deps here as some code assumes all lib deps are libs
|
||||
@@ -7155,7 +7100,7 @@ cat > $TMPH <<EOF
|
||||
#define FFMPEG_CONFIG_H
|
||||
#define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
|
||||
#define FFMPEG_LICENSE "$(c_escape $license)"
|
||||
#define CONFIG_THIS_YEAR 2019
|
||||
#define CONFIG_THIS_YEAR 2018
|
||||
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
|
||||
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
|
||||
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
|
||||
@@ -7216,10 +7161,9 @@ echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
|
||||
|
||||
cp_if_changed $TMPH libavutil/avconfig.h
|
||||
|
||||
# full_filter_name_foo=vf_foo
|
||||
# full_filter_name_bar=asrc_bar
|
||||
# ...
|
||||
eval "$(sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_\(.*\);/full_filter_name_\2=\1_\2/p" $source_path/libavfilter/allfilters.c)"
|
||||
full_filter_name(){
|
||||
sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_$1;/\1_$1/p" $source_path/libavfilter/allfilters.c
|
||||
}
|
||||
|
||||
# generate the lists of enabled components
|
||||
print_enabled_components(){
|
||||
@@ -7232,13 +7176,13 @@ print_enabled_components(){
|
||||
if enabled $c; then
|
||||
case $name in
|
||||
filter_list)
|
||||
eval c=\$full_filter_name_${c%_filter}
|
||||
c=$(full_filter_name $(remove_suffix _filter $c))
|
||||
;;
|
||||
indev_list)
|
||||
c=${c%_indev}_demuxer
|
||||
c=$(add_suffix _demuxer $(remove_suffix _indev $c))
|
||||
;;
|
||||
outdev_list)
|
||||
c=${c%_outdev}_muxer
|
||||
c=$(add_suffix _muxer $(remove_suffix _outdev $c))
|
||||
;;
|
||||
esac
|
||||
printf " &ff_%s,\n" $c >> $TMPH
|
||||
|
||||
+2
-2
@@ -889,7 +889,7 @@ API changes, most recent first:
|
||||
Add av_opt_get_dict_val/set_dict_val with AV_OPT_TYPE_DICT to support
|
||||
dictionary types being set as options.
|
||||
|
||||
2014-08-13 - afbd4b7e09 - lavf 56.01.0 - avformat.h
|
||||
2014-08-13 - afbd4b8 - lavf 56.01.0 - avformat.h
|
||||
Add AVFormatContext.event_flags and AVStream.event_flags for signaling to
|
||||
the user when events happen in the file/stream.
|
||||
|
||||
@@ -906,7 +906,7 @@ API changes, most recent first:
|
||||
2014-08-08 - 5c3c671 - lavf 55.53.100 - avio.h
|
||||
Add avio_feof() and deprecate url_feof().
|
||||
|
||||
2014-08-07 - bb789016d4 - lsws 2.1.3 - swscale.h
|
||||
2014-08-07 - bb78903 - lsws 2.1.3 - swscale.h
|
||||
sws_getContext is not going to be removed in the future.
|
||||
|
||||
2014-08-07 - a561662 / ad1ee5f - lavc 55.73.101 / 55.57.3 - avcodec.h
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 4.0.4
|
||||
PROJECT_NUMBER =
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
||||
@@ -172,9 +172,6 @@ static int open_output_file(const char *filename)
|
||||
enc_ctx->time_base = (AVRational){1, enc_ctx->sample_rate};
|
||||
}
|
||||
|
||||
if (ofmt_ctx->oformat->flags & AVFMT_GLOBALHEADER)
|
||||
enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
||||
|
||||
/* Third parameter can be used to pass settings to encoder */
|
||||
ret = avcodec_open2(enc_ctx, encoder, NULL);
|
||||
if (ret < 0) {
|
||||
@@ -186,6 +183,8 @@ static int open_output_file(const char *filename)
|
||||
av_log(NULL, AV_LOG_ERROR, "Failed to copy encoder parameters to output stream #%u\n", i);
|
||||
return ret;
|
||||
}
|
||||
if (ofmt_ctx->oformat->flags & AVFMT_GLOBALHEADER)
|
||||
enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
||||
|
||||
out_stream->time_base = enc_ctx->time_base;
|
||||
stream_ctx[i].enc_ctx = enc_ctx;
|
||||
|
||||
@@ -177,7 +177,7 @@ static int dec_enc(AVPacket *pkt, AVCodec *enc_codec)
|
||||
}
|
||||
/* set AVCodecContext Parameters for encoder, here we keep them stay
|
||||
* the same as decoder.
|
||||
* xxx: now the sample can't handle resolution change case.
|
||||
* xxx: now the the sample can't handle resolution change case.
|
||||
*/
|
||||
encoder_ctx->time_base = av_inv_q(decoder_ctx->framerate);
|
||||
encoder_ctx->pix_fmt = AV_PIX_FMT_VAAPI;
|
||||
|
||||
+32
-62
@@ -2121,6 +2121,9 @@ static int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame)
|
||||
|
||||
/* determine if the parameters for this input changed */
|
||||
need_reinit = ifilter->format != frame->format;
|
||||
if (!!ifilter->hw_frames_ctx != !!frame->hw_frames_ctx ||
|
||||
(ifilter->hw_frames_ctx && ifilter->hw_frames_ctx->data != frame->hw_frames_ctx->data))
|
||||
need_reinit = 1;
|
||||
|
||||
switch (ifilter->ist->st->codecpar->codec_type) {
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
@@ -2134,13 +2137,6 @@ static int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!ifilter->ist->reinit_filters && fg->graph)
|
||||
need_reinit = 0;
|
||||
|
||||
if (!!ifilter->hw_frames_ctx != !!frame->hw_frames_ctx ||
|
||||
(ifilter->hw_frames_ctx && ifilter->hw_frames_ctx->data != frame->hw_frames_ctx->data))
|
||||
need_reinit = 1;
|
||||
|
||||
if (need_reinit) {
|
||||
ret = ifilter_parameters_from_frame(ifilter, frame);
|
||||
if (ret < 0)
|
||||
@@ -2700,12 +2696,8 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo
|
||||
ist->dts = ist->next_dts;
|
||||
switch (ist->dec_ctx->codec_type) {
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
if (ist->dec_ctx->sample_rate) {
|
||||
ist->next_dts += ((int64_t)AV_TIME_BASE * ist->dec_ctx->frame_size) /
|
||||
ist->dec_ctx->sample_rate;
|
||||
} else {
|
||||
ist->next_dts += av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q);
|
||||
}
|
||||
ist->next_dts += ((int64_t)AV_TIME_BASE * ist->dec_ctx->frame_size) /
|
||||
ist->dec_ctx->sample_rate;
|
||||
break;
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
if (ist->framerate.num) {
|
||||
@@ -4019,63 +4011,49 @@ static void *input_thread(void *arg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void free_input_thread(int i)
|
||||
{
|
||||
InputFile *f = input_files[i];
|
||||
AVPacket pkt;
|
||||
|
||||
if (!f || !f->in_thread_queue)
|
||||
return;
|
||||
av_thread_message_queue_set_err_send(f->in_thread_queue, AVERROR_EOF);
|
||||
while (av_thread_message_queue_recv(f->in_thread_queue, &pkt, 0) >= 0)
|
||||
av_packet_unref(&pkt);
|
||||
|
||||
pthread_join(f->thread, NULL);
|
||||
f->joined = 1;
|
||||
av_thread_message_queue_free(&f->in_thread_queue);
|
||||
}
|
||||
|
||||
static void free_input_threads(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nb_input_files; i++)
|
||||
free_input_thread(i);
|
||||
}
|
||||
for (i = 0; i < nb_input_files; i++) {
|
||||
InputFile *f = input_files[i];
|
||||
AVPacket pkt;
|
||||
|
||||
static int init_input_thread(int i)
|
||||
{
|
||||
int ret;
|
||||
InputFile *f = input_files[i];
|
||||
if (!f || !f->in_thread_queue)
|
||||
continue;
|
||||
av_thread_message_queue_set_err_send(f->in_thread_queue, AVERROR_EOF);
|
||||
while (av_thread_message_queue_recv(f->in_thread_queue, &pkt, 0) >= 0)
|
||||
av_packet_unref(&pkt);
|
||||
|
||||
if (nb_input_files == 1)
|
||||
return 0;
|
||||
|
||||
if (f->ctx->pb ? !f->ctx->pb->seekable :
|
||||
strcmp(f->ctx->iformat->name, "lavfi"))
|
||||
f->non_blocking = 1;
|
||||
ret = av_thread_message_queue_alloc(&f->in_thread_queue,
|
||||
f->thread_queue_size, sizeof(AVPacket));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if ((ret = pthread_create(&f->thread, NULL, input_thread, f))) {
|
||||
av_log(NULL, AV_LOG_ERROR, "pthread_create failed: %s. Try to increase `ulimit -v` or decrease `ulimit -s`.\n", strerror(ret));
|
||||
pthread_join(f->thread, NULL);
|
||||
f->joined = 1;
|
||||
av_thread_message_queue_free(&f->in_thread_queue);
|
||||
return AVERROR(ret);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int init_input_threads(void)
|
||||
{
|
||||
int i, ret;
|
||||
|
||||
if (nb_input_files == 1)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < nb_input_files; i++) {
|
||||
ret = init_input_thread(i);
|
||||
InputFile *f = input_files[i];
|
||||
|
||||
if (f->ctx->pb ? !f->ctx->pb->seekable :
|
||||
strcmp(f->ctx->iformat->name, "lavfi"))
|
||||
f->non_blocking = 1;
|
||||
ret = av_thread_message_queue_alloc(&f->in_thread_queue,
|
||||
f->thread_queue_size, sizeof(AVPacket));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if ((ret = pthread_create(&f->thread, NULL, input_thread, f))) {
|
||||
av_log(NULL, AV_LOG_ERROR, "pthread_create failed: %s. Try to increase `ulimit -v` or decrease `ulimit -s`.\n", strerror(ret));
|
||||
av_thread_message_queue_free(&f->in_thread_queue);
|
||||
return AVERROR(ret);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -4217,7 +4195,7 @@ static int process_input(int file_index)
|
||||
AVFormatContext *is;
|
||||
InputStream *ist;
|
||||
AVPacket pkt;
|
||||
int ret, thread_ret, i, j;
|
||||
int ret, i, j;
|
||||
int64_t duration;
|
||||
int64_t pkt_dts;
|
||||
|
||||
@@ -4240,15 +4218,7 @@ static int process_input(int file_index)
|
||||
avcodec_flush_buffers(avctx);
|
||||
}
|
||||
}
|
||||
#if HAVE_THREADS
|
||||
free_input_thread(file_index);
|
||||
#endif
|
||||
ret = seek_to_start(ifile, is);
|
||||
#if HAVE_THREADS
|
||||
thread_ret = init_input_thread(file_index);
|
||||
if (thread_ret < 0)
|
||||
return thread_ret;
|
||||
#endif
|
||||
if (ret < 0)
|
||||
av_log(NULL, AV_LOG_WARNING, "Seek to start failed.\n");
|
||||
else
|
||||
|
||||
+2
-3
@@ -834,11 +834,10 @@ static int realloc_texture(SDL_Texture **texture, Uint32 new_format, int new_wid
|
||||
{
|
||||
Uint32 format;
|
||||
int access, w, h;
|
||||
if (!*texture || SDL_QueryTexture(*texture, &format, &access, &w, &h) < 0 || new_width != w || new_height != h || new_format != format) {
|
||||
if (SDL_QueryTexture(*texture, &format, &access, &w, &h) < 0 || new_width != w || new_height != h || new_format != format) {
|
||||
void *pixels;
|
||||
int pitch;
|
||||
if (*texture)
|
||||
SDL_DestroyTexture(*texture);
|
||||
SDL_DestroyTexture(*texture);
|
||||
if (!(*texture = SDL_CreateTexture(renderer, new_format, SDL_TEXTUREACCESS_STREAMING, new_width, new_height)))
|
||||
return -1;
|
||||
if (SDL_SetTextureBlendMode(*texture, blendmode) < 0)
|
||||
|
||||
+3
-3
@@ -2371,11 +2371,11 @@ static int read_interval_packets(WriterContext *w, InputFile *ifile,
|
||||
goto end;
|
||||
}
|
||||
while (!av_read_frame(fmt_ctx, &pkt)) {
|
||||
if (fmt_ctx->nb_streams > nb_streams) {
|
||||
if (ifile->nb_streams > nb_streams) {
|
||||
REALLOCZ_ARRAY_STREAM(nb_streams_frames, nb_streams, fmt_ctx->nb_streams);
|
||||
REALLOCZ_ARRAY_STREAM(nb_streams_packets, nb_streams, fmt_ctx->nb_streams);
|
||||
REALLOCZ_ARRAY_STREAM(selected_streams, nb_streams, fmt_ctx->nb_streams);
|
||||
nb_streams = fmt_ctx->nb_streams;
|
||||
nb_streams = ifile->nb_streams;
|
||||
}
|
||||
if (selected_streams[pkt.stream_index]) {
|
||||
AVRational tb = ifile->streams[pkt.stream_index].st->time_base;
|
||||
@@ -2521,7 +2521,7 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
|
||||
#endif
|
||||
print_int("has_b_frames", par->video_delay);
|
||||
sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL);
|
||||
if (sar.num) {
|
||||
if (sar.den) {
|
||||
print_q("sample_aspect_ratio", sar, ':');
|
||||
av_reduce(&dar.num, &dar.den,
|
||||
par->width * sar.num,
|
||||
|
||||
+2
-2
@@ -498,7 +498,7 @@ static int decode_i_block(FourXContext *f, int16_t *block)
|
||||
|
||||
if (get_bits_left(&f->gb) < 2){
|
||||
av_log(f->avctx, AV_LOG_ERROR, "%d bits left before decode_i_block()\n", get_bits_left(&f->gb));
|
||||
return AVERROR_INVALIDDATA;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* DC coef */
|
||||
@@ -732,7 +732,7 @@ static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length)
|
||||
for (x = 0; x < width; x += 16) {
|
||||
unsigned int color[4] = { 0 }, bits;
|
||||
if (buf_end - buf < 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
return -1;
|
||||
// warning following is purely guessed ...
|
||||
color[0] = bytestream2_get_le16u(&g3);
|
||||
color[1] = bytestream2_get_le16u(&g3);
|
||||
|
||||
@@ -385,7 +385,7 @@ static void apply_dependent_coupling_fixed(AACContext *ac,
|
||||
for (k = offsets[i]; k < offsets[i + 1]; k++) {
|
||||
tmp = (int)(((int64_t)src[group * 128 + k] * c + \
|
||||
(int64_t)0x1000000000) >> 37);
|
||||
dest[group * 128 + k] += (tmp + (int64_t)round) >> shift;
|
||||
dest[group * 128 + k] += (tmp + round) >> shift;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -436,7 +436,7 @@ static void apply_independent_coupling_fixed(AACContext *ac,
|
||||
else {
|
||||
for (i = 0; i < len; i++) {
|
||||
tmp = (int)(((int64_t)src[i] * c + (int64_t)0x1000000000) >> 37);
|
||||
dest[i] += tmp * (1U << shift);
|
||||
dest[i] += tmp * (1 << shift);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,10 +150,10 @@ static void ps_stereo_interpolate_c(INTFLOAT (*l)[2], INTFLOAT (*r)[2],
|
||||
INTFLOAT h1 = h[0][1];
|
||||
INTFLOAT h2 = h[0][2];
|
||||
INTFLOAT h3 = h[0][3];
|
||||
UINTFLOAT hs0 = h_step[0][0];
|
||||
UINTFLOAT hs1 = h_step[0][1];
|
||||
UINTFLOAT hs2 = h_step[0][2];
|
||||
UINTFLOAT hs3 = h_step[0][3];
|
||||
INTFLOAT hs0 = h_step[0][0];
|
||||
INTFLOAT hs1 = h_step[0][1];
|
||||
INTFLOAT hs2 = h_step[0][2];
|
||||
INTFLOAT hs3 = h_step[0][3];
|
||||
int n;
|
||||
|
||||
for (n = 0; n < len; n++) {
|
||||
@@ -181,10 +181,10 @@ static void ps_stereo_interpolate_ipdopd_c(INTFLOAT (*l)[2], INTFLOAT (*r)[2],
|
||||
INTFLOAT h01 = h[0][1], h11 = h[1][1];
|
||||
INTFLOAT h02 = h[0][2], h12 = h[1][2];
|
||||
INTFLOAT h03 = h[0][3], h13 = h[1][3];
|
||||
UINTFLOAT hs00 = h_step[0][0], hs10 = h_step[1][0];
|
||||
UINTFLOAT hs01 = h_step[0][1], hs11 = h_step[1][1];
|
||||
UINTFLOAT hs02 = h_step[0][2], hs12 = h_step[1][2];
|
||||
UINTFLOAT hs03 = h_step[0][3], hs13 = h_step[1][3];
|
||||
INTFLOAT hs00 = h_step[0][0], hs10 = h_step[1][0];
|
||||
INTFLOAT hs01 = h_step[0][1], hs11 = h_step[1][1];
|
||||
INTFLOAT hs02 = h_step[0][2], hs12 = h_step[1][2];
|
||||
INTFLOAT hs03 = h_step[0][3], hs13 = h_step[1][3];
|
||||
int n;
|
||||
|
||||
for (n = 0; n < len; n++) {
|
||||
|
||||
@@ -162,9 +162,7 @@ int avpriv_ac3_parse_header(AC3HeaderInfo **phdr, const uint8_t *buf,
|
||||
return AVERROR(ENOMEM);
|
||||
hdr = *phdr;
|
||||
|
||||
err = init_get_bits8(&gb, buf, size);
|
||||
if (err < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
init_get_bits8(&gb, buf, size);
|
||||
err = ff_ac3_parse_header(&gb, hdr);
|
||||
if (err < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
+25
-23
@@ -106,6 +106,25 @@ static const uint8_t ac3_default_coeffs[8][5][2] = {
|
||||
{ { 2, 7 }, { 5, 5 }, { 7, 2 }, { 6, 7 }, { 7, 6 }, },
|
||||
};
|
||||
|
||||
static const uint64_t custom_channel_map_locations[16][2] = {
|
||||
{ 1, AV_CH_FRONT_LEFT },
|
||||
{ 1, AV_CH_FRONT_CENTER },
|
||||
{ 1, AV_CH_FRONT_RIGHT },
|
||||
{ 1, AV_CH_SIDE_LEFT },
|
||||
{ 1, AV_CH_SIDE_RIGHT },
|
||||
{ 0, AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER },
|
||||
{ 0, AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT },
|
||||
{ 0, AV_CH_BACK_CENTER },
|
||||
{ 0, AV_CH_TOP_CENTER },
|
||||
{ 0, AV_CH_SURROUND_DIRECT_LEFT | AV_CH_SURROUND_DIRECT_RIGHT },
|
||||
{ 0, AV_CH_WIDE_LEFT | AV_CH_WIDE_RIGHT },
|
||||
{ 0, AV_CH_TOP_FRONT_LEFT | AV_CH_TOP_FRONT_RIGHT},
|
||||
{ 0, AV_CH_TOP_FRONT_CENTER },
|
||||
{ 0, AV_CH_TOP_BACK_LEFT | AV_CH_TOP_BACK_RIGHT },
|
||||
{ 0, AV_CH_LOW_FREQUENCY_2 },
|
||||
{ 1, AV_CH_LOW_FREQUENCY },
|
||||
};
|
||||
|
||||
/**
|
||||
* Symmetrical Dequantization
|
||||
* reference: Section 7.3.3 Expansion of Mantissas for Symmetrical Quantization
|
||||
@@ -1671,7 +1690,6 @@ dependent_frame:
|
||||
|
||||
if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT) {
|
||||
uint64_t ich_layout = avpriv_ac3_channel_layout_tab[s->prev_output_mode & ~AC3_OUTPUT_LFEON];
|
||||
int channel_map_size = ff_ac3_channels_tab[s->output_mode & ~AC3_OUTPUT_LFEON] + s->lfe_on;
|
||||
uint64_t channel_layout;
|
||||
int extend = 0;
|
||||
|
||||
@@ -1681,41 +1699,30 @@ dependent_frame:
|
||||
channel_layout = ich_layout;
|
||||
for (ch = 0; ch < 16; ch++) {
|
||||
if (s->channel_map & (1 << (EAC3_MAX_CHANNELS - ch - 1))) {
|
||||
channel_layout |= ff_eac3_custom_channel_map_locations[ch][1];
|
||||
channel_layout |= custom_channel_map_locations[ch][1];
|
||||
}
|
||||
}
|
||||
if (av_get_channel_layout_nb_channels(channel_layout) > EAC3_MAX_CHANNELS) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Too many channels (%d) coded\n",
|
||||
av_get_channel_layout_nb_channels(channel_layout));
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
avctx->channel_layout = channel_layout;
|
||||
avctx->channels = av_get_channel_layout_nb_channels(channel_layout);
|
||||
|
||||
for (ch = 0; ch < EAC3_MAX_CHANNELS; ch++) {
|
||||
if (s->channel_map & (1 << (EAC3_MAX_CHANNELS - ch - 1))) {
|
||||
if (ff_eac3_custom_channel_map_locations[ch][0]) {
|
||||
if (custom_channel_map_locations[ch][0]) {
|
||||
int index = av_get_channel_layout_channel_index(channel_layout,
|
||||
ff_eac3_custom_channel_map_locations[ch][1]);
|
||||
custom_channel_map_locations[ch][1]);
|
||||
if (index < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (extend >= channel_map_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
extended_channel_map[index] = offset + channel_map[extend++];
|
||||
} else {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 64; i++) {
|
||||
if ((1ULL << i) & ff_eac3_custom_channel_map_locations[ch][1]) {
|
||||
if ((1LL << i) & custom_channel_map_locations[ch][1]) {
|
||||
int index = av_get_channel_layout_channel_index(channel_layout,
|
||||
1ULL << i);
|
||||
1LL << i);
|
||||
if (index < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (extend >= channel_map_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
extended_channel_map[index] = offset + channel_map[extend++];
|
||||
}
|
||||
}
|
||||
@@ -1731,9 +1738,7 @@ dependent_frame:
|
||||
|
||||
for (ch = 0; ch < avctx->channels; ch++) {
|
||||
int map = extended_channel_map[ch];
|
||||
av_assert0(ch>=AV_NUM_DATA_POINTERS || frame->extended_data[ch] == frame->data[ch]);
|
||||
memcpy((SHORTFLOAT *)frame->extended_data[ch],
|
||||
s->output_buffer[map],
|
||||
memcpy((SHORTFLOAT *)frame->data[ch], s->output_buffer[map],
|
||||
s->num_blocks * AC3_BLOCK_SIZE * sizeof(SHORTFLOAT));
|
||||
}
|
||||
|
||||
@@ -1795,9 +1800,6 @@ dependent_frame:
|
||||
|
||||
*got_frame_ptr = 1;
|
||||
|
||||
if (!s->superframe_size)
|
||||
return FFMIN(full_buf_size, s->frame_size);
|
||||
|
||||
return FFMIN(full_buf_size, s->superframe_size);
|
||||
}
|
||||
|
||||
|
||||
@@ -314,21 +314,3 @@ const uint16_t ff_eac3_default_chmap[8] = {
|
||||
AC3_CHMAP_L | AC3_CHMAP_R | AC3_CHMAP_L_SUR | AC3_CHMAP_R_SUR,
|
||||
AC3_CHMAP_L | AC3_CHMAP_C | AC3_CHMAP_R | AC3_CHMAP_L_SUR | AC3_CHMAP_R_SUR
|
||||
};
|
||||
const uint64_t ff_eac3_custom_channel_map_locations[16][2] = {
|
||||
{ 1, AV_CH_FRONT_LEFT },
|
||||
{ 1, AV_CH_FRONT_CENTER },
|
||||
{ 1, AV_CH_FRONT_RIGHT },
|
||||
{ 1, AV_CH_SIDE_LEFT },
|
||||
{ 1, AV_CH_SIDE_RIGHT },
|
||||
{ 0, AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER },
|
||||
{ 0, AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT },
|
||||
{ 0, AV_CH_BACK_CENTER },
|
||||
{ 0, AV_CH_TOP_CENTER },
|
||||
{ 0, AV_CH_SURROUND_DIRECT_LEFT | AV_CH_SURROUND_DIRECT_RIGHT },
|
||||
{ 0, AV_CH_WIDE_LEFT | AV_CH_WIDE_RIGHT },
|
||||
{ 0, AV_CH_TOP_FRONT_LEFT | AV_CH_TOP_FRONT_RIGHT},
|
||||
{ 0, AV_CH_TOP_FRONT_CENTER },
|
||||
{ 0, AV_CH_TOP_BACK_LEFT | AV_CH_TOP_BACK_RIGHT },
|
||||
{ 0, AV_CH_LOW_FREQUENCY_2 },
|
||||
{ 1, AV_CH_LOW_FREQUENCY },
|
||||
};
|
||||
|
||||
@@ -50,8 +50,6 @@ extern const uint16_t ff_ac3_fast_gain_tab[8];
|
||||
extern const uint16_t ff_eac3_default_chmap[8];
|
||||
extern const uint8_t ff_ac3_band_start_tab[AC3_CRITICAL_BANDS+1];
|
||||
extern const uint8_t ff_ac3_bin_to_band_tab[253];
|
||||
extern const uint64_t ff_eac3_custom_channel_map_locations[16][2];
|
||||
|
||||
|
||||
/** Custom channel map locations bitmask
|
||||
* Other channels described in documentation:
|
||||
|
||||
@@ -208,9 +208,6 @@ static int aic_decode_coeffs(GetBitContext *gb, int16_t *dst,
|
||||
int mb, idx;
|
||||
unsigned val;
|
||||
|
||||
if (get_bits_left(gb) < 5)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
has_skips = get_bits1(gb);
|
||||
coeff_type = get_bits1(gb);
|
||||
coeff_bits = get_bits(gb, 3);
|
||||
|
||||
@@ -862,20 +862,15 @@ static float find_hb_gain(AMRWBContext *ctx, const float *synth,
|
||||
{
|
||||
int wsp = (vad > 0);
|
||||
float tilt;
|
||||
float tmp;
|
||||
|
||||
if (ctx->fr_cur_mode == MODE_23k85)
|
||||
return qua_hb_gain[hb_idx] * (1.0f / (1 << 14));
|
||||
|
||||
tmp = ctx->celpm_ctx.dot_productf(synth, synth + 1, AMRWB_SFR_SIZE - 1);
|
||||
|
||||
if (tmp > 0) {
|
||||
tilt = tmp / ctx->celpm_ctx.dot_productf(synth, synth, AMRWB_SFR_SIZE);
|
||||
} else
|
||||
tilt = 0;
|
||||
tilt = ctx->celpm_ctx.dot_productf(synth, synth + 1, AMRWB_SFR_SIZE - 1) /
|
||||
ctx->celpm_ctx.dot_productf(synth, synth, AMRWB_SFR_SIZE);
|
||||
|
||||
/* return gain bounded by [0.1, 1.0] */
|
||||
return av_clipf((1.0 - tilt) * (1.25 - 0.25 * wsp), 0.1, 1.0);
|
||||
return av_clipf((1.0 - FFMAX(0.0, tilt)) * (1.25 - 0.25 * wsp), 0.1, 1.0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
|
||||
bytestream2_skipu(&s->gb, 16 * 8);
|
||||
for (i = 0; i < 256; i++)
|
||||
s->palette[i] = (0xFFU << 24) | bytestream2_get_le32u(&s->gb);
|
||||
s->palette[i] = bytestream2_get_le32u(&s->gb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1312,7 +1312,7 @@ enum AVPacketSideDataType {
|
||||
AV_PKT_DATA_METADATA_UPDATE,
|
||||
|
||||
/**
|
||||
* MPEGTS stream ID as uint8_t, this is required to pass the stream ID
|
||||
* MPEGTS stream ID, this is required to pass the stream ID
|
||||
* information from the demuxer to the corresponding muxer.
|
||||
*/
|
||||
AV_PKT_DATA_MPEGTS_STREAM_ID,
|
||||
|
||||
@@ -109,11 +109,6 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx,
|
||||
if(yoffset >= avctx->height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
dst += vid->frame->linesize[0] * yoffset;
|
||||
case VIDEO_P_FRAME:
|
||||
case VIDEO_I_FRAME:
|
||||
break;
|
||||
default:
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
// main code
|
||||
|
||||
@@ -77,9 +77,6 @@ const AVBitStreamFilter *av_bsf_get_by_name(const char *name)
|
||||
const AVBitStreamFilter *f = NULL;
|
||||
void *i = 0;
|
||||
|
||||
if (!name)
|
||||
return NULL;
|
||||
|
||||
while ((f = av_bsf_iterate(&i))) {
|
||||
if (!strcmp(f->name, name))
|
||||
return f;
|
||||
|
||||
+1
-4
@@ -291,7 +291,7 @@ static int bmp_decode_frame(AVCodecContext *avctx,
|
||||
case 1:
|
||||
for (i = 0; i < avctx->height; i++) {
|
||||
int j;
|
||||
for (j = 0; j < avctx->width >> 3; j++) {
|
||||
for (j = 0; j < n; j++) {
|
||||
ptr[j*8+0] = buf[j] >> 7;
|
||||
ptr[j*8+1] = (buf[j] >> 6) & 1;
|
||||
ptr[j*8+2] = (buf[j] >> 5) & 1;
|
||||
@@ -301,9 +301,6 @@ static int bmp_decode_frame(AVCodecContext *avctx,
|
||||
ptr[j*8+6] = (buf[j] >> 1) & 1;
|
||||
ptr[j*8+7] = buf[j] & 1;
|
||||
}
|
||||
for (j = 0; j < (avctx->width & 7); j++) {
|
||||
ptr[avctx->width - (avctx->width & 7) + j] = buf[avctx->width >> 3] >> (7 - j) & 1;
|
||||
}
|
||||
buf += n;
|
||||
ptr += linesize;
|
||||
}
|
||||
|
||||
+8
-21
@@ -591,21 +591,14 @@ static int decode_residual_block(AVSContext *h, GetBitContext *gb,
|
||||
}
|
||||
|
||||
|
||||
static inline int decode_residual_chroma(AVSContext *h)
|
||||
static inline void decode_residual_chroma(AVSContext *h)
|
||||
{
|
||||
if (h->cbp & (1 << 4)) {
|
||||
int ret = decode_residual_block(h, &h->gb, chroma_dec, 0,
|
||||
if (h->cbp & (1 << 4))
|
||||
decode_residual_block(h, &h->gb, chroma_dec, 0,
|
||||
ff_cavs_chroma_qp[h->qp], h->cu, h->c_stride);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
if (h->cbp & (1 << 5)) {
|
||||
int ret = decode_residual_block(h, &h->gb, chroma_dec, 0,
|
||||
if (h->cbp & (1 << 5))
|
||||
decode_residual_block(h, &h->gb, chroma_dec, 0,
|
||||
ff_cavs_chroma_qp[h->qp], h->cv, h->c_stride);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int decode_residual_inter(AVSContext *h)
|
||||
@@ -656,7 +649,6 @@ static int decode_mb_i(AVSContext *h, int cbp_code)
|
||||
uint8_t top[18];
|
||||
uint8_t *left = NULL;
|
||||
uint8_t *d;
|
||||
int ret;
|
||||
|
||||
ff_cavs_init_mb(h);
|
||||
|
||||
@@ -700,11 +692,8 @@ static int decode_mb_i(AVSContext *h, int cbp_code)
|
||||
ff_cavs_load_intra_pred_luma(h, top, &left, block);
|
||||
h->intra_pred_l[h->pred_mode_Y[scan3x3[block]]]
|
||||
(d, top, left, h->l_stride);
|
||||
if (h->cbp & (1<<block)) {
|
||||
ret = decode_residual_block(h, gb, intra_dec, 1, h->qp, d, h->l_stride);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
if (h->cbp & (1<<block))
|
||||
decode_residual_block(h, gb, intra_dec, 1, h->qp, d, h->l_stride);
|
||||
}
|
||||
|
||||
/* chroma intra prediction */
|
||||
@@ -714,9 +703,7 @@ static int decode_mb_i(AVSContext *h, int cbp_code)
|
||||
h->intra_pred_c[pred_mode_uv](h->cv, &h->top_border_v[h->mbx * 10],
|
||||
h->left_border_v, h->c_stride);
|
||||
|
||||
ret = decode_residual_chroma(h);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
decode_residual_chroma(h);
|
||||
ff_cavs_filter(h, I_8X8);
|
||||
set_mv_intra(h);
|
||||
return 0;
|
||||
|
||||
@@ -539,12 +539,6 @@ static int FUNC(sei_pic_timestamp)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
}
|
||||
|
||||
sps = h264->active_sps;
|
||||
if (!sps) {
|
||||
av_log(ctx->log_ctx, AV_LOG_ERROR,
|
||||
"No active SPS for pic_timestamp.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (sps->vui.nal_hrd_parameters_present_flag)
|
||||
time_offset_length = sps->vui.nal_hrd_parameters.time_offset_length;
|
||||
else if (sps->vui.vcl_hrd_parameters_present_flag)
|
||||
@@ -656,7 +650,7 @@ static int FUNC(sei_user_data_registered)(CodedBitstreamContext *ctx, RWContext
|
||||
*payload_size = i + current->data_length;
|
||||
#endif
|
||||
|
||||
allocate(current->data, current->data_length + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
allocate(current->data, current->data_length);
|
||||
for (j = 0; j < current->data_length; j++)
|
||||
xu(8, itu_t_t35_payload_byte, current->data[j], 0x00, 0xff);
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ static int FUNC(user_data)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
av_assert0(k % 8 == 0);
|
||||
current->user_data_length = k /= 8;
|
||||
if (k > 0) {
|
||||
current->user_data_ref = av_buffer_allocz(k + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
current->user_data_ref = av_buffer_alloc(k);
|
||||
if (!current->user_data_ref)
|
||||
return AVERROR(ENOMEM);
|
||||
current->user_data = current->user_data_ref->data;
|
||||
|
||||
@@ -80,8 +80,11 @@ static av_cold int cdg_decode_init(AVCodecContext *avctx)
|
||||
return AVERROR(ENOMEM);
|
||||
cc->transparency = -1;
|
||||
|
||||
avctx->width = CDG_FULL_WIDTH;
|
||||
avctx->height = CDG_FULL_HEIGHT;
|
||||
avctx->pix_fmt = AV_PIX_FMT_PAL8;
|
||||
return ff_set_dimensions(avctx, CDG_FULL_WIDTH, CDG_FULL_HEIGHT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cdg_border_preset(CDGraphicsContext *cc, uint8_t *data)
|
||||
|
||||
+5
-29
@@ -315,11 +315,14 @@ static int cinepak_decode_strip (CinepakContext *s,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
static int cinepak_predecode_check (CinepakContext *s)
|
||||
static int cinepak_decode (CinepakContext *s)
|
||||
{
|
||||
int num_strips;
|
||||
const uint8_t *eod = (s->data + s->size);
|
||||
int i, result, strip_size, frame_flags, num_strips;
|
||||
int y0 = 0;
|
||||
int encoded_buf_size;
|
||||
|
||||
frame_flags = s->data[0];
|
||||
num_strips = AV_RB16 (&s->data[8]);
|
||||
encoded_buf_size = AV_RB24(&s->data[1]);
|
||||
|
||||
@@ -350,21 +353,6 @@ static int cinepak_predecode_check (CinepakContext *s)
|
||||
s->sega_film_skip_bytes = 0;
|
||||
}
|
||||
|
||||
if (s->size < 10 + s->sega_film_skip_bytes + num_strips * 12)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cinepak_decode (CinepakContext *s)
|
||||
{
|
||||
const uint8_t *eod = (s->data + s->size);
|
||||
int i, result, strip_size, frame_flags, num_strips;
|
||||
int y0 = 0;
|
||||
|
||||
frame_flags = s->data[0];
|
||||
num_strips = AV_RB16 (&s->data[8]);
|
||||
|
||||
s->data += 10 + s->sega_film_skip_bytes;
|
||||
|
||||
num_strips = FFMIN(num_strips, MAX_STRIPS);
|
||||
@@ -444,7 +432,6 @@ static int cinepak_decode_frame(AVCodecContext *avctx,
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int ret = 0, buf_size = avpkt->size;
|
||||
CinepakContext *s = avctx->priv_data;
|
||||
int num_strips;
|
||||
|
||||
s->data = buf;
|
||||
s->size = buf_size;
|
||||
@@ -452,17 +439,6 @@ static int cinepak_decode_frame(AVCodecContext *avctx,
|
||||
if (s->size < 10)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
num_strips = AV_RB16 (&s->data[8]);
|
||||
|
||||
//Empty frame, do not waste time
|
||||
if (!num_strips && (!s->palette_video || !av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL)))
|
||||
return buf_size;
|
||||
|
||||
if ((ret = cinepak_predecode_check(s)) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "cinepak_predecode_check failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -558,9 +558,6 @@ static int clv_decode_frame(AVCodecContext *avctx, void *data,
|
||||
} else {
|
||||
int plane;
|
||||
|
||||
if (c->pmb_width * c->pmb_height > 8LL*(buf_size - bytestream2_tell(&gb)))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((ret = ff_reget_buffer(avctx, c->pic)) < 0)
|
||||
return ret;
|
||||
|
||||
@@ -576,8 +573,6 @@ static int clv_decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
for (j = 0; j < c->pmb_height; j++) {
|
||||
for (i = 0; i < c->pmb_width; i++) {
|
||||
if (get_bits_left(&c->gb) <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (get_bits1(&c->gb)) {
|
||||
MV mv = mvi_predict(&c->mvi, i, j, zero_mv);
|
||||
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
switch ((buf[0] >> 1) & 7) {
|
||||
case 0: { // lzo compression
|
||||
int outlen = c->decomp_size, inlen = buf_size - 2;
|
||||
if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen) || outlen) {
|
||||
if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@@ -378,11 +378,7 @@ static int cuvid_is_buffer_full(AVCodecContext *avctx)
|
||||
{
|
||||
CuvidContext *ctx = avctx->priv_data;
|
||||
|
||||
int delay = ctx->cuparseinfo.ulMaxDisplayDelay;
|
||||
if (ctx->deint_mode != cudaVideoDeinterlaceMode_Weave && !ctx->drop_second_field)
|
||||
delay *= 2;
|
||||
|
||||
return (av_fifo_size(ctx->frame_queue) / sizeof(CuvidParsedFrame)) + delay >= ctx->nb_surfaces;
|
||||
return (av_fifo_size(ctx->frame_queue) / sizeof(CuvidParsedFrame)) + 2 > ctx->nb_surfaces;
|
||||
}
|
||||
|
||||
static int cuvid_decode_packet(AVCodecContext *avctx, const AVPacket *avpkt)
|
||||
|
||||
+1
-3
@@ -41,7 +41,7 @@ static av_cold int dfa_decode_init(AVCodecContext *avctx)
|
||||
|
||||
avctx->pix_fmt = AV_PIX_FMT_PAL8;
|
||||
|
||||
if (!avctx->width || !avctx->height || FFMAX(avctx->width, avctx->height) >= (1<<16))
|
||||
if (!avctx->width || !avctx->height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
av_assert0(av_image_check_size(avctx->width, avctx->height, 0, avctx) >= 0);
|
||||
@@ -355,8 +355,6 @@ static int dfa_decode_frame(AVCodecContext *avctx,
|
||||
|
||||
bytestream2_init(&gb, avpkt->data, avpkt->size);
|
||||
while (bytestream2_get_bytes_left(&gb) > 0) {
|
||||
if (bytestream2_get_bytes_left(&gb) < 12)
|
||||
return AVERROR_INVALIDDATA;
|
||||
bytestream2_skip(&gb, 4);
|
||||
chunk_size = bytestream2_get_le32(&gb);
|
||||
chunk_type = bytestream2_get_le32(&gb);
|
||||
|
||||
@@ -99,10 +99,10 @@ void ff_spatial_idwt_slice2(DWTContext *d, int y);
|
||||
(b1 + (unsigned)((int)(b0 + (unsigned)(b2) + 1) >> 1))
|
||||
|
||||
#define COMPOSE_DD97iH0(b0, b1, b2, b3, b4)\
|
||||
(int)(((unsigned)(b2) + ((int)(9U*b1 + 9U*b3 - b4 - b0 + 8) >> 4)))
|
||||
(int)(((unsigned)(b2) + ((int)(-b0 + 9U*b1 + 9U*b3 - b4 + 8) >> 4)))
|
||||
|
||||
#define COMPOSE_DD137iL0(b0, b1, b2, b3, b4)\
|
||||
(int)(((unsigned)(b2) - ((int)(9U*b1 + 9U*b3 - b4 - b0 + 16) >> 5)))
|
||||
(int)(((unsigned)(b2) - ((int)(-b0 + 9U*b1 + 9U*b3 - b4 + 16) >> 5)))
|
||||
|
||||
#define COMPOSE_HAARiL0(b0, b1)\
|
||||
((int)(b0 - (unsigned)((int)(b1 + 1U) >> 1)))
|
||||
|
||||
@@ -57,8 +57,8 @@ static av_always_inline void RENAME(interleave)(TYPE *dst, TYPE *src0, TYPE *src
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < w2; i++) {
|
||||
dst[2*i ] = ((int)(src0[i] + (unsigned)add)) >> shift;
|
||||
dst[2*i+1] = ((int)(src1[i] + (unsigned)add)) >> shift;
|
||||
dst[2*i ] = (src0[i] + add) >> shift;
|
||||
dst[2*i+1] = (src1[i] + add) >> shift;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,15 +190,15 @@ static void RENAME(horizontal_compose_daub97i)(uint8_t *_b, uint8_t *_temp, int
|
||||
|
||||
// second stage combined with interleave and shift
|
||||
b0 = b2 = COMPOSE_DAUB97iL0(temp[w2], temp[0], temp[w2]);
|
||||
b[0] = ~((~b0) >> 1);
|
||||
b[0] = (b0 + 1) >> 1;
|
||||
for (x = 1; x < w2; x++) {
|
||||
b2 = COMPOSE_DAUB97iL0(temp[x+w2-1], temp[x ], temp[x+w2]);
|
||||
b1 = COMPOSE_DAUB97iH0( b0, temp[x+w2-1], b2 );
|
||||
b[2*x-1] = ~((~b1) >> 1);
|
||||
b[2*x ] = ~((~b2) >> 1);
|
||||
b[2*x-1] = (b1 + 1) >> 1;
|
||||
b[2*x ] = (b2 + 1) >> 1;
|
||||
b0 = b2;
|
||||
}
|
||||
b[w-1] = ~((~COMPOSE_DAUB97iH0(b2, temp[w-1], b2)) >> 1);
|
||||
b[w-1] = (COMPOSE_DAUB97iH0(b2, temp[w-1], b2) + 1) >> 1;
|
||||
}
|
||||
|
||||
static void RENAME(vertical_compose_dirac53iH0)(uint8_t *_b0, uint8_t *_b1, uint8_t *_b2,
|
||||
|
||||
+5
-16
@@ -141,7 +141,7 @@ typedef struct DiracContext {
|
||||
GetBitContext gb;
|
||||
AVDiracSeqHeader seq;
|
||||
int seen_sequence_header;
|
||||
int64_t frame_number; /* number of the next frame to display */
|
||||
int frame_number; /* number of the next frame to display */
|
||||
Plane plane[3];
|
||||
int chroma_x_shift;
|
||||
int chroma_y_shift;
|
||||
@@ -668,10 +668,6 @@ static void decode_component(DiracContext *s, int comp)
|
||||
b->length = get_interleaved_ue_golomb(&s->gb);
|
||||
if (b->length) {
|
||||
b->quant = get_interleaved_ue_golomb(&s->gb);
|
||||
if (b->quant > (DIRAC_MAX_QUANT_INDEX - 1)) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Unsupported quant %d\n", b->quant);
|
||||
b->quant = 0;
|
||||
}
|
||||
align_get_bits(&s->gb);
|
||||
b->coeff_data = s->gb.buffer + get_bits_count(&s->gb)/8;
|
||||
b->length = FFMIN(b->length, FFMAX(get_bits_left(&s->gb)/8, 0));
|
||||
@@ -990,10 +986,6 @@ static int decode_lowdelay(DiracContext *s)
|
||||
for (slice_x = 0; bufsize > 0 && slice_x < s->num_x; slice_x++) {
|
||||
bytes = (slice_num+1) * (int64_t)s->lowdelay.bytes.num / s->lowdelay.bytes.den
|
||||
- slice_num * (int64_t)s->lowdelay.bytes.num / s->lowdelay.bytes.den;
|
||||
if (bytes >= INT_MAX || bytes*8 > bufsize) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "too many bytes\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
slices[slice_num].bytes = bytes;
|
||||
slices[slice_num].slice_x = slice_x;
|
||||
slices[slice_num].slice_y = slice_y;
|
||||
@@ -1251,10 +1243,7 @@ static int dirac_unpack_idwt_params(DiracContext *s)
|
||||
else {
|
||||
s->num_x = get_interleaved_ue_golomb(gb);
|
||||
s->num_y = get_interleaved_ue_golomb(gb);
|
||||
if (s->num_x * s->num_y == 0 || s->num_x * (uint64_t)s->num_y > INT_MAX ||
|
||||
s->num_x * (uint64_t)s->avctx->width > INT_MAX ||
|
||||
s->num_y * (uint64_t)s->avctx->height > INT_MAX
|
||||
) {
|
||||
if (s->num_x * s->num_y == 0 || s->num_x * (uint64_t)s->num_y > INT_MAX) {
|
||||
av_log(s->avctx,AV_LOG_ERROR,"Invalid numx/y\n");
|
||||
s->num_x = s->num_y = 0;
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -1410,8 +1399,8 @@ static void global_mv(DiracContext *s, DiracBlock *block, int x, int y, int ref)
|
||||
int *c = s->globalmc[ref].perspective;
|
||||
|
||||
int m = (1<<ep) - (c[0]*x + c[1]*y);
|
||||
int64_t mx = m * (int64_t)((A[0][0] * (int64_t)x + A[0][1]*(int64_t)y) + (1<<ez) * b[0]);
|
||||
int64_t my = m * (int64_t)((A[1][0] * (int64_t)x + A[1][1]*(int64_t)y) + (1<<ez) * b[1]);
|
||||
int64_t mx = m * (int64_t)((A[0][0] * x + A[0][1]*y) + (1<<ez) * b[0]);
|
||||
int64_t my = m * (int64_t)((A[1][0] * x + A[1][1]*y) + (1<<ez) * b[1]);
|
||||
|
||||
block->u.mv[ref][0] = (mx + (1<<(ez+ep))) >> (ez+ep);
|
||||
block->u.mv[ref][1] = (my + (1<<(ez+ep))) >> (ez+ep);
|
||||
@@ -2321,7 +2310,7 @@ static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
}
|
||||
|
||||
if (*got_frame)
|
||||
s->frame_number = picture->display_picture_number + 1LL;
|
||||
s->frame_number = picture->display_picture_number + 1;
|
||||
|
||||
return buf_idx;
|
||||
}
|
||||
|
||||
+4
-6
@@ -408,14 +408,12 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
if (elements == 4)
|
||||
*dst[3]++ = read16(&buf, endian) >> 4;
|
||||
} else {
|
||||
if (elements >= 3)
|
||||
*dst[2]++ = read12in32(&buf, &rgbBuffer,
|
||||
&n_datum, endian);
|
||||
*dst[2]++ = read12in32(&buf, &rgbBuffer,
|
||||
&n_datum, endian);
|
||||
*dst[0]++ = read12in32(&buf, &rgbBuffer,
|
||||
&n_datum, endian);
|
||||
if (elements >= 2)
|
||||
*dst[1]++ = read12in32(&buf, &rgbBuffer,
|
||||
&n_datum, endian);
|
||||
*dst[1]++ = read12in32(&buf, &rgbBuffer,
|
||||
&n_datum, endian);
|
||||
if (elements == 4)
|
||||
*dst[3]++ = read12in32(&buf, &rgbBuffer,
|
||||
&n_datum, endian);
|
||||
|
||||
@@ -158,9 +158,6 @@ static int cin_decode_lzss(const unsigned char *src, int src_size,
|
||||
}
|
||||
}
|
||||
|
||||
if (dst_end - dst > dst_size - dst_size/10)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -187,10 +184,6 @@ static int cin_decode_rle(const unsigned char *src, int src_size,
|
||||
}
|
||||
dst += len;
|
||||
}
|
||||
|
||||
if (dst_end - dst > dst_size - dst_size/10)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -233,35 +226,27 @@ static int cinvideo_decode_frame(AVCodecContext *avctx,
|
||||
* surface.width = surface.pitch */
|
||||
switch (bitmap_frame_type) {
|
||||
case 9:
|
||||
res = cin_decode_rle(buf, bitmap_frame_size,
|
||||
cin_decode_rle(buf, bitmap_frame_size,
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
if (res < 0)
|
||||
return res;
|
||||
break;
|
||||
case 34:
|
||||
res = cin_decode_rle(buf, bitmap_frame_size,
|
||||
cin_decode_rle(buf, bitmap_frame_size,
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
if (res < 0)
|
||||
return res;
|
||||
cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP],
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
break;
|
||||
case 35:
|
||||
bitmap_frame_size = cin_decode_huffman(buf, bitmap_frame_size,
|
||||
cin->bitmap_table[CIN_INT_BMP], cin->bitmap_size);
|
||||
res = cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], bitmap_frame_size,
|
||||
cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], bitmap_frame_size,
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
if (res < 0)
|
||||
return res;
|
||||
break;
|
||||
case 36:
|
||||
bitmap_frame_size = cin_decode_huffman(buf, bitmap_frame_size,
|
||||
cin->bitmap_table[CIN_INT_BMP],
|
||||
cin->bitmap_size);
|
||||
res = cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], bitmap_frame_size,
|
||||
cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], bitmap_frame_size,
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
if (res < 0)
|
||||
return res;
|
||||
cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP],
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
break;
|
||||
|
||||
@@ -93,7 +93,7 @@ static const AVClass dump_extradata_class = {
|
||||
.class_name = "dump_extradata bsf",
|
||||
.item_name = av_default_item_name,
|
||||
.option = options,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
.version = LIBAVUTIL_VERSION_MAJOR,
|
||||
};
|
||||
|
||||
const AVBitStreamFilter ff_dump_extradata_bsf = {
|
||||
|
||||
@@ -1261,13 +1261,6 @@ static int dvbsub_parse_region_segment(AVCodecContext *avctx,
|
||||
display->y_pos = AV_RB16(buf) & 0xfff;
|
||||
buf += 2;
|
||||
|
||||
if (display->x_pos >= region->width ||
|
||||
display->y_pos >= region->height) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Object outside region\n");
|
||||
av_free(display);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if ((object->type == 1 || object->type == 2) && buf+1 < buf_end) {
|
||||
display->fgcolor = *buf++;
|
||||
display->bgcolor = *buf++;
|
||||
|
||||
@@ -44,9 +44,6 @@ static int dvdsub_parse(AVCodecParserContext *s,
|
||||
{
|
||||
DVDSubParseContext *pc = s->priv_data;
|
||||
|
||||
*poutbuf = buf;
|
||||
*poutbuf_size = buf_size;
|
||||
|
||||
if (pc->packet_index == 0) {
|
||||
if (buf_size < 2 || AV_RB16(buf) && buf_size < 6) {
|
||||
if (buf_size)
|
||||
@@ -57,11 +54,7 @@ static int dvdsub_parse(AVCodecParserContext *s,
|
||||
if (pc->packet_len == 0) /* HD-DVD subpicture packet */
|
||||
pc->packet_len = AV_RB32(buf+2);
|
||||
av_freep(&pc->packet);
|
||||
if ((unsigned)pc->packet_len > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
|
||||
av_log(avctx, AV_LOG_ERROR, "packet length %d is invalid\n", pc->packet_len);
|
||||
return buf_size;
|
||||
}
|
||||
pc->packet = av_malloc(pc->packet_len + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
pc->packet = av_malloc(pc->packet_len);
|
||||
}
|
||||
if (pc->packet) {
|
||||
if (pc->packet_index + buf_size <= pc->packet_len) {
|
||||
|
||||
@@ -82,7 +82,10 @@ static int decode_run_8bit(GetBitContext *gb, int *color)
|
||||
{
|
||||
int len;
|
||||
int has_run = get_bits1(gb);
|
||||
*color = get_bits(gb, 2 + 6*get_bits1(gb));
|
||||
if (get_bits1(gb))
|
||||
*color = get_bits(gb, 8);
|
||||
else
|
||||
*color = get_bits(gb, 2);
|
||||
if (has_run) {
|
||||
if (get_bits1(gb)) {
|
||||
len = get_bits(gb, 7);
|
||||
@@ -124,8 +127,6 @@ static int decode_rle(uint8_t *bitmap, int linesize, int w, int h,
|
||||
len = decode_run_8bit(&gb, &color);
|
||||
else
|
||||
len = decode_run_2bit(&gb, &color);
|
||||
if (len != INT_MAX && len > w - x)
|
||||
return AVERROR_INVALIDDATA;
|
||||
len = FFMIN(len, w - x);
|
||||
memset(d + x, color, len);
|
||||
x += len;
|
||||
|
||||
+1
-8
@@ -426,8 +426,7 @@ static int fill_optable(unsigned *table0, OpcodeTable *table1, int nb_elements)
|
||||
static int get_opcodes(GetByteContext *gb, uint32_t *table, uint8_t *dst, int op_size, int nb_elements)
|
||||
{
|
||||
OpcodeTable optable[1024];
|
||||
int sum, x, val, lshift, rshift, ret, i, idx;
|
||||
int64_t size_in_bits;
|
||||
int sum, x, val, lshift, rshift, ret, size_in_bits, i, idx;
|
||||
unsigned endoffset, newoffset, offset;
|
||||
unsigned next;
|
||||
uint8_t *src = (uint8_t *)gb->buffer;
|
||||
@@ -1193,12 +1192,6 @@ static int dxv_decode(AVCodecContext *avctx, void *data,
|
||||
ret = decompress_tex(avctx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
{
|
||||
int w_block = avctx->coded_width / ctx->texture_block_w;
|
||||
int h_block = avctx->coded_height / ctx->texture_block_h;
|
||||
if (w_block * h_block * ctx->tex_step > ctx->tex_size * 8LL)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
tframe.f = data;
|
||||
ret = ff_thread_get_buffer(avctx, &tframe, 0);
|
||||
|
||||
+2
-12
@@ -349,18 +349,8 @@ static int ff_eac3_parse_header(AC3DecodeContext *s)
|
||||
/* dependent stream channel map */
|
||||
if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT) {
|
||||
if (get_bits1(gbc)) {
|
||||
int64_t channel_layout = 0;
|
||||
int channel_map = get_bits(gbc, 16);
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "channel_map: %0X\n", channel_map);
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
if (channel_map & (1 << (EAC3_MAX_CHANNELS - i - 1)))
|
||||
channel_layout |= ff_eac3_custom_channel_map_locations[i][1];
|
||||
|
||||
if (av_popcount64(channel_layout) > EAC3_MAX_CHANNELS) {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->channel_map = channel_map;
|
||||
s->channel_map = get_bits(gbc, 16);
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "channel_map: %0X\n", s->channel_map);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -271,7 +271,7 @@ void ff_els_decoder_init(ElsDecCtx *ctx, const uint8_t *in, size_t data_size)
|
||||
|
||||
void ff_els_decoder_uninit(ElsUnsignedRung *rung)
|
||||
{
|
||||
av_freep(&rung->rem_rung_list);
|
||||
av_free(rung->rem_rung_list);
|
||||
}
|
||||
|
||||
static int els_import_byte(ElsDecCtx *ctx)
|
||||
@@ -391,10 +391,12 @@ unsigned ff_els_decode_unsigned(ElsDecCtx *ctx, ElsUnsignedRung *ur)
|
||||
if (ur->rung_list_size <= (ur->avail_index + 2) * sizeof(ElsRungNode)) {
|
||||
// remember rung_node position
|
||||
ptrdiff_t pos = rung_node - ur->rem_rung_list;
|
||||
ctx->err = av_reallocp(&ur->rem_rung_list,
|
||||
ur->rem_rung_list = av_realloc(ur->rem_rung_list,
|
||||
ur->rung_list_size +
|
||||
RUNG_SPACE);
|
||||
if (ctx->err < 0) {
|
||||
if (!ur->rem_rung_list) {
|
||||
av_free(ur->rem_rung_list);
|
||||
ctx->err = AVERROR(ENOMEM);
|
||||
return 0;
|
||||
}
|
||||
memset((uint8_t *) ur->rem_rung_list + ur->rung_list_size, 0,
|
||||
|
||||
@@ -107,7 +107,7 @@ static void filter181(int16_t *data, int width, int height, ptrdiff_t stride)
|
||||
dc = -prev_dc +
|
||||
data[x + y * stride] * 8 -
|
||||
data[x + 1 + y * stride];
|
||||
dc = (av_clip(dc, INT_MIN/10923, INT_MAX/10923 - 32768) * 10923 + 32768) >> 16;
|
||||
dc = (dc * 10923 + 32768) >> 16;
|
||||
prev_dc = data[x + y * stride];
|
||||
data[x + y * stride] = dc;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ static void filter181(int16_t *data, int width, int height, ptrdiff_t stride)
|
||||
dc = -prev_dc +
|
||||
data[x + y * stride] * 8 -
|
||||
data[x + (y + 1) * stride];
|
||||
dc = (av_clip(dc, INT_MIN/10923, INT_MAX/10923 - 32768) * 10923 + 32768) >> 16;
|
||||
dc = (dc * 10923 + 32768) >> 16;
|
||||
prev_dc = data[x + y * stride];
|
||||
data[x + y * stride] = dc;
|
||||
}
|
||||
@@ -437,7 +437,7 @@ static void guess_mv(ERContext *s)
|
||||
}
|
||||
|
||||
if ((!(s->avctx->error_concealment&FF_EC_GUESS_MVS)) ||
|
||||
num_avail <= FFMAX(mb_width, mb_height) / 2) {
|
||||
num_avail <= mb_width / 2) {
|
||||
for (mb_y = 0; mb_y < mb_height; mb_y++) {
|
||||
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
|
||||
const int mb_xy = mb_x + mb_y * s->mb_stride;
|
||||
@@ -814,7 +814,8 @@ static int er_supported(ERContext *s)
|
||||
{
|
||||
if(s->avctx->hwaccel && s->avctx->hwaccel->decode_slice ||
|
||||
!s->cur_pic.f ||
|
||||
s->cur_pic.field_picture
|
||||
s->cur_pic.field_picture ||
|
||||
s->avctx->profile == FF_PROFILE_MPEG4_SIMPLE_STUDIO
|
||||
)
|
||||
return 0;
|
||||
return 1;
|
||||
|
||||
@@ -221,11 +221,7 @@ static int escape124_decode_frame(AVCodecContext *avctx,
|
||||
|
||||
// This call also guards the potential depth reads for the
|
||||
// codebook unpacking.
|
||||
// Check if the amount we will read minimally is available on input.
|
||||
// The 64 represent the immediately next 2 frame_* elements read, the 23/4320
|
||||
// represent a lower bound of the space needed for skipped superblocks. Non
|
||||
// skipped SBs need more space.
|
||||
if (get_bits_left(&gb) < 64 + s->num_superblocks * 23LL / 4320)
|
||||
if (get_bits_left(&gb) < 64)
|
||||
return -1;
|
||||
|
||||
frame_flags = get_bits_long(&gb, 32);
|
||||
|
||||
@@ -1389,7 +1389,6 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
if (*ch_gb.buffer == '.')
|
||||
ch_gb.buffer++; /* skip dot if not given */
|
||||
} else {
|
||||
layer_match = 0;
|
||||
av_log(s->avctx, AV_LOG_INFO,
|
||||
"Channel doesn't match layer : %s.\n", ch_gb.buffer);
|
||||
}
|
||||
@@ -1464,11 +1463,6 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
}
|
||||
s->pixel_type = current_pixel_type;
|
||||
s->channel_offsets[channel_index] = s->current_channel_offset;
|
||||
} else if (channel_index >= 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"Multiple channels with index %d.\n", channel_index);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
s->channels = av_realloc(s->channels,
|
||||
|
||||
@@ -539,10 +539,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
s->ec = (s->version >= 3);
|
||||
}
|
||||
|
||||
// CRC requires version 3+
|
||||
if (s->ec)
|
||||
s->version = FFMAX(s->version, 3);
|
||||
|
||||
if ((s->version == 2 || s->version>3) && avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Version 2 needed for requested features but version 2 is experimental and not enabled\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
+1
-11
@@ -82,7 +82,6 @@ static const uint8_t fic_qmat_lq[64] = {
|
||||
static const uint8_t fic_header[7] = { 0, 0, 1, 'F', 'I', 'C', 'V' };
|
||||
|
||||
#define FIC_HEADER_SIZE 27
|
||||
#define CURSOR_OFFSET 59
|
||||
|
||||
static av_always_inline void fic_idct(int16_t *blk, int step, int shift, int rnd)
|
||||
{
|
||||
@@ -139,9 +138,6 @@ static int fic_decode_block(FICContext *ctx, GetBitContext *gb,
|
||||
{
|
||||
int i, num_coeff;
|
||||
|
||||
if (get_bits_left(gb) < 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* Is it a skip block? */
|
||||
if (get_bits1(gb)) {
|
||||
*is_p = 1;
|
||||
@@ -341,10 +337,6 @@ static int fic_decode_frame(AVCodecContext *avctx, void *data,
|
||||
skip_cursor = 1;
|
||||
}
|
||||
|
||||
if (!skip_cursor && avpkt->size < CURSOR_OFFSET + sizeof(ctx->cursor_buf)) {
|
||||
skip_cursor = 1;
|
||||
}
|
||||
|
||||
/* Slice height for all but the last slice. */
|
||||
ctx->slice_h = 16 * (ctx->aligned_height >> 4) / nslices;
|
||||
if (ctx->slice_h % 16)
|
||||
@@ -383,8 +375,6 @@ static int fic_decode_frame(AVCodecContext *avctx, void *data,
|
||||
slice_h = FFALIGN(avctx->height - ctx->slice_h * (nslices - 1), 16);
|
||||
} else {
|
||||
slice_size = AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4 + 4);
|
||||
if (slice_size < slice_off)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (slice_size < slice_off || slice_size > msize)
|
||||
@@ -426,7 +416,7 @@ static int fic_decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
/* Draw cursor. */
|
||||
if (!skip_cursor) {
|
||||
memcpy(ctx->cursor_buf, src + CURSOR_OFFSET, sizeof(ctx->cursor_buf));
|
||||
memcpy(ctx->cursor_buf, src + 59, 32 * 32 * 4);
|
||||
fic_draw_cursor(avctx, cur_x, cur_y);
|
||||
}
|
||||
|
||||
|
||||
@@ -686,17 +686,12 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||
}
|
||||
|
||||
for (curr = fpc->headers; curr; curr = curr->next) {
|
||||
if (!fpc->best_header || curr->max_score > fpc->best_header->max_score) {
|
||||
if (curr->max_score > 0 &&
|
||||
(!fpc->best_header || curr->max_score > fpc->best_header->max_score)) {
|
||||
fpc->best_header = curr;
|
||||
}
|
||||
}
|
||||
|
||||
if (fpc->best_header && fpc->best_header->max_score <= 0) {
|
||||
// Only accept a bad header if there is no other option to continue
|
||||
if (!buf_size || !buf || read_end != buf || fpc->nb_headers_buffered < FLAC_MIN_HEADERS)
|
||||
fpc->best_header = NULL;
|
||||
}
|
||||
|
||||
if (fpc->best_header) {
|
||||
fpc->best_header_valid = 1;
|
||||
if (fpc->best_header->offset > 0) {
|
||||
|
||||
+5
-8
@@ -556,8 +556,8 @@ static uint32_t epic_decode_pixel_pred(ePICContext *dc, int x, int y,
|
||||
B = ((pred >> B_shift) & 0xFF) - TOSIGNED(delta);
|
||||
}
|
||||
|
||||
if (R<0 || G<0 || B<0 || R > 255 || G > 255 || B > 255) {
|
||||
avpriv_request_sample(NULL, "RGB %d %d %d is out of range\n", R, G, B);
|
||||
if (R<0 || G<0 || B<0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "RGB %d %d %d is out of range\n", R, G, B);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -927,7 +927,6 @@ static int epic_jb_decode_tile(G2MContext *c, int tile_x, int tile_y,
|
||||
if (c->ec.els_ctx.err != 0) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"ePIC: couldn't decode transparency pixel!\n");
|
||||
ff_els_decoder_uninit(&c->ec.unsigned_rung);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@@ -1356,16 +1355,14 @@ static void g2m_paint_cursor(G2MContext *c, uint8_t *dst, int stride)
|
||||
} else {
|
||||
dst += x * 3;
|
||||
}
|
||||
|
||||
if (y < 0)
|
||||
h += y;
|
||||
if (w < 0 || h < 0)
|
||||
return;
|
||||
if (y < 0) {
|
||||
h += y;
|
||||
cursor += -y * c->cursor_stride;
|
||||
} else {
|
||||
dst += y * stride;
|
||||
}
|
||||
if (w < 0 || h < 0)
|
||||
return;
|
||||
|
||||
for (j = 0; j < h; j++) {
|
||||
for (i = 0; i < w; i++) {
|
||||
|
||||
@@ -549,7 +549,7 @@ static void gain_scale(G723_1_Context *p, int16_t * buf, int energy)
|
||||
denom <<= bits2;
|
||||
|
||||
bits2 = 5 + bits1 - bits2;
|
||||
bits2 = av_clip_uintp2(bits2, 5);
|
||||
bits2 = FFMAX(0, bits2);
|
||||
|
||||
gain = (num >> 1) / (denom >> 16);
|
||||
gain = square_root(gain << 16 >> bits2);
|
||||
|
||||
+8
-10
@@ -85,14 +85,14 @@ static void rescale(GDVContext *gdv, uint8_t *dst, int w, int h, int scale_v, in
|
||||
int y = h - j - 1;
|
||||
for (i = 0; i < w; i++) {
|
||||
int x = w - i - 1;
|
||||
dst[PREAMBLE_SIZE + x + y * w] = dst[PREAMBLE_SIZE + (x>>1) + (y>>1) * (w>>1)];
|
||||
dst[PREAMBLE_SIZE + x + y * w] = dst[PREAMBLE_SIZE + x/2 + (y/2) * (w/2)];
|
||||
}
|
||||
}
|
||||
} else if (gdv->scale_h) {
|
||||
for (j = 0; j < h; j++) {
|
||||
int y = h - j - 1;
|
||||
for (x = 0; x < w; x++) {
|
||||
dst[PREAMBLE_SIZE + x + y * w] = dst[PREAMBLE_SIZE + x + (y>>1) * w];
|
||||
dst[PREAMBLE_SIZE + x + y * w] = dst[PREAMBLE_SIZE + x + (y/2) * w];
|
||||
}
|
||||
}
|
||||
} else if (gdv->scale_v) {
|
||||
@@ -100,26 +100,26 @@ static void rescale(GDVContext *gdv, uint8_t *dst, int w, int h, int scale_v, in
|
||||
int y = h - j - 1;
|
||||
for (i = 0; i < w; i++) {
|
||||
int x = w - i - 1;
|
||||
dst[PREAMBLE_SIZE + x + y * w] = dst[PREAMBLE_SIZE + (x>>1) + y * (w>>1)];
|
||||
dst[PREAMBLE_SIZE + x + y * w] = dst[PREAMBLE_SIZE + x/2 + y * (w/2)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scale_h && scale_v) {
|
||||
for (y = 0; y < (h>>1); y++) {
|
||||
for (x = 0; x < (w>>1); x++) {
|
||||
dst[PREAMBLE_SIZE + x + y * (w>>1)] = dst[PREAMBLE_SIZE + x*2 + y*2 * w];
|
||||
for (y = 0; y < h/2; y++) {
|
||||
for (x = 0; x < w/2; x++) {
|
||||
dst[PREAMBLE_SIZE + x + y * (w/2)] = dst[PREAMBLE_SIZE + x*2 + y*2 * w];
|
||||
}
|
||||
}
|
||||
} else if (scale_h) {
|
||||
for (y = 0; y < (h>>1); y++) {
|
||||
for (y = 0; y < h/2; y++) {
|
||||
for (x = 0; x < w; x++) {
|
||||
dst[PREAMBLE_SIZE + x + y * w] = dst[PREAMBLE_SIZE + x + y*2 * w];
|
||||
}
|
||||
}
|
||||
} else if (scale_v) {
|
||||
for (y = 0; y < h; y++) {
|
||||
for (x = 0; x < (w>>1); x++) {
|
||||
for (x = 0; x < w/2; x++) {
|
||||
dst[PREAMBLE_SIZE + x + y * w] = dst[PREAMBLE_SIZE + x*2 + y * w];
|
||||
}
|
||||
}
|
||||
@@ -244,8 +244,6 @@ static int decompress_5(AVCodecContext *avctx, unsigned skip)
|
||||
|
||||
while (bytestream2_get_bytes_left_p(pb) > 0 && bytestream2_get_bytes_left(gb) > 0) {
|
||||
int tag = read_bits2(&bits, gb);
|
||||
if (bytestream2_get_bytes_left(gb) < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (tag == 0) {
|
||||
bytestream2_put_byte(pb, bytestream2_get_byte(gb));
|
||||
} else if (tag == 1) {
|
||||
|
||||
@@ -47,10 +47,9 @@
|
||||
|
||||
static enum AVPixelFormat h263_get_format(AVCodecContext *avctx)
|
||||
{
|
||||
MpegEncContext *s = avctx->priv_data;
|
||||
/* MPEG-4 Studio Profile only, not supported by hardware */
|
||||
if (avctx->bits_per_raw_sample > 8) {
|
||||
av_assert1(s->studio_profile);
|
||||
av_assert1(avctx->profile == FF_PROFILE_MPEG4_SIMPLE_STUDIO);
|
||||
return avctx->pix_fmt;
|
||||
}
|
||||
|
||||
@@ -546,8 +545,6 @@ retry:
|
||||
if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) {
|
||||
if (ff_mpeg4_workaround_bugs(avctx) == 1)
|
||||
goto retry;
|
||||
if (s->studio_profile != (s->idsp.idct == NULL))
|
||||
ff_mpv_idct_init(s);
|
||||
}
|
||||
|
||||
/* After H.263 & MPEG-4 header decode we have the height, width,
|
||||
@@ -644,7 +641,7 @@ retry:
|
||||
slice_ret = decode_slice(s);
|
||||
while (s->mb_y < s->mb_height) {
|
||||
if (s->msmpeg4_version) {
|
||||
if (s->slice_height == 0 || s->mb_x != 0 || slice_ret < 0 ||
|
||||
if (s->slice_height == 0 || s->mb_x != 0 ||
|
||||
(s->mb_y % s->slice_height) != 0 || get_bits_left(&s->gb) < 0)
|
||||
break;
|
||||
} else {
|
||||
@@ -670,8 +667,7 @@ retry:
|
||||
|
||||
av_assert1(s->bitstream_buffer_size == 0);
|
||||
frame_end:
|
||||
if (!s->studio_profile)
|
||||
ff_er_frame_end(&s->er);
|
||||
ff_er_frame_end(&s->er);
|
||||
|
||||
if (avctx->hwaccel) {
|
||||
ret = avctx->hwaccel->end_frame(avctx);
|
||||
|
||||
@@ -371,7 +371,7 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
|
||||
ret = hevc_parse_nal_header(nal, logctx);
|
||||
else
|
||||
ret = h264_parse_nal_header(nal, logctx);
|
||||
if (ret <= 0 || nal->size <= 0 || nal->size_bits <= 0) {
|
||||
if (ret <= 0 || nal->size <= 0) {
|
||||
if (ret < 0) {
|
||||
av_log(logctx, AV_LOG_ERROR, "Invalid NAL unit %d, skipping.\n",
|
||||
nal->type);
|
||||
|
||||
@@ -714,14 +714,8 @@ int ff_h264_decode_mb_cavlc(const H264Context *h, H264SliceContext *sl)
|
||||
cbp = 0; /* avoid warning. FIXME: find a solution without slowing
|
||||
down the code */
|
||||
if (sl->slice_type_nos != AV_PICTURE_TYPE_I) {
|
||||
if (sl->mb_skip_run == -1) {
|
||||
unsigned mb_skip_run = get_ue_golomb_long(&sl->gb);
|
||||
if (mb_skip_run > h->mb_num) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "mb_skip_run %d is invalid\n", mb_skip_run);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
sl->mb_skip_run = mb_skip_run;
|
||||
}
|
||||
if (sl->mb_skip_run == -1)
|
||||
sl->mb_skip_run = get_ue_golomb_long(&sl->gb);
|
||||
|
||||
if (sl->mb_skip_run--) {
|
||||
if (FRAME_MBAFF(h) && (sl->mb_y & 1) == 0) {
|
||||
|
||||
@@ -156,8 +156,8 @@ void ff_h264_direct_ref_list_init(const H264Context *const h, H264SliceContext *
|
||||
av_log(h->avctx, AV_LOG_ERROR, "co located POCs unavailable\n");
|
||||
sl->col_parity = 1;
|
||||
} else
|
||||
sl->col_parity = (FFABS(col_poc[0] - (int64_t)cur_poc) >=
|
||||
FFABS(col_poc[1] - (int64_t)cur_poc));
|
||||
sl->col_parity = (FFABS(col_poc[0] - cur_poc) >=
|
||||
FFABS(col_poc[1] - cur_poc));
|
||||
ref1sidx =
|
||||
sidx = sl->col_parity;
|
||||
// FL -> FL & differ parity
|
||||
|
||||
@@ -78,8 +78,7 @@ static void MCFUNC(hl_motion)(const H264Context *h, H264SliceContext *sl,
|
||||
|
||||
if (HAVE_THREADS && (h->avctx->active_thread_type & FF_THREAD_FRAME))
|
||||
await_references(h, sl);
|
||||
if (USES_LIST(mb_type, 0))
|
||||
prefetch_motion(h, sl, 0, PIXEL_SHIFT, CHROMA_IDC);
|
||||
prefetch_motion(h, sl, 0, PIXEL_SHIFT, CHROMA_IDC);
|
||||
|
||||
if (IS_16X16(mb_type)) {
|
||||
mc_part(h, sl, 0, 1, 16, 0, dest_y, dest_cb, dest_cr, 0, 0,
|
||||
|
||||
@@ -121,23 +121,20 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf,
|
||||
}
|
||||
state = 7;
|
||||
} else {
|
||||
unsigned int mb, last_mb = p->parse_last_mb;
|
||||
GetBitContext gb;
|
||||
p->parse_history[p->parse_history_count++] = buf[i];
|
||||
if (p->parse_history_count > 5) {
|
||||
unsigned int mb, last_mb = p->parse_last_mb;
|
||||
GetBitContext gb;
|
||||
|
||||
init_get_bits(&gb, p->parse_history, 8*p->parse_history_count);
|
||||
mb= get_ue_golomb_long(&gb);
|
||||
if (get_bits_left(&gb) > 0 || p->parse_history_count > 5) {
|
||||
init_get_bits(&gb, p->parse_history, 8*p->parse_history_count);
|
||||
p->parse_history_count = 0;
|
||||
mb= get_ue_golomb_long(&gb);
|
||||
p->parse_last_mb = mb;
|
||||
if (pc->frame_start_found) {
|
||||
if (mb <= last_mb) {
|
||||
i -= p->parse_history_count - 1;
|
||||
p->parse_history_count = 0;
|
||||
if (mb <= last_mb)
|
||||
goto found;
|
||||
}
|
||||
} else
|
||||
pc->frame_start_found = 1;
|
||||
p->parse_history_count = 0;
|
||||
state = 7;
|
||||
}
|
||||
}
|
||||
@@ -152,7 +149,7 @@ found:
|
||||
pc->frame_start_found = 0;
|
||||
if (p->is_avc)
|
||||
return next_avc;
|
||||
return i - (state & 5);
|
||||
return i - (state & 5) - 5 * (state > 7);
|
||||
}
|
||||
|
||||
static int scan_mmco_reset(AVCodecParserContext *s, GetBitContext *gb,
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "h264_ps.h"
|
||||
#include "golomb.h"
|
||||
|
||||
#define MAX_LOG2_MAX_FRAME_NUM (12 + 4)
|
||||
#define MIN_LOG2_MAX_FRAME_NUM 4
|
||||
|
||||
#define EXTENDED_SAR 255
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
|
||||
#define MAX_SPS_COUNT 32
|
||||
#define MAX_PPS_COUNT 256
|
||||
#define MAX_LOG2_MAX_FRAME_NUM (12 + 4)
|
||||
|
||||
/**
|
||||
* Sequence parameter set
|
||||
|
||||
@@ -90,7 +90,7 @@ static int h264_redundant_pps_filter(AVBSFContext *bsf, AVPacket *out)
|
||||
if (nal->type == H264_NAL_PPS) {
|
||||
h264_redundant_pps_fixup_pps(ctx, nal->content);
|
||||
if (!au_has_sps) {
|
||||
av_log(bsf, AV_LOG_VERBOSE, "Deleting redundant PPS "
|
||||
av_log(ctx, AV_LOG_VERBOSE, "Deleting redundant PPS "
|
||||
"at %"PRId64".\n", in->pts);
|
||||
ff_cbs_delete_unit(ctx->input, au, i);
|
||||
}
|
||||
|
||||
@@ -812,7 +812,6 @@ int ff_h264_execute_ref_pic_marking(H264Context *h)
|
||||
}
|
||||
}
|
||||
|
||||
// Detect unmarked random access points
|
||||
if ( err >= 0
|
||||
&& h->long_ref_count==0
|
||||
&& ( h->short_ref_count<=2
|
||||
|
||||
@@ -261,16 +261,10 @@ static int decode_unregistered_user_data(H264SEIUnregistered *h, GetBitContext *
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int decode_recovery_point(H264SEIRecoveryPoint *h, GetBitContext *gb, void *logctx)
|
||||
static int decode_recovery_point(H264SEIRecoveryPoint *h, GetBitContext *gb)
|
||||
{
|
||||
unsigned recovery_frame_cnt = get_ue_golomb_long(gb);
|
||||
h->recovery_frame_cnt = get_ue_golomb_long(gb);
|
||||
|
||||
if (recovery_frame_cnt >= (1<<MAX_LOG2_MAX_FRAME_NUM)) {
|
||||
av_log(logctx, AV_LOG_ERROR, "recovery_frame_cnt %u is out of range\n", recovery_frame_cnt);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
h->recovery_frame_cnt = recovery_frame_cnt;
|
||||
/* 1b exact_match_flag,
|
||||
* 1b broken_link_flag,
|
||||
* 2b changing_slice_group_idc */
|
||||
@@ -435,7 +429,7 @@ int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb,
|
||||
ret = decode_unregistered_user_data(&h->unregistered, gb, logctx, size);
|
||||
break;
|
||||
case H264_SEI_TYPE_RECOVERY_POINT:
|
||||
ret = decode_recovery_point(&h->recovery_point, gb, logctx);
|
||||
ret = decode_recovery_point(&h->recovery_point, gb);
|
||||
break;
|
||||
case H264_SEI_TYPE_BUFFERING_PERIOD:
|
||||
ret = decode_buffering_period(&h->buffering_period, gb, ps, logctx);
|
||||
|
||||
@@ -671,7 +671,7 @@ static void implicit_weight_table(const H264Context *h, H264SliceContext *sl, in
|
||||
cur_poc = h->cur_pic_ptr->field_poc[h->picture_structure - 1];
|
||||
}
|
||||
if (sl->ref_count[0] == 1 && sl->ref_count[1] == 1 && !FRAME_MBAFF(h) &&
|
||||
sl->ref_list[0][0].poc + (int64_t)sl->ref_list[1][0].poc == 2LL * cur_poc) {
|
||||
sl->ref_list[0][0].poc + (int64_t)sl->ref_list[1][0].poc == 2 * cur_poc) {
|
||||
sl->pwt.use_weight = 0;
|
||||
sl->pwt.use_weight_chroma = 0;
|
||||
return;
|
||||
|
||||
@@ -122,7 +122,7 @@ static const AVClass hapqa_extract_class = {
|
||||
.class_name = "hapqa_extract_bsf",
|
||||
.item_name = av_default_item_name,
|
||||
.option = options,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
.version = LIBAVUTIL_VERSION_MAJOR,
|
||||
};
|
||||
|
||||
const AVBitStreamFilter ff_hapqa_extract_bsf = {
|
||||
|
||||
@@ -208,6 +208,9 @@ int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush)
|
||||
if (nb_output) {
|
||||
HEVCFrame *frame = &s->DPB[min_idx];
|
||||
|
||||
if (frame->frame->format == AV_PIX_FMT_VIDEOTOOLBOX && frame->frame->buf[0]->size == 1)
|
||||
return 0;
|
||||
|
||||
ret = av_frame_ref(out, frame->frame);
|
||||
if (frame->flags & HEVC_FRAME_FLAG_BUMPING)
|
||||
ff_hevc_unref_frame(s, frame, HEVC_FRAME_FLAG_OUTPUT | HEVC_FRAME_FLAG_BUMPING);
|
||||
@@ -508,12 +511,12 @@ fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ff_hevc_frame_nb_refs(const HEVCContext *s)
|
||||
int ff_hevc_frame_nb_refs(HEVCContext *s)
|
||||
{
|
||||
int ret = 0;
|
||||
int i;
|
||||
const ShortTermRPS *rps = s->sh.short_term_rps;
|
||||
const LongTermRPS *long_rps = &s->sh.long_term_rps;
|
||||
LongTermRPS *long_rps = &s->sh.long_term_rps;
|
||||
|
||||
if (rps) {
|
||||
for (i = 0; i < rps->num_negative_pics; i++)
|
||||
|
||||
@@ -485,11 +485,6 @@ static int hls_slice_header(HEVCContext *s)
|
||||
|
||||
// Coded parameters
|
||||
sh->first_slice_in_pic_flag = get_bits1(gb);
|
||||
if (s->ref && sh->first_slice_in_pic_flag) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Two slices reporting being the first in the same frame.\n");
|
||||
return 1; // This slice will be skiped later, do not corrupt state
|
||||
}
|
||||
|
||||
if ((IS_IDR(s) || IS_BLA(s)) && sh->first_slice_in_pic_flag) {
|
||||
s->seq_decode = (s->seq_decode + 1) & 0xff;
|
||||
s->max_ra = INT_MAX;
|
||||
@@ -2920,11 +2915,6 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
|
||||
ret = hls_slice_header(s);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (ret == 1) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
if (
|
||||
(s->avctx->skip_frame >= AVDISCARD_BIDIR && s->sh.slice_type == HEVC_SLICE_B) ||
|
||||
|
||||
@@ -544,7 +544,7 @@ int ff_hevc_res_scale_sign_flag(HEVCContext *s, int idx);
|
||||
/**
|
||||
* Get the number of candidate references for the current frame.
|
||||
*/
|
||||
int ff_hevc_frame_nb_refs(const HEVCContext *s);
|
||||
int ff_hevc_frame_nb_refs(HEVCContext *s);
|
||||
|
||||
int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc);
|
||||
|
||||
@@ -559,6 +559,8 @@ static av_always_inline int ff_hevc_nal_is_nonref(enum HEVCNALUnitType type)
|
||||
case HEVC_NAL_VCL_N10:
|
||||
case HEVC_NAL_VCL_N12:
|
||||
case HEVC_NAL_VCL_N14:
|
||||
case HEVC_NAL_BLA_N_LP:
|
||||
case HEVC_NAL_IDR_N_LP:
|
||||
return 1;
|
||||
break;
|
||||
default: break;
|
||||
|
||||
@@ -375,7 +375,6 @@ static void hnm_update_palette(AVCodecContext *avctx, uint8_t *src,
|
||||
hnm->palette[writeoffset] = bytestream2_get_be24(&gb);
|
||||
if (!eight_bit_colors)
|
||||
hnm->palette[writeoffset] <<= 2;
|
||||
hnm->palette[writeoffset] |= (0xFFU << 24);
|
||||
count--;
|
||||
writeoffset++;
|
||||
}
|
||||
|
||||
@@ -181,9 +181,6 @@ static int hqa_decode_mb(HQContext *c, AVFrame *pic, int qgroup,
|
||||
int flag = 0;
|
||||
int i, ret, cbp;
|
||||
|
||||
if (get_bits_left(gb) < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
cbp = get_vlc2(gb, c->hqa_cbp_vlc.table, 5, 1);
|
||||
|
||||
for (i = 0; i < 12; i++)
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/parseutils.h"
|
||||
#include "htmlsubtitles.h"
|
||||
#include <ctype.h>
|
||||
|
||||
static int html_color_parse(void *log_ctx, const char *str)
|
||||
{
|
||||
@@ -45,32 +44,14 @@ static void rstrip_spaces_buf(AVBPrint *buf)
|
||||
buf->str[--buf->len] = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fast code for scanning text enclosed in braces. Functionally
|
||||
* equivalent to this sscanf call:
|
||||
*
|
||||
* sscanf(in, "{\\an%*1u}%n", &len) >= 0 && len > 0
|
||||
*/
|
||||
static int scanbraces(const char* in) {
|
||||
if (strncmp(in, "{\\an", 4) != 0) {
|
||||
return 0;
|
||||
}
|
||||
if (!isdigit(in[4])) {
|
||||
return 0;
|
||||
}
|
||||
if (in[5] != '}') {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* skip all {\xxx} substrings except for {\an%d}
|
||||
and all microdvd like styles such as {Y:xxx} */
|
||||
static void handle_open_brace(AVBPrint *dst, const char **inp, int *an, int *closing_brace_missing)
|
||||
{
|
||||
int len = 0;
|
||||
const char *in = *inp;
|
||||
|
||||
*an += scanbraces(in);
|
||||
*an += sscanf(in, "{\\an%*1u}%n", &len) >= 0 && len > 0;
|
||||
|
||||
if (!*closing_brace_missing) {
|
||||
if ( (*an != 1 && in[1] == '\\')
|
||||
@@ -93,34 +74,6 @@ struct font_tag {
|
||||
uint32_t color;
|
||||
};
|
||||
|
||||
/*
|
||||
* Fast code for scanning the rest of a tag. Functionally equivalent to
|
||||
* this sscanf call:
|
||||
*
|
||||
* sscanf(in, "%127[^<>]>%n", buffer, lenp) == 2
|
||||
*/
|
||||
static int scantag(const char* in, char* buffer, int* lenp) {
|
||||
int len;
|
||||
|
||||
for (len = 0; len < 128; len++) {
|
||||
const char c = *in++;
|
||||
switch (c) {
|
||||
case '\0':
|
||||
return 0;
|
||||
case '<':
|
||||
return 0;
|
||||
case '>':
|
||||
buffer[len] = '\0';
|
||||
*lenp = len+1;
|
||||
return 1;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
buffer[len] = c;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* The general politic of the convert is to mask unsupported tags or formatting
|
||||
* errors (but still alert the user/subtitles writer with an error/warning)
|
||||
@@ -202,7 +155,7 @@ int ff_htmlmarkup_to_ass(void *log_ctx, AVBPrint *dst, const char *in)
|
||||
|
||||
len = 0;
|
||||
|
||||
if (scantag(in+tag_close+1, buffer, &len) && len > 0) {
|
||||
if (sscanf(in+tag_close+1, "%127[^<>]>%n", buffer, &len) >= 1 && len > 0) {
|
||||
const int skip = len + tag_close;
|
||||
const char *tagname = buffer;
|
||||
while (*tagname == ' ') {
|
||||
|
||||
@@ -258,11 +258,9 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
|
||||
if (avctx->bits_per_raw_sample == 10 || avctx->bits_per_raw_sample == 9) {
|
||||
/* 10-bit MPEG-4 Simple Studio Profile requires a higher precision IDCT
|
||||
However, it only uses idct_put */
|
||||
if (c->mpeg4_studio_profile) {
|
||||
if (avctx->codec_id == AV_CODEC_ID_MPEG4 && avctx->profile == FF_PROFILE_MPEG4_SIMPLE_STUDIO)
|
||||
c->idct_put = ff_simple_idct_put_int32_10bit;
|
||||
c->idct_add = NULL;
|
||||
c->idct = NULL;
|
||||
} else {
|
||||
else {
|
||||
c->idct_put = ff_simple_idct_put_int16_10bit;
|
||||
c->idct_add = ff_simple_idct_add_int16_10bit;
|
||||
c->idct = ff_simple_idct_int16_10bit;
|
||||
|
||||
@@ -95,8 +95,6 @@ typedef struct IDCTDSPContext {
|
||||
*/
|
||||
uint8_t idct_permutation[64];
|
||||
enum idct_permutation_type perm_type;
|
||||
|
||||
int mpeg4_studio_profile;
|
||||
} IDCTDSPContext;
|
||||
|
||||
void ff_put_pixels_clamped_c(const int16_t *block, uint8_t *av_restrict pixels,
|
||||
|
||||
+3
-21
@@ -30,7 +30,6 @@
|
||||
#define BITSTREAM_READER_LE
|
||||
#include "avcodec.h"
|
||||
#include "get_bits.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "indeo4data.h"
|
||||
#include "internal.h"
|
||||
#include "ivi.h"
|
||||
@@ -179,13 +178,6 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
|
||||
pic_conf.chroma_bands = 0;
|
||||
if (pic_conf.luma_bands)
|
||||
pic_conf.chroma_bands = decode_plane_subdivision(&ctx->gb);
|
||||
|
||||
if (av_image_check_size2(pic_conf.pic_width, pic_conf.pic_height, avctx->max_pixels, AV_PIX_FMT_YUV410P, 0, avctx) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "picture dimensions %d %d cannot be decoded\n",
|
||||
pic_conf.pic_width, pic_conf.pic_height);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
ctx->is_scalable = pic_conf.luma_bands != 1 || pic_conf.chroma_bands != 1;
|
||||
if (ctx->is_scalable && (pic_conf.luma_bands != 4 || pic_conf.chroma_bands != 1)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d\n",
|
||||
@@ -268,14 +260,12 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
|
||||
* @param[in] avctx pointer to the AVCodecContext
|
||||
* @return result code: 0 = OK, negative number = error
|
||||
*/
|
||||
static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *arg_band,
|
||||
static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,
|
||||
AVCodecContext *avctx)
|
||||
{
|
||||
int plane, band_num, indx, transform_id, scan_indx;
|
||||
int i;
|
||||
int quant_mat;
|
||||
IVIBandDesc temp_band, *band = &temp_band;
|
||||
memcpy(&temp_band, arg_band, sizeof(temp_band));
|
||||
|
||||
plane = get_bits(&ctx->gb, 2);
|
||||
band_num = get_bits(&ctx->gb, 4);
|
||||
@@ -405,10 +395,10 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *arg_band,
|
||||
|
||||
/* decode block huffman codebook */
|
||||
if (!get_bits1(&ctx->gb))
|
||||
arg_band->blk_vlc.tab = ctx->blk_vlc.tab;
|
||||
band->blk_vlc.tab = ctx->blk_vlc.tab;
|
||||
else
|
||||
if (ff_ivi_dec_huff_desc(&ctx->gb, 1, IVI_BLK_HUFF,
|
||||
&arg_band->blk_vlc, avctx))
|
||||
&band->blk_vlc, avctx))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* select appropriate rvmap table for this band */
|
||||
@@ -449,9 +439,6 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *arg_band,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
band->blk_vlc = arg_band->blk_vlc;
|
||||
memcpy(arg_band, band, sizeof(*arg_band));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -500,11 +487,6 @@ static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band,
|
||||
mb->b_mv_x =
|
||||
mb->b_mv_y = 0;
|
||||
|
||||
if (get_bits_left(&ctx->gb) < 1) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Insufficient input for mb info\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (get_bits1(&ctx->gb)) {
|
||||
if (ctx->frame_type == IVI4_FRAMETYPE_INTRA) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Empty macroblock in an INTRA picture!\n");
|
||||
|
||||
@@ -343,10 +343,7 @@ static int get_siz(Jpeg2000DecoderContext *s)
|
||||
s->numXtiles = ff_jpeg2000_ceildiv(s->width - s->tile_offset_x, s->tile_width);
|
||||
s->numYtiles = ff_jpeg2000_ceildiv(s->height - s->tile_offset_y, s->tile_height);
|
||||
|
||||
// There must be at least a SOT and SOD per tile, their minimum size is 14
|
||||
if (s->numXtiles * (uint64_t)s->numYtiles > INT_MAX/sizeof(*s->tile) ||
|
||||
s->numXtiles * s->numYtiles * 14LL > bytestream2_size(&s->g)
|
||||
) {
|
||||
if (s->numXtiles * (uint64_t)s->numYtiles > INT_MAX/sizeof(*s->tile)) {
|
||||
s->numXtiles = s->numYtiles = 0;
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
@@ -1159,9 +1156,6 @@ static int jpeg2000_decode_packets_po_iteration(Jpeg2000DecoderContext *s, Jpeg2
|
||||
step_x = 32;
|
||||
step_y = 32;
|
||||
|
||||
if (RSpoc >= FFMIN(codsty->nreslevels, REpoc))
|
||||
continue;
|
||||
|
||||
for (reslevelno = RSpoc; reslevelno < FFMIN(codsty->nreslevels, REpoc); reslevelno++) {
|
||||
uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; // ==> N_L - r
|
||||
Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno;
|
||||
@@ -1181,10 +1175,10 @@ static int jpeg2000_decode_packets_po_iteration(Jpeg2000DecoderContext *s, Jpeg2
|
||||
int xc = x / s->cdx[compno];
|
||||
int yc = y / s->cdy[compno];
|
||||
|
||||
if (yc % (1LL << (rlevel->log2_prec_height + reducedresno)) && y != tile->coord[1][0]) //FIXME this is a subset of the check
|
||||
if (yc % (1 << (rlevel->log2_prec_height + reducedresno)) && y != tile->coord[1][0]) //FIXME this is a subset of the check
|
||||
continue;
|
||||
|
||||
if (xc % (1LL << (rlevel->log2_prec_width + reducedresno)) && x != tile->coord[0][0]) //FIXME this is a subset of the check
|
||||
if (xc % (1 << (rlevel->log2_prec_width + reducedresno)) && x != tile->coord[0][0]) //FIXME this is a subset of the check
|
||||
continue;
|
||||
|
||||
// check if a precinct exists
|
||||
@@ -1251,10 +1245,10 @@ static int jpeg2000_decode_packets_po_iteration(Jpeg2000DecoderContext *s, Jpeg2
|
||||
if (reslevelno >= codsty->nreslevels)
|
||||
continue;
|
||||
|
||||
if (yc % (1LL << (rlevel->log2_prec_height + reducedresno)) && y != tile->coord[1][0]) //FIXME this is a subset of the check
|
||||
if (yc % (1 << (rlevel->log2_prec_height + reducedresno)) && y != tile->coord[1][0]) //FIXME this is a subset of the check
|
||||
continue;
|
||||
|
||||
if (xc % (1LL << (rlevel->log2_prec_width + reducedresno)) && x != tile->coord[0][0]) //FIXME this is a subset of the check
|
||||
if (xc % (1 << (rlevel->log2_prec_width + reducedresno)) && x != tile->coord[0][0]) //FIXME this is a subset of the check
|
||||
continue;
|
||||
|
||||
// check if a precinct exists
|
||||
@@ -1322,10 +1316,10 @@ static int jpeg2000_decode_packets_po_iteration(Jpeg2000DecoderContext *s, Jpeg2
|
||||
uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; // ==> N_L - r
|
||||
Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno;
|
||||
|
||||
if (yc % (1LL << (rlevel->log2_prec_height + reducedresno)) && y != tile->coord[1][0]) //FIXME this is a subset of the check
|
||||
if (yc % (1 << (rlevel->log2_prec_height + reducedresno)) && y != tile->coord[1][0]) //FIXME this is a subset of the check
|
||||
continue;
|
||||
|
||||
if (xc % (1LL << (rlevel->log2_prec_width + reducedresno)) && x != tile->coord[0][0]) //FIXME this is a subset of the check
|
||||
if (xc % (1 << (rlevel->log2_prec_width + reducedresno)) && x != tile->coord[0][0]) //FIXME this is a subset of the check
|
||||
continue;
|
||||
|
||||
// check if a precinct exists
|
||||
|
||||
@@ -531,7 +531,7 @@ static void dwt_decode97_int(DWTContext *s, int32_t *t)
|
||||
}
|
||||
|
||||
for (i = 0; i < w * h; i++)
|
||||
data[i] = (data[i] + ((1LL<<I_PRESHIFT)>>1)) >> I_PRESHIFT;
|
||||
data[i] = (data[i] + ((1<<I_PRESHIFT)>>1)) >> I_PRESHIFT;
|
||||
}
|
||||
|
||||
int ff_jpeg2000_dwt_init(DWTContext *s, int border[2][2],
|
||||
|
||||
@@ -170,11 +170,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
GetBitContext gb;
|
||||
init_get_bits(&gb, buf, 8 * video_size);
|
||||
|
||||
if (avctx->height/8 * (avctx->width/8) > 4 * video_size) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Insufficient input data for dimensions\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
for (j = 0; j < avctx->height; j += 8)
|
||||
for (i = 0; i < avctx->width; i += 8)
|
||||
decode8x8(&gb,
|
||||
|
||||
@@ -697,6 +697,10 @@ static const AVOption options[] = {
|
||||
"alternate reference frame selection", OFFSET(lag_in_frames), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE},
|
||||
{ "error-resilience", "Error resilience configuration", OFFSET(error_resilient), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, VE, "er"},
|
||||
{ "default", "Improve resiliency against losses of whole frames", 0, AV_OPT_TYPE_CONST, {.i64 = AOM_ERROR_RESILIENT_DEFAULT}, 0, 0, VE, "er"},
|
||||
{ "partitions", "The frame partitions are independently decodable "
|
||||
"by the bool decoder, meaning that partitions can be decoded even "
|
||||
"though earlier partitions have been lost. Note that intra predicition"
|
||||
" is still done over the partition boundary.", 0, AV_OPT_TYPE_CONST, {.i64 = AOM_ERROR_RESILIENT_PARTITIONS}, 0, 0, VE, "er"},
|
||||
{ "crf", "Select the quality for constant quality mode", offsetof(AOMContext, crf), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 63, VE },
|
||||
{ "static-thresh", "A change threshold on blocks below which they will be skipped by the encoder", OFFSET(static_thresh), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
|
||||
{ "drop-threshold", "Frame drop threshold", offsetof(AOMContext, drop_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, VE },
|
||||
|
||||
@@ -1053,7 +1053,8 @@ AVCodec ff_libx264_encoder = {
|
||||
.priv_class = &x264_class,
|
||||
.defaults = x264_defaults,
|
||||
.init_static_data = X264_init_static,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE |
|
||||
FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.wrapper_name = "libx264",
|
||||
};
|
||||
#endif
|
||||
@@ -1104,7 +1105,8 @@ AVCodec ff_libx262_encoder = {
|
||||
.priv_class = &X262_class,
|
||||
.defaults = x264_defaults,
|
||||
.pix_fmts = pix_fmts_8bit,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE |
|
||||
FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.wrapper_name = "libx264",
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -240,8 +240,6 @@ static int magy_decode_slice10(AVCodecContext *avctx, void *tdata,
|
||||
|
||||
dst = (uint16_t *)p->data[i] + j * sheight * stride;
|
||||
if (flags & 1) {
|
||||
if (get_bits_left(&gb) < bps * width * height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
for (k = 0; k < height; k++) {
|
||||
for (x = 0; x < width; x++)
|
||||
dst[x] = get_bits(&gb, bps);
|
||||
@@ -370,8 +368,6 @@ static int magy_decode_slice(AVCodecContext *avctx, void *tdata,
|
||||
|
||||
dst = p->data[i] + j * sheight * stride;
|
||||
if (flags & 1) {
|
||||
if (get_bits_left(&gb) < 8* width * height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
for (k = 0; k < height; k++) {
|
||||
for (x = 0; x < width; x++)
|
||||
dst[x] = get_bits(&gb, 8);
|
||||
|
||||
@@ -156,7 +156,7 @@ static const struct FFJniField jni_amediaformat_mapping[] = {
|
||||
static const AVClass amediaformat_class = {
|
||||
.class_name = "amediaformat",
|
||||
.item_name = av_default_item_name,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
.version = LIBAVCODEC_VERSION_INT,
|
||||
};
|
||||
|
||||
struct FFAMediaFormat {
|
||||
@@ -268,7 +268,7 @@ static const struct FFJniField jni_amediacodec_mapping[] = {
|
||||
static const AVClass amediacodec_class = {
|
||||
.class_name = "amediacodec",
|
||||
.item_name = av_default_item_name,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
.version = LIBAVCODEC_VERSION_INT,
|
||||
};
|
||||
|
||||
struct FFAMediaCodec {
|
||||
@@ -1687,18 +1687,3 @@ int ff_AMediaCodec_cleanOutputBuffers(FFAMediaCodec *codec)
|
||||
fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ff_Build_SDK_INT(AVCodecContext *avctx)
|
||||
{
|
||||
int ret = -1;
|
||||
JNIEnv *env = NULL;
|
||||
jclass versionClass;
|
||||
jfieldID sdkIntFieldID;
|
||||
JNI_GET_ENV_OR_RETURN(env, avctx, -1);
|
||||
|
||||
versionClass = (*env)->FindClass(env, "android/os/Build$VERSION");
|
||||
sdkIntFieldID = (*env)->GetStaticFieldID(env, versionClass, "SDK_INT", "I");
|
||||
ret = (*env)->GetStaticIntField(env, versionClass, sdkIntFieldID);
|
||||
(*env)->DeleteLocalRef(env, versionClass);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -124,6 +124,4 @@ int ff_AMediaCodec_getConfigureFlagEncode(FFAMediaCodec *codec);
|
||||
|
||||
int ff_AMediaCodec_cleanOutputBuffers(FFAMediaCodec *codec);
|
||||
|
||||
int ff_Build_SDK_INT(AVCodecContext *avctx);
|
||||
|
||||
#endif /* AVCODEC_MEDIACODEC_WRAPPER_H */
|
||||
|
||||
+60
-62
@@ -48,7 +48,6 @@ typedef struct MediaCodecH264DecContext {
|
||||
AVPacket buffered_pkt;
|
||||
|
||||
int delay_flush;
|
||||
int amlogic_mpeg2_api23_workaround;
|
||||
|
||||
} MediaCodecH264DecContext;
|
||||
|
||||
@@ -288,7 +287,6 @@ static int common_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format)
|
||||
static av_cold int mediacodec_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
int ret;
|
||||
int sdk_int;
|
||||
|
||||
const char *codec_mime = NULL;
|
||||
|
||||
@@ -379,17 +377,7 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx)
|
||||
goto done;
|
||||
}
|
||||
|
||||
av_log(avctx, AV_LOG_INFO,
|
||||
"MediaCodec started successfully: codec = %s, ret = %d\n",
|
||||
s->ctx->codec_name, ret);
|
||||
|
||||
sdk_int = ff_Build_SDK_INT(avctx);
|
||||
if (sdk_int <= 23 &&
|
||||
strcmp(s->ctx->codec_name, "OMX.amlogic.mpeg2.decoder.awesome") == 0) {
|
||||
av_log(avctx, AV_LOG_INFO, "Enabling workaround for %s on API=%d\n",
|
||||
s->ctx->codec_name, sdk_int);
|
||||
s->amlogic_mpeg2_api23_workaround = 1;
|
||||
}
|
||||
av_log(avctx, AV_LOG_INFO, "MediaCodec started successfully, ret = %d\n", ret);
|
||||
|
||||
done:
|
||||
if (format) {
|
||||
@@ -403,72 +391,82 @@ done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int mediacodec_send_receive(AVCodecContext *avctx,
|
||||
MediaCodecH264DecContext *s,
|
||||
AVFrame *frame, bool wait)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* send any pending data from buffered packet */
|
||||
while (s->buffered_pkt.size) {
|
||||
ret = ff_mediacodec_dec_send(avctx, s->ctx, &s->buffered_pkt);
|
||||
if (ret == AVERROR(EAGAIN))
|
||||
break;
|
||||
else if (ret < 0)
|
||||
return ret;
|
||||
s->buffered_pkt.size -= ret;
|
||||
s->buffered_pkt.data += ret;
|
||||
if (s->buffered_pkt.size <= 0)
|
||||
av_packet_unref(&s->buffered_pkt);
|
||||
}
|
||||
|
||||
/* check for new frame */
|
||||
return ff_mediacodec_dec_receive(avctx, s->ctx, frame, wait);
|
||||
}
|
||||
|
||||
static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
|
||||
{
|
||||
MediaCodecH264DecContext *s = avctx->priv_data;
|
||||
int ret;
|
||||
ssize_t index;
|
||||
|
||||
/* In delay_flush mode, wait until the user has released or rendered
|
||||
all retained frames. */
|
||||
if (s->delay_flush && ff_mediacodec_dec_is_flushing(avctx, s->ctx)) {
|
||||
/*
|
||||
* MediaCodec.flush() discards both input and output buffers, thus we
|
||||
* need to delay the call to this function until the user has released or
|
||||
* renderered the frames he retains.
|
||||
*
|
||||
* After we have buffered an input packet, check if the codec is in the
|
||||
* flushing state. If it is, we need to call ff_mediacodec_dec_flush.
|
||||
*
|
||||
* ff_mediacodec_dec_flush returns 0 if the flush cannot be performed on
|
||||
* the codec (because the user retains frames). The codec stays in the
|
||||
* flushing state.
|
||||
*
|
||||
* ff_mediacodec_dec_flush returns 1 if the flush can actually be
|
||||
* performed on the codec. The codec leaves the flushing state and can
|
||||
* process again packets.
|
||||
*
|
||||
* ff_mediacodec_dec_flush returns a negative value if an error has
|
||||
* occurred.
|
||||
*
|
||||
*/
|
||||
if (ff_mediacodec_dec_is_flushing(avctx, s->ctx)) {
|
||||
if (!ff_mediacodec_dec_flush(avctx, s->ctx)) {
|
||||
return AVERROR(EAGAIN);
|
||||
}
|
||||
}
|
||||
|
||||
/* poll for new frame */
|
||||
ret = ff_mediacodec_dec_receive(avctx, s->ctx, frame, false);
|
||||
/* flush buffered packet and check for new frame */
|
||||
ret = mediacodec_send_receive(avctx, s, frame, false);
|
||||
if (ret != AVERROR(EAGAIN))
|
||||
return ret;
|
||||
|
||||
/* feed decoder */
|
||||
while (1) {
|
||||
if (s->ctx->current_input_buffer < 0) {
|
||||
/* poll for input space */
|
||||
index = ff_AMediaCodec_dequeueInputBuffer(s->ctx->codec, 0);
|
||||
if (index < 0) {
|
||||
/* no space, block for an output frame to appear */
|
||||
return ff_mediacodec_dec_receive(avctx, s->ctx, frame, true);
|
||||
}
|
||||
s->ctx->current_input_buffer = index;
|
||||
}
|
||||
/* skip fetching new packet if we still have one buffered */
|
||||
if (s->buffered_pkt.size > 0)
|
||||
return mediacodec_send_receive(avctx, s, frame, true);
|
||||
|
||||
/* try to flush any buffered packet data */
|
||||
if (s->buffered_pkt.size > 0) {
|
||||
ret = ff_mediacodec_dec_send(avctx, s->ctx, &s->buffered_pkt, false);
|
||||
if (ret >= 0) {
|
||||
s->buffered_pkt.size -= ret;
|
||||
s->buffered_pkt.data += ret;
|
||||
if (s->buffered_pkt.size <= 0)
|
||||
av_packet_unref(&s->buffered_pkt);
|
||||
} else if (ret < 0 && ret != AVERROR(EAGAIN)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (s->amlogic_mpeg2_api23_workaround && s->buffered_pkt.size <= 0) {
|
||||
/* fallthrough to fetch next packet regardless of input buffer space */
|
||||
} else {
|
||||
/* poll for space again */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* fetch new packet or eof */
|
||||
ret = ff_decode_get_packet(avctx, &s->buffered_pkt);
|
||||
if (ret == AVERROR_EOF) {
|
||||
AVPacket null_pkt = { 0 };
|
||||
ret = ff_mediacodec_dec_send(avctx, s->ctx, &null_pkt, true);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else if (ret == AVERROR(EAGAIN) && s->ctx->current_input_buffer < 0) {
|
||||
return ff_mediacodec_dec_receive(avctx, s->ctx, frame, true);
|
||||
} else if (ret < 0) {
|
||||
/* fetch new packet or eof */
|
||||
ret = ff_decode_get_packet(avctx, &s->buffered_pkt);
|
||||
if (ret == AVERROR_EOF) {
|
||||
AVPacket null_pkt = { 0 };
|
||||
ret = ff_mediacodec_dec_send(avctx, s->ctx, &null_pkt);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
else if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return AVERROR(EAGAIN);
|
||||
/* crank decoder with new packet */
|
||||
return mediacodec_send_receive(avctx, s, frame, true);
|
||||
}
|
||||
|
||||
static void mediacodec_decode_flush(AVCodecContext *avctx)
|
||||
|
||||
@@ -209,7 +209,7 @@ static int mediacodec_wrap_hw_buffer(AVCodecContext *avctx,
|
||||
|
||||
if (avctx->pkt_timebase.num && avctx->pkt_timebase.den) {
|
||||
frame->pts = av_rescale_q(info->presentationTimeUs,
|
||||
AV_TIME_BASE_Q,
|
||||
av_make_q(1, 1000000),
|
||||
avctx->pkt_timebase);
|
||||
} else {
|
||||
frame->pts = info->presentationTimeUs;
|
||||
@@ -298,7 +298,7 @@ static int mediacodec_wrap_sw_buffer(AVCodecContext *avctx,
|
||||
* * 0-sized avpackets are pushed to flush remaining frames at EOS */
|
||||
if (avctx->pkt_timebase.num && avctx->pkt_timebase.den) {
|
||||
frame->pts = av_rescale_q(info->presentationTimeUs,
|
||||
AV_TIME_BASE_Q,
|
||||
av_make_q(1, 1000000),
|
||||
avctx->pkt_timebase);
|
||||
} else {
|
||||
frame->pts = info->presentationTimeUs;
|
||||
@@ -385,18 +385,17 @@ static int mediacodec_dec_parse_format(AVCodecContext *avctx, MediaCodecDecConte
|
||||
AMEDIAFORMAT_GET_INT32(s->width, "width", 1);
|
||||
AMEDIAFORMAT_GET_INT32(s->height, "height", 1);
|
||||
|
||||
AMEDIAFORMAT_GET_INT32(s->stride, "stride", 0);
|
||||
AMEDIAFORMAT_GET_INT32(s->stride, "stride", 1);
|
||||
s->stride = s->stride > 0 ? s->stride : s->width;
|
||||
|
||||
AMEDIAFORMAT_GET_INT32(s->slice_height, "slice-height", 0);
|
||||
AMEDIAFORMAT_GET_INT32(s->slice_height, "slice-height", 1);
|
||||
s->slice_height = s->slice_height > 0 ? s->slice_height : s->height;
|
||||
|
||||
if (strstr(s->codec_name, "OMX.Nvidia.") && s->slice_height == 0) {
|
||||
if (strstr(s->codec_name, "OMX.Nvidia.")) {
|
||||
s->slice_height = FFALIGN(s->height, 16);
|
||||
} else if (strstr(s->codec_name, "OMX.SEC.avc.dec")) {
|
||||
s->slice_height = avctx->height;
|
||||
s->stride = avctx->width;
|
||||
} else if (s->slice_height == 0) {
|
||||
s->slice_height = s->height;
|
||||
}
|
||||
|
||||
AMEDIAFORMAT_GET_INT32(s->color_format, "color-format", 1);
|
||||
@@ -451,7 +450,6 @@ static int mediacodec_dec_flush_codec(AVCodecContext *avctx, MediaCodecDecContex
|
||||
s->eos = 0;
|
||||
atomic_fetch_add(&s->serial, 1);
|
||||
atomic_init(&s->hw_buffer_count, 0);
|
||||
s->current_input_buffer = -1;
|
||||
|
||||
status = ff_AMediaCodec_flush(codec);
|
||||
if (status < 0) {
|
||||
@@ -479,7 +477,6 @@ int ff_mediacodec_dec_init(AVCodecContext *avctx, MediaCodecDecContext *s,
|
||||
atomic_init(&s->refcount, 1);
|
||||
atomic_init(&s->hw_buffer_count, 0);
|
||||
atomic_init(&s->serial, 1);
|
||||
s->current_input_buffer = -1;
|
||||
|
||||
pix_fmt = ff_get_format(avctx, pix_fmts);
|
||||
if (pix_fmt == AV_PIX_FMT_MEDIACODEC) {
|
||||
@@ -564,17 +561,16 @@ fail:
|
||||
}
|
||||
|
||||
int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s,
|
||||
AVPacket *pkt, bool wait)
|
||||
AVPacket *pkt)
|
||||
{
|
||||
int offset = 0;
|
||||
int need_draining = 0;
|
||||
uint8_t *data;
|
||||
ssize_t index = s->current_input_buffer;
|
||||
ssize_t index;
|
||||
size_t size;
|
||||
FFAMediaCodec *codec = s->codec;
|
||||
int status;
|
||||
int64_t input_dequeue_timeout_us = wait ? INPUT_DEQUEUE_TIMEOUT_US : 0;
|
||||
int64_t pts;
|
||||
int64_t input_dequeue_timeout_us = INPUT_DEQUEUE_TIMEOUT_US;
|
||||
|
||||
if (s->flushing) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Decoder is flushing and cannot accept new buffer "
|
||||
@@ -591,19 +587,17 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s,
|
||||
}
|
||||
|
||||
while (offset < pkt->size || (need_draining && !s->draining)) {
|
||||
if (index < 0) {
|
||||
index = ff_AMediaCodec_dequeueInputBuffer(codec, input_dequeue_timeout_us);
|
||||
if (ff_AMediaCodec_infoTryAgainLater(codec, index)) {
|
||||
av_log(avctx, AV_LOG_TRACE, "No input buffer available, try again later\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (index < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Failed to dequeue input buffer (status=%zd)\n", index);
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
index = ff_AMediaCodec_dequeueInputBuffer(codec, input_dequeue_timeout_us);
|
||||
if (ff_AMediaCodec_infoTryAgainLater(codec, index)) {
|
||||
av_log(avctx, AV_LOG_TRACE, "No input buffer available, try again later\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (index < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Failed to dequeue input buffer (status=%zd)\n", index);
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
s->current_input_buffer = -1;
|
||||
|
||||
data = ff_AMediaCodec_getInputBuffer(codec, index, &size);
|
||||
if (!data) {
|
||||
@@ -611,14 +605,14 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s,
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
pts = pkt->pts;
|
||||
if (pts != AV_NOPTS_VALUE && avctx->pkt_timebase.num && avctx->pkt_timebase.den) {
|
||||
pts = av_rescale_q(pts, avctx->pkt_timebase, AV_TIME_BASE_Q);
|
||||
}
|
||||
|
||||
if (need_draining) {
|
||||
int64_t pts = pkt->pts;
|
||||
uint32_t flags = ff_AMediaCodec_getBufferFlagEndOfStream(codec);
|
||||
|
||||
if (s->surface) {
|
||||
pts = av_rescale_q(pts, avctx->pkt_timebase, av_make_q(1, 1000000));
|
||||
}
|
||||
|
||||
av_log(avctx, AV_LOG_DEBUG, "Sending End Of Stream signal\n");
|
||||
|
||||
status = ff_AMediaCodec_queueInputBuffer(codec, index, 0, 0, pts, flags);
|
||||
@@ -633,10 +627,16 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s,
|
||||
s->draining = 1;
|
||||
break;
|
||||
} else {
|
||||
int64_t pts = pkt->pts;
|
||||
|
||||
size = FFMIN(pkt->size - offset, size);
|
||||
memcpy(data, pkt->data + offset, size);
|
||||
offset += size;
|
||||
|
||||
if (avctx->pkt_timebase.num && avctx->pkt_timebase.den) {
|
||||
pts = av_rescale_q(pts, avctx->pkt_timebase, av_make_q(1, 1000000));
|
||||
}
|
||||
|
||||
status = ff_AMediaCodec_queueInputBuffer(codec, index, 0, size, pts, 0);
|
||||
if (status < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Failed to queue input buffer (status = %d)\n", status);
|
||||
@@ -764,18 +764,6 @@ int ff_mediacodec_dec_receive(AVCodecContext *avctx, MediaCodecDecContext *s,
|
||||
return AVERROR(EAGAIN);
|
||||
}
|
||||
|
||||
/*
|
||||
* ff_mediacodec_dec_flush returns 0 if the flush cannot be performed on
|
||||
* the codec (because the user retains frames). The codec stays in the
|
||||
* flushing state.
|
||||
*
|
||||
* ff_mediacodec_dec_flush returns 1 if the flush can actually be
|
||||
* performed on the codec. The codec leaves the flushing state and can
|
||||
* process again packets.
|
||||
*
|
||||
* ff_mediacodec_dec_flush returns a negative value if an error has
|
||||
* occurred.
|
||||
*/
|
||||
int ff_mediacodec_dec_flush(AVCodecContext *avctx, MediaCodecDecContext *s)
|
||||
{
|
||||
if (!s->surface || atomic_load(&s->refcount) == 1) {
|
||||
|
||||
@@ -65,7 +65,6 @@ typedef struct MediaCodecDecContext {
|
||||
int display_height;
|
||||
|
||||
uint64_t output_buffer_count;
|
||||
ssize_t current_input_buffer;
|
||||
|
||||
bool delay_flush;
|
||||
atomic_int serial;
|
||||
@@ -79,8 +78,7 @@ int ff_mediacodec_dec_init(AVCodecContext *avctx,
|
||||
|
||||
int ff_mediacodec_dec_send(AVCodecContext *avctx,
|
||||
MediaCodecDecContext *s,
|
||||
AVPacket *pkt,
|
||||
bool wait);
|
||||
AVPacket *pkt);
|
||||
|
||||
int ff_mediacodec_dec_receive(AVCodecContext *avctx,
|
||||
MediaCodecDecContext *s,
|
||||
|
||||
@@ -2630,7 +2630,7 @@ void ff_hevc_sao_edge_filter_8_msa(uint8_t *dst, uint8_t *src,
|
||||
int16_t *sao_offset_val,
|
||||
int eo, int width, int height)
|
||||
{
|
||||
ptrdiff_t stride_src = (2 * MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE) / sizeof(uint8_t);
|
||||
ptrdiff_t stride_src = (2 * 64 + 32) / sizeof(uint8_t);
|
||||
|
||||
switch (eo) {
|
||||
case 0:
|
||||
|
||||
+15
-9
@@ -70,7 +70,8 @@ read_header:
|
||||
|
||||
skip_bits(&hgb, 32); /* reserved zeros */
|
||||
|
||||
if (get_bits_long(&hgb, 32) != MKBETAG('m','j','p','g')) {
|
||||
if (get_bits_long(&hgb, 32) != MKBETAG('m','j','p','g'))
|
||||
{
|
||||
av_log(avctx, AV_LOG_WARNING, "not mjpeg-b (bad fourcc)\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -84,17 +85,19 @@ read_header:
|
||||
|
||||
dqt_offs = read_offs(avctx, &hgb, buf_end - buf_ptr, "dqt is %d and size is %d\n");
|
||||
av_log(avctx, AV_LOG_DEBUG, "dqt offs: 0x%"PRIx32"\n", dqt_offs);
|
||||
if (dqt_offs) {
|
||||
if (dqt_offs)
|
||||
{
|
||||
init_get_bits(&s->gb, buf_ptr+dqt_offs, (buf_end - (buf_ptr+dqt_offs))*8);
|
||||
s->start_code = DQT;
|
||||
if (ff_mjpeg_decode_dqt(s) < 0 &&
|
||||
(avctx->err_recognition & AV_EF_EXPLODE))
|
||||
return AVERROR_INVALIDDATA;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
dht_offs = read_offs(avctx, &hgb, buf_end - buf_ptr, "dht is %d and size is %d\n");
|
||||
av_log(avctx, AV_LOG_DEBUG, "dht offs: 0x%"PRIx32"\n", dht_offs);
|
||||
if (dht_offs) {
|
||||
if (dht_offs)
|
||||
{
|
||||
init_get_bits(&s->gb, buf_ptr+dht_offs, (buf_end - (buf_ptr+dht_offs))*8);
|
||||
s->start_code = DHT;
|
||||
ff_mjpeg_decode_dht(s);
|
||||
@@ -102,7 +105,8 @@ read_header:
|
||||
|
||||
sof_offs = read_offs(avctx, &hgb, buf_end - buf_ptr, "sof is %d and size is %d\n");
|
||||
av_log(avctx, AV_LOG_DEBUG, "sof offs: 0x%"PRIx32"\n", sof_offs);
|
||||
if (sof_offs) {
|
||||
if (sof_offs)
|
||||
{
|
||||
init_get_bits(&s->gb, buf_ptr+sof_offs, (buf_end - (buf_ptr+sof_offs))*8);
|
||||
s->start_code = SOF0;
|
||||
if (ff_mjpeg_decode_sof(s) < 0)
|
||||
@@ -113,23 +117,25 @@ read_header:
|
||||
av_log(avctx, AV_LOG_DEBUG, "sos offs: 0x%"PRIx32"\n", sos_offs);
|
||||
sod_offs = read_offs(avctx, &hgb, buf_end - buf_ptr, "sof is %d and size is %d\n");
|
||||
av_log(avctx, AV_LOG_DEBUG, "sod offs: 0x%"PRIx32"\n", sod_offs);
|
||||
if (sos_offs) {
|
||||
if (sos_offs)
|
||||
{
|
||||
init_get_bits(&s->gb, buf_ptr + sos_offs,
|
||||
8 * FFMIN(field_size, buf_end - buf_ptr - sos_offs));
|
||||
s->mjpb_skiptosod = (sod_offs - sos_offs - show_bits(&s->gb, 16));
|
||||
s->start_code = SOS;
|
||||
if (ff_mjpeg_decode_sos(s, NULL, 0, NULL) < 0 &&
|
||||
(avctx->err_recognition & AV_EF_EXPLODE))
|
||||
return AVERROR_INVALIDDATA;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (s->interlaced) {
|
||||
s->bottom_field ^= 1;
|
||||
/* if not bottom field, do not output image yet */
|
||||
if (s->bottom_field != s->interlace_polarity && second_field_offs) {
|
||||
if (s->bottom_field != s->interlace_polarity && second_field_offs)
|
||||
{
|
||||
buf_ptr = buf + second_field_offs;
|
||||
goto read_header;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//XXX FIXME factorize, this looks very similar to the EOI code
|
||||
|
||||
+17
-26
@@ -626,10 +626,6 @@ unk_pixfmt:
|
||||
avpriv_report_missing_feature(s->avctx, "Lowres for weird subsampling");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
if ((AV_RB32(s->upscale_h) || AV_RB32(s->upscale_v)) && s->progressive && s->avctx->pix_fmt == AV_PIX_FMT_GBRP) {
|
||||
avpriv_report_missing_feature(s->avctx, "progressive for weird subsampling");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
if (s->ls) {
|
||||
memset(s->upscale_h, 0, sizeof(s->upscale_h));
|
||||
memset(s->upscale_v, 0, sizeof(s->upscale_v));
|
||||
@@ -1059,11 +1055,6 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
|
||||
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
|
||||
int modified_predictor = predictor;
|
||||
|
||||
if (get_bits_left(&s->gb) < 1) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "bitstream end in rgb_scan\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (s->restart_interval && !s->restart_count){
|
||||
s->restart_count = s->restart_interval;
|
||||
resync_mb_x = mb_x;
|
||||
@@ -1087,7 +1078,7 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
|
||||
return -1;
|
||||
|
||||
left[i] = buffer[mb_x][i] =
|
||||
mask & (pred + (unsigned)(dc * (1 << point_transform)));
|
||||
mask & (pred + (dc * (1 << point_transform)));
|
||||
}
|
||||
|
||||
if (s->restart_interval && !--s->restart_count) {
|
||||
@@ -1201,25 +1192,25 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
|
||||
|| v * mb_y + y >= s->height) {
|
||||
// Nothing to do
|
||||
} else if (bits<=8) {
|
||||
ptr = s->picture_ptr->data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
|
||||
if(y==0 && toprow){
|
||||
if(x==0 && leftcol){
|
||||
pred= 1 << (bits - 1);
|
||||
}else{
|
||||
pred= ptr[-1];
|
||||
}
|
||||
ptr = s->picture_ptr->data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
|
||||
if(y==0 && toprow){
|
||||
if(x==0 && leftcol){
|
||||
pred= 1 << (bits - 1);
|
||||
}else{
|
||||
if(x==0 && leftcol){
|
||||
pred= ptr[-linesize];
|
||||
}else{
|
||||
PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
|
||||
}
|
||||
pred= ptr[-1];
|
||||
}
|
||||
}else{
|
||||
if(x==0 && leftcol){
|
||||
pred= ptr[-linesize];
|
||||
}else{
|
||||
PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
|
||||
}
|
||||
}
|
||||
|
||||
if (s->interlaced && s->bottom_field)
|
||||
ptr += linesize >> 1;
|
||||
pred &= mask;
|
||||
*ptr= pred + ((unsigned)dc << point_transform);
|
||||
if (s->interlaced && s->bottom_field)
|
||||
ptr += linesize >> 1;
|
||||
pred &= mask;
|
||||
*ptr= pred + ((unsigned)dc << point_transform);
|
||||
}else{
|
||||
ptr16 = (uint16_t*)(s->picture_ptr->data[c] + 2*(linesize * (v * mb_y + y)) + 2*(h * mb_x + x)); //FIXME optimize this crap
|
||||
if(y==0 && toprow){
|
||||
|
||||
@@ -320,7 +320,7 @@ static int mlp_parse(AVCodecParserContext *s,
|
||||
mp->bytes_left = 0;
|
||||
}
|
||||
|
||||
sync_present = buf_size >= 8 && (AV_RB32(buf + 4) & 0xfffffffe) == 0xf8726fba;
|
||||
sync_present = (AV_RB32(buf + 4) & 0xfffffffe) == 0xf8726fba;
|
||||
|
||||
if (!sync_present) {
|
||||
/* The first nibble of a frame is a parity check of the 4-byte
|
||||
|
||||
+5
-6
@@ -479,7 +479,7 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
|
||||
uint8_t checksum;
|
||||
uint8_t lossless_check;
|
||||
int start_count = get_bits_count(gbp);
|
||||
int min_channel, max_channel, max_matrix_channel, noise_type;
|
||||
int min_channel, max_channel, max_matrix_channel;
|
||||
const int std_max_matrix_channel = m->avctx->codec_id == AV_CODEC_ID_MLP
|
||||
? MAX_MATRIX_CHANNEL_MLP
|
||||
: MAX_MATRIX_CHANNEL_TRUEHD;
|
||||
@@ -492,9 +492,9 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
noise_type = get_bits1(gbp);
|
||||
s->noise_type = get_bits1(gbp);
|
||||
|
||||
if (m->avctx->codec_id == AV_CODEC_ID_MLP && noise_type) {
|
||||
if (m->avctx->codec_id == AV_CODEC_ID_MLP && s->noise_type) {
|
||||
av_log(m->avctx, AV_LOG_ERROR, "MLP must have 0x31ea sync word.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -520,7 +520,7 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
|
||||
|
||||
/* This should happen for TrueHD streams with >6 channels and MLP's noise
|
||||
* type. It is not yet known if this is allowed. */
|
||||
if (max_channel > MAX_MATRIX_CHANNEL_MLP && !noise_type) {
|
||||
if (max_channel > MAX_MATRIX_CHANNEL_MLP && !s->noise_type) {
|
||||
avpriv_request_sample(m->avctx,
|
||||
"%d channels (more than the "
|
||||
"maximum supported by the decoder)",
|
||||
@@ -537,7 +537,6 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
|
||||
s->min_channel = min_channel;
|
||||
s->max_channel = max_channel;
|
||||
s->max_matrix_channel = max_matrix_channel;
|
||||
s->noise_type = noise_type;
|
||||
|
||||
if (mlp_channel_layout_subset(m->avctx->request_channel_layout, s->mask) &&
|
||||
m->max_decoded_substream > substr) {
|
||||
@@ -1195,7 +1194,7 @@ static int read_access_unit(AVCodecContext *avctx, void* data,
|
||||
}
|
||||
|
||||
if (length < header_size + substr_header_size) {
|
||||
av_log(m->avctx, AV_LOG_ERROR, "Insufficient data for headers\n");
|
||||
av_log(m->avctx, AV_LOG_ERROR, "Insuffient data for headers\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,8 +41,6 @@
|
||||
#define NBIT_VO_TYPE 5
|
||||
#define ARTS_VO_TYPE 10
|
||||
#define ACE_VO_TYPE 12
|
||||
#define SIMPLE_STUDIO_VO_TYPE 14
|
||||
#define CORE_STUDIO_VO_TYPE 15
|
||||
#define ADV_SIMPLE_VO_TYPE 17
|
||||
|
||||
#define VOT_VIDEO_ID 1
|
||||
|
||||
@@ -46,7 +46,7 @@ int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
|
||||
if (!vop_found) {
|
||||
for (i = 0; i < buf_size; i++) {
|
||||
state = (state << 8) | buf[i];
|
||||
if (state == VOP_STARTCODE) {
|
||||
if (state == 0x1B6) {
|
||||
i++;
|
||||
vop_found = 1;
|
||||
break;
|
||||
@@ -61,8 +61,6 @@ int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
|
||||
for (; i < buf_size; i++) {
|
||||
state = (state << 8) | buf[i];
|
||||
if ((state & 0xFFFFFF00) == 0x100) {
|
||||
if (state == SLICE_STARTCODE || state == EXT_STARTCODE)
|
||||
continue;
|
||||
pc->frame_start_found = 0;
|
||||
pc->state = -1;
|
||||
return i - 3;
|
||||
|
||||
+38
-98
@@ -46,8 +46,6 @@
|
||||
#define MB_TYPE_B_VLC_BITS 4
|
||||
#define STUDIO_INTRA_BITS 9
|
||||
|
||||
static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb);
|
||||
|
||||
static VLC dc_lum, dc_chrom;
|
||||
static VLC sprite_trajectory;
|
||||
static VLC mb_type_b_vlc;
|
||||
@@ -400,7 +398,7 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
|
||||
llabs(sprite_offset[0][i] + sprite_delta[i][1] * (h+16LL)) >= INT_MAX ||
|
||||
llabs(sprite_offset[0][i] + sprite_delta[i][0] * (w+16LL) + sprite_delta[i][1] * (h+16LL)) >= INT_MAX ||
|
||||
llabs(sprite_delta[i][0] * (w+16LL)) >= INT_MAX ||
|
||||
llabs(sprite_delta[i][1] * (h+16LL)) >= INT_MAX ||
|
||||
llabs(sprite_delta[i][1] * (w+16LL)) >= INT_MAX ||
|
||||
llabs(sd[0]) >= INT_MAX ||
|
||||
llabs(sd[1]) >= INT_MAX ||
|
||||
llabs(sprite_offset[0][i] + sd[0] * (w+16LL)) >= INT_MAX ||
|
||||
@@ -596,7 +594,7 @@ static inline int get_amv(Mpeg4DecContext *ctx, int n)
|
||||
len >>= s->quarter_sample;
|
||||
|
||||
if (s->real_sprite_warping_points == 1) {
|
||||
if (ctx->divx_version == 500 && ctx->divx_build == 413 && a >= s->quarter_sample)
|
||||
if (ctx->divx_version == 500 && ctx->divx_build == 413)
|
||||
sum = s->sprite_offset[0][n] / (1 << (a - s->quarter_sample));
|
||||
else
|
||||
sum = RSHIFT(s->sprite_offset[0][n] * (1 << s->quarter_sample), a);
|
||||
@@ -1897,20 +1895,14 @@ static int mpeg4_decode_studio_block(MpegEncContext *s, int32_t block[64], int n
|
||||
code >>= 1;
|
||||
run = (1 << (additional_code_len - 1)) + code;
|
||||
idx += run;
|
||||
if (idx > 63)
|
||||
return AVERROR_INVALIDDATA;
|
||||
j = scantable[idx++];
|
||||
block[j] = sign ? 1 : -1;
|
||||
} else if (group >= 13 && group <= 20) {
|
||||
/* Level value (Table B.49) */
|
||||
if (idx > 63)
|
||||
return AVERROR_INVALIDDATA;
|
||||
j = scantable[idx++];
|
||||
block[j] = get_xbits(&s->gb, additional_code_len);
|
||||
} else if (group == 21) {
|
||||
/* Escape */
|
||||
if (idx > 63)
|
||||
return AVERROR_INVALIDDATA;
|
||||
j = scantable[idx++];
|
||||
additional_code_len = s->avctx->bits_per_raw_sample + s->dct_precision + 4;
|
||||
flc = get_bits(&s->gb, additional_code_len);
|
||||
@@ -1961,14 +1953,6 @@ static int mpeg4_decode_studio_mb(MpegEncContext *s, int16_t block_[12][64])
|
||||
return SLICE_END;
|
||||
}
|
||||
|
||||
//vcon-stp9L1.bits (first frame)
|
||||
if (get_bits_left(&s->gb) == 0)
|
||||
return SLICE_END;
|
||||
|
||||
//vcon-stp2L1.bits, vcon-stp3L1.bits, vcon-stp6L1.bits, vcon-stp7L1.bits, vcon-stp8L1.bits, vcon-stp10L1.bits (first frame)
|
||||
if (get_bits_left(&s->gb) < 8U && show_bits(&s->gb, get_bits_left(&s->gb)) == 0)
|
||||
return SLICE_END;
|
||||
|
||||
return SLICE_OK;
|
||||
}
|
||||
|
||||
@@ -1994,15 +1978,15 @@ static int mpeg4_decode_gop_header(MpegEncContext *s, GetBitContext *gb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mpeg4_decode_profile_level(MpegEncContext *s, GetBitContext *gb, int *profile, int *level)
|
||||
static int mpeg4_decode_profile_level(MpegEncContext *s, GetBitContext *gb)
|
||||
{
|
||||
|
||||
*profile = get_bits(gb, 4);
|
||||
*level = get_bits(gb, 4);
|
||||
s->avctx->profile = get_bits(gb, 4);
|
||||
s->avctx->level = get_bits(gb, 4);
|
||||
|
||||
// for Simple profile, level 0
|
||||
if (*profile == 0 && *level == 8) {
|
||||
*level = 0;
|
||||
if (s->avctx->profile == 0 && s->avctx->level == 8) {
|
||||
s->avctx->level = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -2065,23 +2049,6 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
/* vol header */
|
||||
skip_bits(gb, 1); /* random access */
|
||||
s->vo_type = get_bits(gb, 8);
|
||||
|
||||
/* If we are in studio profile (per vo_type), check if its all consistent
|
||||
* and if so continue pass control to decode_studio_vol_header().
|
||||
* elIf something is inconsistent, error out
|
||||
* else continue with (non studio) vol header decpoding.
|
||||
*/
|
||||
if (s->vo_type == CORE_STUDIO_VO_TYPE ||
|
||||
s->vo_type == SIMPLE_STUDIO_VO_TYPE) {
|
||||
if (s->avctx->profile != FF_PROFILE_UNKNOWN && s->avctx->profile != FF_PROFILE_MPEG4_SIMPLE_STUDIO)
|
||||
return AVERROR_INVALIDDATA;
|
||||
s->studio_profile = 1;
|
||||
s->avctx->profile = FF_PROFILE_MPEG4_SIMPLE_STUDIO;
|
||||
return decode_studio_vol_header(ctx, gb);
|
||||
} else if (s->studio_profile) {
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
if (get_bits1(gb) != 0) { /* is_ol_id */
|
||||
vo_ver_id = get_bits(gb, 4); /* vo_ver_id */
|
||||
skip_bits(gb, 3); /* vo_priority */
|
||||
@@ -2881,13 +2848,11 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int read_quant_matrix_ext(MpegEncContext *s, GetBitContext *gb)
|
||||
static void read_quant_matrix_ext(MpegEncContext *s, GetBitContext *gb)
|
||||
{
|
||||
int i, j, v;
|
||||
|
||||
if (get_bits1(gb)) {
|
||||
if (get_bits_left(gb) < 64*8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
/* intra_quantiser_matrix */
|
||||
for (i = 0; i < 64; i++) {
|
||||
v = get_bits(gb, 8);
|
||||
@@ -2898,8 +2863,6 @@ static int read_quant_matrix_ext(MpegEncContext *s, GetBitContext *gb)
|
||||
}
|
||||
|
||||
if (get_bits1(gb)) {
|
||||
if (get_bits_left(gb) < 64*8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
/* non_intra_quantiser_matrix */
|
||||
for (i = 0; i < 64; i++) {
|
||||
get_bits(gb, 8);
|
||||
@@ -2907,8 +2870,6 @@ static int read_quant_matrix_ext(MpegEncContext *s, GetBitContext *gb)
|
||||
}
|
||||
|
||||
if (get_bits1(gb)) {
|
||||
if (get_bits_left(gb) < 64*8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
/* chroma_intra_quantiser_matrix */
|
||||
for (i = 0; i < 64; i++) {
|
||||
v = get_bits(gb, 8);
|
||||
@@ -2918,8 +2879,6 @@ static int read_quant_matrix_ext(MpegEncContext *s, GetBitContext *gb)
|
||||
}
|
||||
|
||||
if (get_bits1(gb)) {
|
||||
if (get_bits_left(gb) < 64*8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
/* chroma_non_intra_quantiser_matrix */
|
||||
for (i = 0; i < 64; i++) {
|
||||
get_bits(gb, 8);
|
||||
@@ -2927,7 +2886,6 @@ static int read_quant_matrix_ext(MpegEncContext *s, GetBitContext *gb)
|
||||
}
|
||||
|
||||
next_start_code_studio(gb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void extension_and_user_data(MpegEncContext *s, GetBitContext *gb, int id)
|
||||
@@ -2973,8 +2931,9 @@ static int decode_studio_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
if (get_bits_left(gb) <= 32)
|
||||
return 0;
|
||||
|
||||
s->partitioned_frame = 0;
|
||||
s->interlaced_dct = 0;
|
||||
if (get_bits_long(gb, 32) != VOP_STARTCODE)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
s->decode_mb = mpeg4_decode_studio_mb;
|
||||
|
||||
decode_smpte_tc(ctx, gb);
|
||||
@@ -3023,30 +2982,26 @@ static int decode_studio_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
|
||||
static int decode_studiovisualobject(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
{
|
||||
uint32_t startcode;
|
||||
MpegEncContext *s = &ctx->m;
|
||||
int visual_object_type;
|
||||
int visual_object_type, width, height;
|
||||
|
||||
startcode = get_bits_long(gb, 32);
|
||||
|
||||
/* StudioVisualObject() */
|
||||
if (startcode == VISUAL_OBJ_STARTCODE) {
|
||||
skip_bits(gb, 4); /* visual_object_verid */
|
||||
visual_object_type = get_bits(gb, 4);
|
||||
if (visual_object_type != VOT_VIDEO_ID) {
|
||||
avpriv_request_sample(s->avctx, "VO type %u", visual_object_type);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
next_start_code_studio(gb);
|
||||
extension_and_user_data(s, gb, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
{
|
||||
MpegEncContext *s = &ctx->m;
|
||||
int width, height;
|
||||
int bits_per_raw_sample;
|
||||
|
||||
// random_accessible_vol and video_object_type_indication have already
|
||||
// been read by the caller decode_vol_header()
|
||||
if (visual_object_type == VOT_VIDEO_ID) {
|
||||
/* StudioVideoObjectLayer */
|
||||
skip_bits_long(gb, 32); /* video_object_start_code */
|
||||
skip_bits_long(gb, 32); /* video_object_layer_start_code */
|
||||
skip_bits1(gb); /* random_accessible_vol */
|
||||
skip_bits(gb, 8); /* video_object_type_indication */
|
||||
skip_bits(gb, 4); /* video_object_layer_verid */
|
||||
ctx->shape = get_bits(gb, 2); /* video_object_layer_shape */
|
||||
skip_bits(gb, 4); /* video_object_layer_shape_extension */
|
||||
@@ -3059,8 +3014,8 @@ static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
bits_per_raw_sample = get_bits(gb, 4); /* bit_depth */
|
||||
if (bits_per_raw_sample == 10) {
|
||||
s->avctx->bits_per_raw_sample = get_bits(gb, 4); /* bit_depth */
|
||||
if (s->avctx->bits_per_raw_sample == 10) {
|
||||
if (ctx->rgb) {
|
||||
s->avctx->pix_fmt = AV_PIX_FMT_GBRP10;
|
||||
}
|
||||
@@ -3069,10 +3024,9 @@ static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
}
|
||||
}
|
||||
else {
|
||||
avpriv_request_sample(s->avctx, "MPEG-4 Studio profile bit-depth %u", bits_per_raw_sample);
|
||||
avpriv_request_sample(s->avctx, "MPEG-4 Studio profile bit-depth %u", s->avctx->bits_per_raw_sample);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
s->avctx->bits_per_raw_sample = bits_per_raw_sample;
|
||||
}
|
||||
if (ctx->shape == RECT_SHAPE) {
|
||||
check_marker(s->avctx, gb, "before video_object_layer_width");
|
||||
@@ -3114,6 +3068,8 @@ static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
|
||||
next_start_code_studio(gb);
|
||||
extension_and_user_data(s, gb, 2);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -3134,12 +3090,6 @@ int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
/* search next start code */
|
||||
align_get_bits(gb);
|
||||
|
||||
// If we have not switched to studio profile than we also did not switch bps
|
||||
// that means something else (like a previous instance) outside set bps which
|
||||
// would be inconsistant with the currect state, thus reset it
|
||||
if (!s->studio_profile && s->avctx->bits_per_raw_sample != 8)
|
||||
s->avctx->bits_per_raw_sample = 0;
|
||||
|
||||
if (s->codec_tag == AV_RL32("WV1F") && show_bits(gb, 24) == 0x575630) {
|
||||
skip_bits(gb, 24);
|
||||
if (get_bits(gb, 8) == 0xF0)
|
||||
@@ -3236,25 +3186,19 @@ int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
} else if (startcode == GOP_STARTCODE) {
|
||||
mpeg4_decode_gop_header(s, gb);
|
||||
} else if (startcode == VOS_STARTCODE) {
|
||||
int profile, level;
|
||||
mpeg4_decode_profile_level(s, gb, &profile, &level);
|
||||
if (profile == FF_PROFILE_MPEG4_SIMPLE_STUDIO &&
|
||||
(level > 0 && level < 9)) {
|
||||
mpeg4_decode_profile_level(s, gb);
|
||||
if (s->avctx->profile == FF_PROFILE_MPEG4_SIMPLE_STUDIO &&
|
||||
(s->avctx->level > 0 && s->avctx->level < 9)) {
|
||||
s->studio_profile = 1;
|
||||
next_start_code_studio(gb);
|
||||
extension_and_user_data(s, gb, 0);
|
||||
} else if (s->studio_profile) {
|
||||
avpriv_request_sample(s->avctx, "Mixes studio and non studio profile\n");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
s->avctx->profile = profile;
|
||||
s->avctx->level = level;
|
||||
} else if (startcode == VISUAL_OBJ_STARTCODE) {
|
||||
if (s->studio_profile) {
|
||||
|
||||
if ((ret = decode_studiovisualobject(ctx, gb)) < 0)
|
||||
return ret;
|
||||
} else
|
||||
mpeg4_decode_visual_object(s, gb);
|
||||
break;
|
||||
}
|
||||
} else if (startcode == VISUAL_OBJ_STARTCODE) {
|
||||
mpeg4_decode_visual_object(s, gb);
|
||||
} else if (startcode == VOP_STARTCODE) {
|
||||
break;
|
||||
}
|
||||
@@ -3268,13 +3212,9 @@ end:
|
||||
s->low_delay = 1;
|
||||
s->avctx->has_b_frames = !s->low_delay;
|
||||
|
||||
if (s->studio_profile) {
|
||||
if (!s->avctx->bits_per_raw_sample) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Missing VOL header\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (s->studio_profile)
|
||||
return decode_studio_vop_header(ctx, gb);
|
||||
} else
|
||||
else
|
||||
return decode_vop_header(ctx, gb);
|
||||
}
|
||||
|
||||
|
||||
@@ -882,7 +882,7 @@ void ff_set_mpeg4_time(MpegEncContext *s)
|
||||
|
||||
static void mpeg4_encode_gop_header(MpegEncContext *s)
|
||||
{
|
||||
int64_t hours, minutes, seconds;
|
||||
int hours, minutes, seconds;
|
||||
int64_t time;
|
||||
|
||||
put_bits(&s->pb, 16, 0);
|
||||
|
||||
@@ -99,9 +99,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
|
||||
} else if (codec_id == AV_CODEC_ID_MP3ADU) {
|
||||
avpriv_report_missing_feature(avctx,
|
||||
"MP3ADU full parser");
|
||||
*poutbuf = NULL;
|
||||
*poutbuf_size = 0;
|
||||
return buf_size; /* parsers must not return error codes */
|
||||
return 0; /* parsers must not return error codes */
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "motion_est.h"
|
||||
@@ -58,7 +57,6 @@ do {\
|
||||
int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me,
|
||||
ScratchpadContext *sc, int linesize)
|
||||
{
|
||||
# define EMU_EDGE_HEIGHT (4 * 70)
|
||||
int alloc_size = FFALIGN(FFABS(linesize) + 64, 32);
|
||||
|
||||
if (avctx->hwaccel)
|
||||
@@ -69,16 +67,13 @@ int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me,
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
if (av_image_check_size2(alloc_size, EMU_EDGE_HEIGHT, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
// edge emu needs blocksize + filter length - 1
|
||||
// (= 17x17 for halfpel / 21x21 for H.264)
|
||||
// VC-1 computes luma and chroma simultaneously and needs 19X19 + 9x9
|
||||
// at uvlinesize. It supports only YUV420 so 24x24 is enough
|
||||
// linesize * interlaced * MBsize
|
||||
// we also use this buffer for encoding in encode_mb_internal() needig an additional 32 lines
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, sc->edge_emu_buffer, alloc_size, EMU_EDGE_HEIGHT,
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, sc->edge_emu_buffer, alloc_size, 4 * 70,
|
||||
fail);
|
||||
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, me->scratchpad, alloc_size, 4 * 16 * 2,
|
||||
|
||||
@@ -329,8 +329,6 @@ static av_cold int dct_init(MpegEncContext *s)
|
||||
|
||||
av_cold void ff_mpv_idct_init(MpegEncContext *s)
|
||||
{
|
||||
if (s->codec_id == AV_CODEC_ID_MPEG4)
|
||||
s->idsp.mpeg4_studio_profile = s->studio_profile;
|
||||
ff_idctdsp_init(&s->idsp, s->avctx);
|
||||
|
||||
/* load & permutate scantables
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user