Compare commits
282 Commits
n2.7.2
...
release/2.7
| Author | SHA1 | Date | |
|---|---|---|---|
| 2b6bc8e340 | |||
| 470bdd397f | |||
| 0ca22536c7 | |||
| 4621bc436b | |||
| d94d786bf0 | |||
| 3f69797e9b | |||
| 49fc747b48 | |||
| 526aca805f | |||
| cec42e6f4d | |||
| 7e2c695169 | |||
| cff516d9e8 | |||
| 0696a555b6 | |||
| 62e87d065b | |||
| 3d9f1c0dbb | |||
| 1bccba1893 | |||
| f3da3e2aed | |||
| e112096885 | |||
| c6bb765972 | |||
| 24bd4b363e | |||
| fbe2f77e3f | |||
| 51f686fa77 | |||
| 873ca28390 | |||
| 91b6d89d0a | |||
| 2a73404558 | |||
| 72b224e3f6 | |||
| 7b1803a427 | |||
| f00f588a6e | |||
| dc92c6045f | |||
| 46e4028e69 | |||
| 6fe1f5646e | |||
| c6950985cb | |||
| 751e525757 | |||
| 19257891d1 | |||
| c7b34fa733 | |||
| b8148973c5 | |||
| 8dce138510 | |||
| 13b75ba30a | |||
| 34e76d75a0 | |||
| 010fd5deb6 | |||
| 46e791a9b3 | |||
| d2161b8a6d | |||
| c5e12dc10d | |||
| 4ecb216ad4 | |||
| d2b2c66b17 | |||
| bbea86d809 | |||
| 12f256a729 | |||
| b54b8a628c | |||
| d8b37664d5 | |||
| 41f97fe378 | |||
| 197c0f618a | |||
| 573a7b4c67 | |||
| 3c7597f2e9 | |||
| 965a8bda94 | |||
| e229fbf5ce | |||
| 874945c7b9 | |||
| 974f9d255d | |||
| 302f11e719 | |||
| 8c2f006d10 | |||
| 3cd17b9b5c | |||
| 4180a83892 | |||
| 6fabd85865 | |||
| c6ab367dbe | |||
| 40e846bb3f | |||
| f6755e5e19 | |||
| eb0872335f | |||
| 1b6390dd5b | |||
| edc7ef376b | |||
| 1a88eef93b | |||
| d3cefc271d | |||
| 9d230f4666 | |||
| 4b17205c77 | |||
| 41157f6bff | |||
| f106232e94 | |||
| 269a522aec | |||
| 496c02a065 | |||
| 6fe77207ed | |||
| 00a0c0fd75 | |||
| a21ec4e1ee | |||
| 0c03d860f4 | |||
| a697577a64 | |||
| 99f3f5a8d5 | |||
| d4a7e89793 | |||
| e681e92d2c | |||
| 123d356829 | |||
| 119659b759 | |||
| f0cc6f74fc | |||
| f5060bce31 | |||
| cde38373d1 | |||
| a2b234b917 | |||
| f1cdd93517 | |||
| 0e3c36518d | |||
| 858f43043f | |||
| d0fd9bec1f | |||
| d755045e78 | |||
| 3820c6a979 | |||
| 7cfea0d41c | |||
| 8c08247990 | |||
| 2316c35865 | |||
| 3dd0d43d8c | |||
| 2f6d3459d9 | |||
| 2c58d73413 | |||
| 5b14f436c6 | |||
| d7a13ff23b | |||
| b65c06ee5e | |||
| a7a7c6e44c | |||
| d41b91ba33 | |||
| 34c5f6685a | |||
| 784506c2b5 | |||
| 26241af6f8 | |||
| 7ad0581686 | |||
| 3219de21f4 | |||
| 93eda8dcba | |||
| 1dc135e03d | |||
| f040f3e5d5 | |||
| 7f320ed15d | |||
| 5b88d24f24 | |||
| 3e187a9a2d | |||
| 4bfaa040fc | |||
| 5124bf8ea6 | |||
| 50ce06cc7c | |||
| a628b70831 | |||
| e274976c92 | |||
| 1586fda2fc | |||
| 34b9c7612d | |||
| ea4b99f82c | |||
| 8b30abd020 | |||
| 435b0ab969 | |||
| c78d268e9f | |||
| e56d322032 | |||
| 3ffc224435 | |||
| e7e4c65571 | |||
| 4aa876f288 | |||
| a9ce4583df | |||
| 93fa19addf | |||
| 5c7ffbbda3 | |||
| 8be41ad2bb | |||
| 9a8d2f51cf | |||
| d013f51303 | |||
| 548a07cdc4 | |||
| 0f331f94c0 | |||
| 0a06e2824a | |||
| dc0bc71471 | |||
| 5af5396970 | |||
| d17298b666 | |||
| ece3912daf | |||
| d092b7f04c | |||
| 1601420be4 | |||
| bdf79f29db | |||
| 4e80d4bf25 | |||
| e3ffc7ab4a | |||
| 76cb34f7f5 | |||
| da87a699ea | |||
| 86a52988bd | |||
| d259a0534e | |||
| 710dccf036 | |||
| fc69fa8474 | |||
| 88ccca204a | |||
| 07a3024631 | |||
| cf1f615b67 | |||
| 900039e7dc | |||
| fad0748b92 | |||
| 6c25411c06 | |||
| c1d29678f1 | |||
| 4fe6f9f627 | |||
| 694416e327 | |||
| c1db1a5ff4 | |||
| 8ef86669ca | |||
| 0cd23e0d1e | |||
| ed3d433676 | |||
| 1258bdf7f0 | |||
| 54e94522b8 | |||
| 8405b63294 | |||
| e6264f00ad | |||
| 183f580594 | |||
| 70373bde2d | |||
| 67ed1ee680 | |||
| 1f6c88e287 | |||
| 725d7fb2c6 | |||
| 258584cfaf | |||
| 9e3848328d | |||
| 27f3696502 | |||
| 65dc698607 | |||
| 185126415e | |||
| 93f3752b97 | |||
| cf115791da | |||
| bc3d86cddb | |||
| aa9dadccac | |||
| 0ecde45570 | |||
| ca43c6e1f5 | |||
| 2deaccfe67 | |||
| a9c73b13c1 | |||
| d972df307a | |||
| 082bdba4e7 | |||
| 1039803823 | |||
| acba2a36b3 | |||
| 588a7769c7 | |||
| 08940cd545 | |||
| 196be9284a | |||
| d61c3d1fca | |||
| ec1f59150d | |||
| b996cde193 | |||
| 63465f0070 | |||
| 3300005351 | |||
| 4eb67f3ddc | |||
| ae270314c7 | |||
| b9a3e0af07 | |||
| 132bd4bc4f | |||
| cd8bedb9fa | |||
| d332aa6ec6 | |||
| 169a02da1e | |||
| af3a608e7e | |||
| 327dd70690 | |||
| bcedc2b0f0 | |||
| 6ad10cbec9 | |||
| b0b1b208f5 | |||
| 6acf5ff1d3 | |||
| e98f3ba221 | |||
| 32808460cc | |||
| edf06a0562 | |||
| 5ae4842122 | |||
| ab6f4bc064 | |||
| c3ce508135 | |||
| c6cb24ffbf | |||
| 06c87da410 | |||
| f7ef265387 | |||
| 6d3f047a85 | |||
| f43dac169e | |||
| f10ba15d73 | |||
| 54661cf0b2 | |||
| 50f62fef19 | |||
| abd20c2057 | |||
| d1de492330 | |||
| 04ad22d77a | |||
| a30a30b59a | |||
| 484eb2b0e3 | |||
| 746a65640f | |||
| 50e4d38ce4 | |||
| 1e7ff902f2 | |||
| dceec28eac | |||
| 95db0aa276 | |||
| 1e6f641052 | |||
| 03ef13889c | |||
| ab3f129011 | |||
| ab91919e57 | |||
| 13aaefb70e | |||
| 19a29c92db | |||
| ffcd26d25b | |||
| 42fd94b514 | |||
| 679df05683 | |||
| 717c3ebfa4 | |||
| 43b094fa03 | |||
| 483f5bccc1 | |||
| ce17111ed1 | |||
| a8c8a2f3f4 | |||
| 485372e91c | |||
| b87fc3526f | |||
| d165ec179e | |||
| 94541f5f76 | |||
| 5e71f4aa6a | |||
| 1900d023ae | |||
| 2c8a8a114c | |||
| 99ab664ff8 | |||
| 131f2c366e | |||
| 9362282fd1 | |||
| 1f25a3ddb8 | |||
| e69d8fc619 | |||
| 6197d35a93 | |||
| 8f00ff5ae0 | |||
| eee1faef75 | |||
| 1ef419447e | |||
| 6752f8ef04 | |||
| 98fdd0baf3 | |||
| f7cb979766 | |||
| 0fb4a85603 | |||
| 2ef386d0a6 | |||
| 114c0f002a | |||
| 6b6932471e | |||
| 5ac6daf995 | |||
| 763c0d25b1 | |||
| b1863e3d94 | |||
| 4afccfdc04 | |||
| a3d45dbcc1 |
@@ -1,7 +1,290 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version <next>:
|
||||
version 2.7.7
|
||||
- avformat/ffmdec: Check pix_fmt
|
||||
- avcodec/ttaenc: Reallocate packet if its too small
|
||||
- pgssubdec: fix subpicture output colorspace and range
|
||||
- avcodec/ac3dec: Reset SPX when switching from EAC3 to AC3
|
||||
- avfilter/vf_drawtext: Check return code of load_glyph()
|
||||
- avcodec/takdec: add code that got somehow lost in process of REing
|
||||
- avcodec/apedec: fix decoding of stereo files with one channel full of silence
|
||||
- avcodec/avpacket: Fix off by 5 error
|
||||
- avcodec/h264: Fix for H.264 configuration parsing
|
||||
- avcodec/bmp_parser: Ensure remaining_size is not too small in startcode packet crossing corner case
|
||||
- avfilter/src_movie: fix how we check for overflows with seek_point
|
||||
- avcodec/j2kenc: Add attribution to OpenJPEG project:
|
||||
- avcodec/libutvideodec: copy frame so it has reference counters when refcounted_frames is set
|
||||
- avformat/rtpdec_jpeg: fix low contrast image on low quality setting
|
||||
- avcodec/mjpegenc_common: Store approximate aspect if exact cannot be stored
|
||||
- avcodec/resample: Remove disabled and faulty code
|
||||
- indeo2: Fix banding artefacts
|
||||
- indeo2data: K&R formatting cosmetics
|
||||
- avcodec/imgconvert: Support non-planar colorspaces while padding
|
||||
- avutil/random_seed: Add the runtime in cycles of the main loop to the entropy pool
|
||||
- avutil/channel_layout: AV_CH_LAYOUT_6POINT1_BACK not reachable in parsing
|
||||
- avformat/concatdec: set safe mode to enabled instead of auto
|
||||
- avformat/utils: fix dts from pts code in compute_pkt_fields() during ascending delay
|
||||
- avformat/rtpenc: Fix integer overflow in NTP_TO_RTP_FORMAT
|
||||
- avformat/cache: Fix memleak of tree entries
|
||||
- lavf/mov: fix sidx with edit lists (cherry picked from commit 3617e69d50dd9dd07b5011dfb9477a9d1a630354)
|
||||
- avcodec/mjpegdec: Fix decoding slightly odd progressive jpeg
|
||||
- avcodec/avpacket: clear priv in av_init_packet()
|
||||
- swscale/utils: Fix chrSrcHSubSample for GBRAP16
|
||||
- swscale/input: Fix GBRAP16 input
|
||||
- postproc: fix unaligned access
|
||||
- avutil/pixdesc: Make get_color_type() aware of CIE XYZ formats
|
||||
- avcodec/h264: Execute error concealment before marking the frame as done.
|
||||
- swscale/x86/output: Fix yuv2planeX_16* with unaligned destination
|
||||
- swscale/x86/output: Move code into yuv2planeX_mainloop
|
||||
- avutil/frame: Free destination qp_table_buf in frame_copy_props()
|
||||
- libwebpenc_animencoder: print library messages in verbose log levels
|
||||
- libwebpenc_animencoder: zero initialize the WebPAnimEncoderOptions struct
|
||||
- doc/utils: fix typo for min() description
|
||||
|
||||
|
||||
version 2.7.6
|
||||
- avcodec/jpeg2000dec: More completely check cdef
|
||||
- avutil/opt: check for and handle errors in av_opt_set_dict2()
|
||||
- avcodec/flacenc: fix calculation of bits required in case of custom sample rate
|
||||
- avformat: Document urls a bit
|
||||
- avformat/libquvi: Set default demuxer and protocol limitations
|
||||
- avformat/concat: Check protocol prefix
|
||||
- doc/demuxers: Document enable_drefs and use_absolute_path
|
||||
- avcodec/mjpegdec: Check for end for both bytes in unescaping
|
||||
- avcodec/mpegvideo_enc: Check for integer overflow in ff_mpv_reallocate_putbitbuffer()
|
||||
- avformat/avformat: Replace some references to filenames by urls
|
||||
- avcodec/wmaenc: Check ff_wma_init() for failure
|
||||
- avcodec/mpeg12enc: Move high resolution thread check to before initializing threads
|
||||
- avformat/img2dec: Use AVOpenCallback
|
||||
- avformat/avio: Limit url option parsing to the documented cases
|
||||
- avformat/img2dec: do not interpret the filename by default if a IO context has been opened
|
||||
- avcodec/ass_split: Fix null pointer dereference in ff_ass_style_get()
|
||||
- mov: Add an option to toggle dref opening
|
||||
- avcodec/gif: Fix lzw buffer size
|
||||
- avcodec/put_bits: Assert buf_ptr in flush_put_bits()
|
||||
- avcodec/tiff: Check subsample & rps values more completely
|
||||
- swscale/swscale: Add some sanity checks for srcSlice* parameters
|
||||
- swscale/x86/rgb2rgb_template: Fix planar2x() for short width
|
||||
- swscale/swscale_unscaled: Fix odd height inputs for bayer_to_yv12_wrapper()
|
||||
- swscale/swscale_unscaled: Fix odd height inputs for bayer_to_rgb24_wrapper()
|
||||
- avcodec/aacenc: Check both channels for finiteness
|
||||
- swscale/swscale-test: Fix slice height in random reference data creation.
|
||||
- dca: fix misaligned access in avpriv_dca_convert_bitstream
|
||||
- brstm: fix missing closing brace
|
||||
- brstm: also allocate b->table in read_packet
|
||||
- brstm: make sure an ADPC chunk was read for adpcm_thp
|
||||
- vorbisdec: reject rangebits 0 with non-0 partitions
|
||||
- vorbisdec: reject channel mapping with less than two channels
|
||||
- ffmdec: reset packet_end in case of failure
|
||||
- avformat/ipmovie: put video decoding_map_size into packet and use it in decoder
|
||||
|
||||
version 2.7.5
|
||||
- configure: bump copyright year to 2016
|
||||
- avformat/hls: Even stricter URL checks
|
||||
- avformat/hls: More strict url checks
|
||||
- swscale/utils: Detect and skip unneeded sws_setColorspaceDetails() calls
|
||||
- swscale/yuv2rgb: Increase YUV2RGB table headroom
|
||||
- swscale/yuv2rgb: Factor YUVRGB_TABLE_LUMA_HEADROOM out
|
||||
- avformat/hls: forbid all protocols except http(s) & file
|
||||
- avformat/aviobuf: Fix end check in put_str16()
|
||||
- avformat/asfenc: Check pts
|
||||
- avcodec/mpeg4video: Check time_incr
|
||||
- avcodec/wavpackenc: Check the number of channels
|
||||
- avcodec/wavpackenc: Headers are per channel
|
||||
- avcodec/aacdec_template: Check id_map
|
||||
- avcodec/dvdec: Fix "left shift of negative value -254"
|
||||
- avcodec/mjpegdec: Fix negative shift
|
||||
- avcodec/mss2: Check for repeat overflow
|
||||
- avformat: Add integer fps from 31 to 60 to get_std_framerate()
|
||||
- avcodec/mpegvideo_enc: Clip bits_per_raw_sample within valid range
|
||||
- avfilter/vf_scale: set proper out frame color range
|
||||
- avcodec/motion_est: Fix mv_penalty table size
|
||||
- avcodec/h264_slice: Fix integer overflow in implicit weight computation
|
||||
- swscale/utils: Use normal bilinear scaler if fast cannot be used due to tiny dimensions
|
||||
- avcodec/put_bits: Always check buffer end before writing
|
||||
- mjpegdec: extend check for incompatible values of s->rgb and s->ls
|
||||
- swscale/utils: Fix intermediate format for cascaded alpha downscaling
|
||||
- x86/float_dsp: zero extend offset from ff_scalarproduct_float_sse
|
||||
- avfilter/vf_zoompan: do not free frame we pushed to lavfi
|
||||
|
||||
|
||||
version 2.7.4
|
||||
- nuv: sanitize negative fps rate
|
||||
- rawdec: only exempt BIT0 with need_copy from buffer sanity check
|
||||
- mlvdec: check that index_entries exist
|
||||
- nutdec: reject negative value_len in read_sm_data
|
||||
- xwddec: prevent overflow of lsize * avctx->height
|
||||
- nutdec: only copy the header if it exists
|
||||
- exr: fix out of bounds read in get_code
|
||||
- on2avc: limit number of bits to 30 in get_egolomb
|
||||
- avcodec/mpeg4videodec: also for empty partitioned slices
|
||||
- avcodec/h264_refs: Fix long_idx check
|
||||
- avcodec/h264_mc_template: prefetch list1 only if it is used in the MB
|
||||
- avcodec/h264_slice: Simplify ref2frm indexing
|
||||
- Revert "avcodec/aarch64/neon.S: Update neon.s for transpose_4x4H"
|
||||
- avfilter/vf_mpdecimate: Add missing emms_c()
|
||||
- sonic: make sure num_taps * channels is not larger than frame_size
|
||||
- opus_silk: fix typo causing overflow in silk_stabilize_lsf
|
||||
- ffm: reject invalid codec_id and codec_type
|
||||
- golomb: always check for invalid UE golomb codes in get_ue_golomb
|
||||
- aaccoder: prevent crash of anmr coder
|
||||
- ffmdec: reject zero-sized chunks
|
||||
- swscale/x86/rgb2rgb_template: Fallback to mmx in interleaveBytes() if the alignment is insufficient for SSE*
|
||||
- swscale/x86/rgb2rgb_template: Do not crash on misaligend stride
|
||||
- avformat/mxfenc: Do not crash if there is no packet in the first stream
|
||||
- avcodec/aarch64/neon.S: Update neon.s for transpose_4x4H
|
||||
- avformat/utils: estimate_timings_from_pts - increase retry counter, fixes invalid duration for ts files with hevc codec
|
||||
- avformat/matroskaenc: Check codecdelay before use
|
||||
- avutil/mathematics: Fix division by 0
|
||||
- mjpegdec: consider chroma subsampling in size check
|
||||
- avcodec/hevc: Check max ctb addresses for WPP
|
||||
- avcodec/vp3: ensure header is parsed successfully before tables
|
||||
- avcodec/jpeg2000dec: Check bpno in decode_cblk()
|
||||
- avcodec/pgssubdec: Fix left shift of 255 by 24 places cannot be represented in type int
|
||||
- swscale/utils: Fix for runtime error: left shift of negative value -1
|
||||
- avcodec/hevc: Fix integer overflow of entry_point_offset
|
||||
- avcodec/dirac_parser: Check that there is a previous PU before accessing it
|
||||
- avcodec/dirac_parser: Add basic validity checks for next_pu_offset and prev_pu_offset
|
||||
- avcodec/dirac_parser: Fix potential overflows in pointer checks
|
||||
- avcodec/wmaprodec: Check bits per sample to be within the range not causing integer overflows
|
||||
- avcodec/wmaprodec: Fix overflow of cutoff
|
||||
- avformat/smacker: fix integer overflow with pts_inc
|
||||
- avcodec/vp3: Fix "runtime error: left shift of negative value"
|
||||
- mpegencts: Fix overflow in cbr mode period calculations
|
||||
- avutil/timecode: Fix fps check
|
||||
- avutil/mathematics: return INT64_MIN (=AV_NOPTS_VALUE) from av_rescale_rnd() for overflows
|
||||
- avcodec/apedec: Check length in long_filter_high_3800()
|
||||
- avcodec/vp3: always set pix_fmt in theora_decode_header()
|
||||
- avcodec/mpeg4videodec: Check available data before reading custom matrix
|
||||
- avutil/mathematics: Do not treat INT64_MIN as positive in av_rescale_rnd
|
||||
- avutil/integer: Fix av_mod_i() with negative dividend
|
||||
- avformat/dump: Fix integer overflow in av_dump_format()
|
||||
- avcodec/h264_refs: Check that long references match before use
|
||||
- avcodec/utils: Clear dimensions in ff_get_buffer() on failure
|
||||
- avcodec/utils: Use 64bit for aspect ratio calculation in avcodec_string()
|
||||
- avcodec/vp3: Clear context on reinitialization failure
|
||||
- avcodec/hevc: allocate entries unconditionally
|
||||
- avcodec/hevc_cabac: Fix multiple integer overflows
|
||||
- avcodec/jpeg2000dwt: Check ndeclevels before calling dwt_encode*()
|
||||
- avcodec/jpeg2000dwt: Check ndeclevels before calling dwt_decode*()
|
||||
- avcodec/hevc: Check entry_point_offsets
|
||||
- avcodec/cabac: Check initial cabac decoder state
|
||||
- avcodec/cabac_functions: Fix "left shift of negative value -31767"
|
||||
- avcodec/h264_slice: Limit max_contexts when slice_context_count is initialized
|
||||
- avcodec/vp8: Do not use num_coeff_partitions in thread/buffer setup
|
||||
- avcodec/ffv1dec: Clear quant_table_count if its invalid
|
||||
- avcodec/ffv1dec: Print an error if the quant table count is invalid
|
||||
- doc/filters/drawtext: fix centering example
|
||||
- hqx: correct type and size check of info_offset
|
||||
- mxfdec: check edit_rate also for physical_track
|
||||
- mpegvideo: clear overread in clear_context
|
||||
- dvdsubdec: validate offset2 similar to offset1
|
||||
- aacdec: don't return frames without data from aac_decode_er_frame
|
||||
- avcodec/takdec: Use memove, avoid undefined memcpy() use
|
||||
- riffdec: prevent negative bit rate
|
||||
|
||||
|
||||
version 2.7.3:
|
||||
- rtmpcrypt: Do the xtea decryption in little endian mode
|
||||
- Update versions for 2.7.3
|
||||
- avformat/matroskadec: Check subtitle stream before dereferencing
|
||||
- avformat/utils: Do not init parser if probing is unfinished
|
||||
- avcodec/jpeg2000dec: Fix potential integer overflow with tile dimensions
|
||||
- avcodec/jpeg2000dec: Check SIZ dimensions to be within the supported range
|
||||
- avcodec/jpeg2000: Check comp coords to be within the supported size
|
||||
- avcodec/jpeg2000: Use av_image_check_size() in ff_jpeg2000_init_component()
|
||||
- avcodec/wmaprodec: Check for overread in decode_packet()
|
||||
- avcodec/smacker: Check that the data size is a multiple of a sample vector
|
||||
- avcodec/takdec: Skip last p2 sample (which is unused)
|
||||
- avcodec/dxtory: Fix input size check in dxtory_decode_v1_410()
|
||||
- avcodec/dxtory: Fix input size check in dxtory_decode_v1_420()
|
||||
- avcodec/error_resilience: avoid accessing previous or next frames tables beyond height
|
||||
- avcodec/dpx: Move need_align to act per line
|
||||
- avcodec/flashsv: Check size before updating it
|
||||
- avcodec/ivi: Check image dimensions
|
||||
- avcodec/utils: Better check for channels in av_get_audio_frame_duration()
|
||||
- avcodec/jpeg2000dec: Check for duplicate SIZ marker
|
||||
- tests/fate/avformat: Fix fate-lavf
|
||||
- doc/ffmpeg: Clarify that the sdp_file option requires an rtp output.
|
||||
- ffmpeg: Don't try and write sdp info if none of the outputs had an rtp format.
|
||||
- apng: use correct size for output buffer
|
||||
- jvdec: avoid unsigned overflow in comparison
|
||||
- avcodec/hevc_ps: Check chroma_format_idc
|
||||
- avcodec/jpeg2000dec: Clip all tile coordinates
|
||||
- avcodec/microdvddec: Check for string end in 'P' case
|
||||
- avcodec/dirac_parser: Fix undefined memcpy() use
|
||||
- avformat/xmv: Discard remainder of packet on error
|
||||
- avformat/xmv: factor return check out of if/else
|
||||
- avcodec/mpeg12dec: Do not call show_bits() with invalid bits
|
||||
- libavutil/channel_layout: Check strtol*() for failure
|
||||
- avcodec/ffv1dec: Check for 0 quant tables
|
||||
- avcodec/mjpegdec: Reinitialize IDCT on BPP changes
|
||||
- avcodec/mjpegdec: Check index in ljpeg_decode_yuv_scan() before using it
|
||||
- avutil/file_open: avoid file handle inheritance on Windows
|
||||
- avcodec/h264_slice: Disable slice threads if there are multiple access units in a packet
|
||||
- opusdec: Don't run vector_fmul_scalar on zero length arrays
|
||||
- avcodec/ffv1: Initialize vlc_state on allocation
|
||||
- avcodec/ffv1dec: update progress in case of broken pointer chains
|
||||
- avcodec/ffv1dec: Clear slice coordinates if they are invalid or slice header decoding fails for other reasons
|
||||
- avformat/httpauth: Add space after commas in HTTP/RTSP auth header
|
||||
- avcodec/x86/sbrdsp: Fix using uninitialized upper 32bit of noise
|
||||
- avcodec/ffv1dec: Fix off by 1 error in quant_table_count check
|
||||
- avcodec/ffv1dec: Explicitly check read_quant_table() return value
|
||||
- avcodec/rangecoder: Check e
|
||||
- avutil/log: fix zero length gnu_printf format string warning
|
||||
- lavf/webvttenc: Require webvtt file to contain exactly one WebVTT stream.
|
||||
- avcodec/mjpegdec: Fix decoding RGBA RCT LJPEG
|
||||
- avfilter/af_asyncts: use llabs for int64_t
|
||||
- avcodec/g2meet: Also clear tile dimensions on header_fail
|
||||
- avcodec/g2meet: Fix potential overflow in tile dimensions check
|
||||
- avcodec/svq1dec: Check init_get_bits8() for failure
|
||||
- avcodec/tta: Check init_get_bits8() for failure
|
||||
- avcodec/vp3: Check init_get_bits8() for failure
|
||||
- swresample/swresample: Fix integer overflow in seed calculation
|
||||
- avformat/mov: Fix integer overflow in FFABS
|
||||
- avutil/common: Add FFNABS()
|
||||
- avutil/common: Document FFABS() corner case
|
||||
- avformat/dump: Fix integer overflow in aspect ratio calculation
|
||||
- avformat/mxg: Use memmove()
|
||||
- avcodec/truemotion1: Check for even width
|
||||
- avcodec/mpeg12dec: Set dimensions in mpeg1_decode_sequence() only in absence of errors
|
||||
- avcodec/libopusenc: Fix infinite loop on flushing after 0 input
|
||||
- avformat/hevc: Check num_long_term_ref_pics_sps to avoid potentially long loops
|
||||
- avformat/hevc: Fix parsing errors
|
||||
- ffmpeg: Use correct codec_id for av_parser_change() check
|
||||
- ffmpeg: Check av_parser_change() for failure
|
||||
- ffmpeg: Check for RAWVIDEO and do not relay only on AVFMT_RAWPICTURE
|
||||
- ffmpeg: check avpicture_fill() return value
|
||||
- avformat/mux: Update sidedata in ff_write_chained()
|
||||
- avcodec/flashsvenc: Correct max dimension in error message
|
||||
- avcodec/svq1enc: Check dimensions
|
||||
- avcodec/dcaenc: clear bitstream end
|
||||
- libavcodec/aacdec_template: Use init_get_bits8() in aac_decode_frame()
|
||||
- rawdec: fix mjpeg probing buffer size check
|
||||
- rawdec: fix mjpeg probing
|
||||
- configure: loongson disable expensive optimizations in gcc O3 optimization
|
||||
- videodsp: don't overread edges in vfix3 emu_edge.
|
||||
- avformat/mp3dec: improve junk skipping heuristic
|
||||
- avformat/hls: add support for EXT-X-MAP
|
||||
- avformat/hls: fix segment selection regression on track changes of live streams
|
||||
- lavf/matroskadec: Fully parse and repack MP3 packets
|
||||
- avcodec/h264_mp4toannexb_bsf: Reorder operations in nal_size check
|
||||
- avformat/oggenc: Check segments_count for headers too
|
||||
- avformat/segment: atomically update list if possible
|
||||
- avformat/avidec: Workaround broken initial frame
|
||||
- hevc: properly handle no_rasl_output_flag when removing pictures from the DPB
|
||||
- hevc: fix wpp threading deadlock.
|
||||
- avcodec/ffv1: separate slice_count from max_slice_count
|
||||
- lavf/img2dec: Fix memory leak
|
||||
- avcodec/mp3: fix skipping zeros
|
||||
- avformat/srtdec: make sure we probe a number
|
||||
- avformat/srtdec: more lenient first line probing
|
||||
- doc: mention libavcodec can decode Opus natively
|
||||
- avcodec/ffv1enc: fix assertion failure with unset bits per raw sample
|
||||
- MAINTAINERS: Remove myself as leader
|
||||
- mips/hevcdsp: fix string concatenation on macros
|
||||
|
||||
|
||||
version 2.7.2:
|
||||
- imc: use correct position for flcoeffs2 calculation
|
||||
|
||||
+1
-3
@@ -14,7 +14,6 @@ patches and related discussions.
|
||||
Project Leader
|
||||
==============
|
||||
|
||||
Michael Niedermayer
|
||||
final design decisions
|
||||
|
||||
|
||||
@@ -540,6 +539,7 @@ Windows ICL Matthew Oliver
|
||||
ADI/Blackfin DSP Marc Hoffman
|
||||
Sparc Roman Shaposhnik
|
||||
x86 Michael Niedermayer
|
||||
OS/2 KO Myung-Hun
|
||||
|
||||
|
||||
Releases
|
||||
@@ -548,8 +548,6 @@ Releases
|
||||
2.7 Michael Niedermayer
|
||||
2.6 Michael Niedermayer
|
||||
2.5 Michael Niedermayer
|
||||
2.4 Michael Niedermayer
|
||||
2.2 Michael Niedermayer
|
||||
|
||||
If you want to maintain an older release, please contact us
|
||||
|
||||
|
||||
@@ -3965,7 +3965,7 @@ elif enabled mips; then
|
||||
enable fast_cmov
|
||||
enable fast_unaligned
|
||||
disable aligned_stack
|
||||
cpuflags="-march=loongson3a -mhard-float"
|
||||
cpuflags="-march=loongson3a -mhard-float -fno-expensive-optimizations"
|
||||
;;
|
||||
generic)
|
||||
disable mips32r5
|
||||
@@ -5950,7 +5950,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 2015
|
||||
#define CONFIG_THIS_YEAR 2016
|
||||
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
|
||||
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
|
||||
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 2.7.2
|
||||
PROJECT_NUMBER = 2.7.7
|
||||
|
||||
# With the PROJECT_LOGO tag one can specify a logo or icon that is included
|
||||
# in the documentation. The maximum height of the logo should not exceed 55
|
||||
|
||||
+21
-2
@@ -98,7 +98,7 @@ All subsequent file-related directives apply to that file.
|
||||
|
||||
@item @code{ffconcat version 1.0}
|
||||
Identify the script type and version. It also sets the @option{safe} option
|
||||
to 1 if it was to its default -1.
|
||||
to 1 if it was -1.
|
||||
|
||||
To make FFmpeg recognize the format automatically, this directive must
|
||||
appears exactly as is (no extra space or byte-order-mark) on the very first
|
||||
@@ -145,7 +145,9 @@ component.
|
||||
|
||||
If set to 0, any file name is accepted.
|
||||
|
||||
The default is -1, it is equivalent to 1 if the format was automatically
|
||||
The default is 1.
|
||||
|
||||
-1 is equivalent to 1 if the format was automatically
|
||||
probed and 0 otherwise.
|
||||
|
||||
@item auto_convert
|
||||
@@ -369,6 +371,23 @@ ffmpeg -framerate 10 -pattern_type glob -i "*.png" out.mkv
|
||||
@end example
|
||||
@end itemize
|
||||
|
||||
@section mov/mp4/3gp/Quicktme
|
||||
|
||||
Quicktime / MP4 demuxer.
|
||||
|
||||
This demuxer accepts the following options:
|
||||
@table @option
|
||||
@item enable_drefs
|
||||
Enable loading of external tracks, disabled by default.
|
||||
Enabling this can theoretically leak information in some use cases.
|
||||
|
||||
@item use_absolute_path
|
||||
Allows loading of external tracks via absolute paths, disabled by default.
|
||||
Enabling this poses a security risk. It should only be enabled if the source
|
||||
is known to be non malicious.
|
||||
|
||||
@end table
|
||||
|
||||
@section mpegts
|
||||
|
||||
MPEG-2 transport stream demuxer.
|
||||
|
||||
+2
-2
@@ -1193,9 +1193,9 @@ The option is intended for cases where features are needed that cannot be
|
||||
specified to @command{ffserver} but can be to @command{ffmpeg}.
|
||||
|
||||
@item -sdp_file @var{file} (@emph{global})
|
||||
Print sdp information to @var{file}.
|
||||
Print sdp information for an output stream to @var{file}.
|
||||
This allows dumping sdp information when at least one output isn't an
|
||||
rtp stream.
|
||||
rtp stream. (Requires at least one of the output formats to be rtp).
|
||||
|
||||
@item -discard (@emph{input})
|
||||
Allows discarding specific streams or frames of streams at the demuxer.
|
||||
|
||||
+1
-1
@@ -4343,7 +4343,7 @@ within the parameter list.
|
||||
@item
|
||||
Show the text at the center of the video frame:
|
||||
@example
|
||||
drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2"
|
||||
drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
|
||||
@end example
|
||||
|
||||
@item
|
||||
|
||||
+2
-2
@@ -954,8 +954,8 @@ following image formats are supported:
|
||||
@item Musepack SV8 @tab @tab X
|
||||
@item Nellymoser Asao @tab X @tab X
|
||||
@item On2 AVC (Audio for Video Codec) @tab @tab X
|
||||
@item Opus @tab E @tab E
|
||||
@tab supported through external library libopus
|
||||
@item Opus @tab E @tab X
|
||||
@tab encoding supported through external library libopus
|
||||
@item PCM A-law @tab X @tab X
|
||||
@item PCM mu-law @tab X @tab X
|
||||
@item PCM signed 8-bit planar @tab X @tab X
|
||||
|
||||
+1
-1
@@ -861,7 +861,7 @@ Return 1 if @var{x} is lesser than or equal to @var{y}, 0 otherwise.
|
||||
Return the maximum between @var{x} and @var{y}.
|
||||
|
||||
@item min(x, y)
|
||||
Return the maximum between @var{x} and @var{y}.
|
||||
Return the minimum between @var{x} and @var{y}.
|
||||
|
||||
@item mod(x, y)
|
||||
Compute the remainder of division of @var{x} by @var{y}.
|
||||
|
||||
@@ -1800,17 +1800,21 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
|
||||
|
||||
opkt.duration = av_rescale_q(pkt->duration, ist->st->time_base, ost->st->time_base);
|
||||
opkt.flags = pkt->flags;
|
||||
|
||||
// FIXME remove the following 2 lines they shall be replaced by the bitstream filters
|
||||
if ( ost->enc_ctx->codec_id != AV_CODEC_ID_H264
|
||||
&& ost->enc_ctx->codec_id != AV_CODEC_ID_MPEG1VIDEO
|
||||
&& ost->enc_ctx->codec_id != AV_CODEC_ID_MPEG2VIDEO
|
||||
&& ost->enc_ctx->codec_id != AV_CODEC_ID_VC1
|
||||
if ( ost->st->codec->codec_id != AV_CODEC_ID_H264
|
||||
&& ost->st->codec->codec_id != AV_CODEC_ID_MPEG1VIDEO
|
||||
&& ost->st->codec->codec_id != AV_CODEC_ID_MPEG2VIDEO
|
||||
&& ost->st->codec->codec_id != AV_CODEC_ID_VC1
|
||||
) {
|
||||
if (av_parser_change(ost->parser, ost->st->codec,
|
||||
int ret = av_parser_change(ost->parser, ost->st->codec,
|
||||
&opkt.data, &opkt.size,
|
||||
pkt->data, pkt->size,
|
||||
pkt->flags & AV_PKT_FLAG_KEY)) {
|
||||
pkt->flags & AV_PKT_FLAG_KEY);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL, "av_parser_change failed\n");
|
||||
exit_program(1);
|
||||
}
|
||||
if (ret) {
|
||||
opkt.buf = av_buffer_create(opkt.data, opkt.size, av_buffer_default_free, NULL, 0);
|
||||
if (!opkt.buf)
|
||||
exit_program(1);
|
||||
@@ -1821,9 +1825,15 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
|
||||
}
|
||||
av_copy_packet_side_data(&opkt, pkt);
|
||||
|
||||
if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (of->ctx->oformat->flags & AVFMT_RAWPICTURE)) {
|
||||
if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
|
||||
ost->st->codec->codec_id == AV_CODEC_ID_RAWVIDEO &&
|
||||
(of->ctx->oformat->flags & AVFMT_RAWPICTURE)) {
|
||||
/* store AVPicture in AVPacket, as expected by the output format */
|
||||
avpicture_fill(&pict, opkt.data, ost->st->codec->pix_fmt, ost->st->codec->width, ost->st->codec->height);
|
||||
int ret = avpicture_fill(&pict, opkt.data, ost->st->codec->pix_fmt, ost->st->codec->width, ost->st->codec->height);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL, "avpicture_fill failed\n");
|
||||
exit_program(1);
|
||||
}
|
||||
opkt.data = (uint8_t *)&pict;
|
||||
opkt.size = sizeof(AVPicture);
|
||||
opkt.flags |= AV_PKT_FLAG_KEY;
|
||||
@@ -2360,6 +2370,9 @@ static void print_sdp(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (!j)
|
||||
goto fail;
|
||||
|
||||
av_sdp_create(avc, j, sdp, sizeof(sdp));
|
||||
|
||||
if (!sdp_filename) {
|
||||
@@ -2375,6 +2388,7 @@ static void print_sdp(void)
|
||||
}
|
||||
}
|
||||
|
||||
fail:
|
||||
av_freep(&avc);
|
||||
}
|
||||
|
||||
|
||||
@@ -728,7 +728,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s,
|
||||
}
|
||||
while (idx) {
|
||||
sce->sf_idx[bandaddr[idx]] = minq + q0;
|
||||
minq = paths[idx][minq].prev;
|
||||
minq = FFMAX(paths[idx][minq].prev, 0);
|
||||
idx--;
|
||||
}
|
||||
//set the same quantizers inside window groups
|
||||
|
||||
+10
-1
@@ -473,6 +473,10 @@ static int output_configure(AACContext *ac,
|
||||
int type = layout_map[i][0];
|
||||
int id = layout_map[i][1];
|
||||
id_map[type][id] = type_counts[type]++;
|
||||
if (id_map[type][id] >= MAX_ELEM_ID) {
|
||||
avpriv_request_sample(ac->avctx, "Remapped id too large\n");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
}
|
||||
// Try to sniff a reasonable channel order, otherwise output the
|
||||
// channels in the order the PCE declared them.
|
||||
@@ -2940,6 +2944,11 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
spectral_to_sample(ac);
|
||||
|
||||
if (!ac->frame->data[0] && samples) {
|
||||
av_log(avctx, AV_LOG_ERROR, "no frame data found\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
ac->frame->nb_samples = samples;
|
||||
ac->frame->sample_rate = avctx->sample_rate;
|
||||
*got_frame_ptr = 1;
|
||||
@@ -3178,7 +3187,7 @@ static int aac_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if (INT_MAX / 8 <= buf_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((err = init_get_bits(&gb, buf, buf_size * 8)) < 0)
|
||||
if ((err = init_get_bits8(&gb, buf, buf_size)) < 0)
|
||||
return err;
|
||||
|
||||
switch (ac->oc[1].m4ac.object_type) {
|
||||
|
||||
+10
-2
@@ -589,8 +589,16 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
ics->group_len[w] = wi[ch].grouping[w];
|
||||
|
||||
apply_window_and_mdct(s, &cpe->ch[ch], overlap);
|
||||
if (isnan(cpe->ch->coeffs[0])) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Input contains NaN\n");
|
||||
|
||||
if (isnan(cpe->ch[ch].coeffs[ 0]) || isinf(cpe->ch[ch].coeffs[ 0]) ||
|
||||
isnan(cpe->ch[ch].coeffs[ 128]) || isinf(cpe->ch[ch].coeffs[ 128]) ||
|
||||
isnan(cpe->ch[ch].coeffs[2*128]) || isinf(cpe->ch[ch].coeffs[2*128]) ||
|
||||
isnan(cpe->ch[ch].coeffs[3*128]) || isinf(cpe->ch[ch].coeffs[3*128]) ||
|
||||
isnan(cpe->ch[ch].coeffs[4*128]) || isinf(cpe->ch[ch].coeffs[4*128]) ||
|
||||
isnan(cpe->ch[ch].coeffs[5*128]) || isinf(cpe->ch[ch].coeffs[5*128]) ||
|
||||
isnan(cpe->ch[ch].coeffs[6*128]) || isinf(cpe->ch[ch].coeffs[6*128]) ||
|
||||
isnan(cpe->ch[ch].coeffs[7*128]) || isinf(cpe->ch[ch].coeffs[7*128])) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Input contains NaN/+-Inf\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-5
@@ -901,11 +901,13 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
|
||||
ff_eac3_default_spx_band_struct,
|
||||
&s->num_spx_bands,
|
||||
s->spx_band_sizes);
|
||||
} else {
|
||||
for (ch = 1; ch <= fbw_channels; ch++) {
|
||||
s->channel_uses_spx[ch] = 0;
|
||||
s->first_spx_coords[ch] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!s->eac3 || !s->spx_in_use) {
|
||||
s->spx_in_use = 0;
|
||||
for (ch = 1; ch <= fbw_channels; ch++) {
|
||||
s->channel_uses_spx[ch] = 0;
|
||||
s->first_spx_coords[ch] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -892,6 +892,9 @@ static void long_filter_high_3800(int32_t *buffer, int order, int shift, int len
|
||||
int32_t dotprod, sign;
|
||||
int32_t coeffs[256], delay[256];
|
||||
|
||||
if (order >= length)
|
||||
return;
|
||||
|
||||
memset(coeffs, 0, order * sizeof(*coeffs));
|
||||
for (i = 0; i < order; i++)
|
||||
delay[i] = buffer[i];
|
||||
@@ -1369,7 +1372,7 @@ static void ape_unpack_stereo(APEContext *ctx, int count)
|
||||
int32_t *decoded0 = ctx->decoded[0];
|
||||
int32_t *decoded1 = ctx->decoded[1];
|
||||
|
||||
if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) {
|
||||
if ((ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) == APE_FRAMECODE_STEREO_SILENCE) {
|
||||
/* We are pure silence, so we're done. */
|
||||
av_log(ctx->avctx, AV_LOG_DEBUG, "pure silence stereo\n");
|
||||
return;
|
||||
|
||||
@@ -523,7 +523,7 @@ ASSStyle *ff_ass_style_get(ASSSplitContext *ctx, const char *style)
|
||||
if (!style || !*style)
|
||||
style = "Default";
|
||||
for (i=0; i<ass->styles_count; i++)
|
||||
if (!strcmp(ass->styles[i].name, style))
|
||||
if (ass->styles[i].name && !strcmp(ass->styles[i].name, style))
|
||||
return ass->styles + i;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ void av_init_packet(AVPacket *pkt)
|
||||
#if FF_API_DESTRUCT_PACKET
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
pkt->destruct = NULL;
|
||||
pkt->priv = NULL;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
pkt->buf = NULL;
|
||||
@@ -410,10 +411,12 @@ int av_packet_split_side_data(AVPacket *pkt){
|
||||
p = pkt->data + pkt->size - 8 - 5;
|
||||
for (i=1; ; i++){
|
||||
size = AV_RB32(p);
|
||||
if (size>INT_MAX || p - pkt->data < size)
|
||||
if (size>INT_MAX - 5 || p - pkt->data < size)
|
||||
return 0;
|
||||
if (p[4]&128)
|
||||
break;
|
||||
if (p - pkt->data < size + 5)
|
||||
return 0;
|
||||
p-= size+5;
|
||||
}
|
||||
|
||||
@@ -424,7 +427,7 @@ int av_packet_split_side_data(AVPacket *pkt){
|
||||
p= pkt->data + pkt->size - 8 - 5;
|
||||
for (i=0; ; i++){
|
||||
size= AV_RB32(p);
|
||||
av_assert0(size<=INT_MAX && p - pkt->data >= size);
|
||||
av_assert0(size<=INT_MAX - 5 && p - pkt->data >= size);
|
||||
pkt->side_data[i].data = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
pkt->side_data[i].size = size;
|
||||
pkt->side_data[i].type = p[4]&127;
|
||||
|
||||
@@ -63,7 +63,7 @@ restart:
|
||||
continue;
|
||||
}
|
||||
bpc->pc.frame_start_found++;
|
||||
bpc->remaining_size = bpc->fsize + i - 17;
|
||||
bpc->remaining_size = bpc->fsize + FFMAX(i - 17, 0);
|
||||
|
||||
if (bpc->pc.index + i > 17) {
|
||||
next = i - 17;
|
||||
|
||||
+4
-1
@@ -51,7 +51,7 @@ void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size){
|
||||
*
|
||||
* @param buf_size size of buf in bits
|
||||
*/
|
||||
void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size){
|
||||
int ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size){
|
||||
c->bytestream_start=
|
||||
c->bytestream= buf;
|
||||
c->bytestream_end= buf + buf_size;
|
||||
@@ -64,6 +64,9 @@ void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size){
|
||||
#endif
|
||||
c->low+= ((*c->bytestream++)<<2) + 2;
|
||||
c->range= 0x1FE;
|
||||
if ((c->range<<(CABAC_BITS+1)) < c->low)
|
||||
return AVERROR_INVALIDDATA;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ff_init_cabac_states(void)
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ typedef struct CABACContext{
|
||||
}CABACContext;
|
||||
|
||||
void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size);
|
||||
void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size);
|
||||
int ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size);
|
||||
void ff_init_cabac_states(void);
|
||||
|
||||
#endif /* AVCODEC_CABAC_H */
|
||||
|
||||
@@ -74,7 +74,8 @@ static inline void renorm_cabac_decoder_once(CABACContext *c){
|
||||
|
||||
#ifndef get_cabac_inline
|
||||
static void refill2(CABACContext *c){
|
||||
int i, x;
|
||||
int i;
|
||||
unsigned x;
|
||||
|
||||
x= c->low ^ (c->low-1);
|
||||
i= 7 - ff_h264_norm_shift[x>>(CABAC_BITS-1)];
|
||||
@@ -190,7 +191,8 @@ static av_unused const uint8_t* skip_bytes(CABACContext *c, int n) {
|
||||
#endif
|
||||
if ((int) (c->bytestream_end - ptr) < n)
|
||||
return NULL;
|
||||
ff_init_cabac_decoder(c, ptr + n, c->bytestream_end - ptr - n);
|
||||
if (ff_init_cabac_decoder(c, ptr + n, c->bytestream_end - ptr - n) < 0)
|
||||
return NULL;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
+5
-4
@@ -41,8 +41,6 @@ int avpriv_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst,
|
||||
{
|
||||
uint32_t mrk;
|
||||
int i, tmp;
|
||||
const uint16_t *ssrc = (const uint16_t *) src;
|
||||
uint16_t *sdst = (uint16_t *) dst;
|
||||
PutBitContext pb;
|
||||
|
||||
if ((unsigned) src_size > (unsigned) max_size)
|
||||
@@ -54,8 +52,11 @@ int avpriv_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst,
|
||||
memcpy(dst, src, src_size);
|
||||
return src_size;
|
||||
case DCA_SYNCWORD_CORE_LE:
|
||||
for (i = 0; i < (src_size + 1) >> 1; i++)
|
||||
*sdst++ = av_bswap16(*ssrc++);
|
||||
for (i = 0; i < (src_size + 1) >> 1; i++) {
|
||||
AV_WB16(dst, AV_RL16(src));
|
||||
src += 2;
|
||||
dst += 2;
|
||||
}
|
||||
return src_size;
|
||||
case DCA_SYNCWORD_CORE_14B_BE:
|
||||
case DCA_SYNCWORD_CORE_14B_LE:
|
||||
|
||||
@@ -938,6 +938,10 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
for (i = 0; i < SUBFRAMES; i++)
|
||||
put_subframe(c, i);
|
||||
|
||||
|
||||
for (i = put_bits_count(&c->pb); i < 8*c->frame_size; i++)
|
||||
put_bits(&c->pb, 1, 0);
|
||||
|
||||
flush_put_bits(&c->pb);
|
||||
|
||||
avpkt->pts = frame->pts;
|
||||
|
||||
@@ -100,10 +100,12 @@ typedef struct DiracParseUnit {
|
||||
static int unpack_parse_unit(DiracParseUnit *pu, DiracParseContext *pc,
|
||||
int offset)
|
||||
{
|
||||
uint8_t *start = pc->buffer + offset;
|
||||
uint8_t *end = pc->buffer + pc->index;
|
||||
if (start < pc->buffer || (start + 13 > end))
|
||||
int8_t *start;
|
||||
|
||||
if (offset < 0 || pc->index - 13 < offset)
|
||||
return 0;
|
||||
|
||||
start = pc->buffer + offset;
|
||||
pu->pu_type = start[4];
|
||||
|
||||
pu->next_pu_offset = AV_RB32(start + 5);
|
||||
@@ -112,6 +114,15 @@ static int unpack_parse_unit(DiracParseUnit *pu, DiracParseContext *pc,
|
||||
if (pu->pu_type == 0x10 && pu->next_pu_offset == 0)
|
||||
pu->next_pu_offset = 13;
|
||||
|
||||
if (pu->next_pu_offset && pu->next_pu_offset < 13) {
|
||||
av_log(NULL, AV_LOG_ERROR, "next_pu_offset %d is invalid\n", pu->next_pu_offset);
|
||||
return 0;
|
||||
}
|
||||
if (pu->prev_pu_offset && pu->prev_pu_offset < 13) {
|
||||
av_log(NULL, AV_LOG_ERROR, "prev_pu_offset %d is invalid\n", pu->prev_pu_offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -123,7 +134,7 @@ static int dirac_combine_frame(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||
DiracParseContext *pc = s->priv_data;
|
||||
|
||||
if (pc->overread_index) {
|
||||
memcpy(pc->buffer, pc->buffer + pc->overread_index,
|
||||
memmove(pc->buffer, pc->buffer + pc->overread_index,
|
||||
pc->index - pc->overread_index);
|
||||
pc->index -= pc->overread_index;
|
||||
pc->overread_index = 0;
|
||||
@@ -190,7 +201,7 @@ static int dirac_combine_frame(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||
}
|
||||
|
||||
/* Get the picture number to set the pts and dts*/
|
||||
if (parse_timing_info) {
|
||||
if (parse_timing_info && pu1.prev_pu_offset >= 13) {
|
||||
uint8_t *cur_pu = pc->buffer +
|
||||
pc->index - 13 - pu1.prev_pu_offset;
|
||||
int pts = AV_RB32(cur_pu + 13);
|
||||
|
||||
+2
-2
@@ -348,11 +348,11 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
// For 12 bit, ignore alpha
|
||||
if (elements == 4)
|
||||
buf += 2;
|
||||
// Jump to next aligned position
|
||||
buf += need_align;
|
||||
}
|
||||
for (i = 0; i < 3; i++)
|
||||
ptr[i] += p->linesize[i];
|
||||
// Jump to next aligned position
|
||||
buf += need_align;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
|
||||
+1
-1
@@ -333,7 +333,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
|
||||
dct_mode * 22 * 64 +
|
||||
(quant + ff_dv_quant_offset[class1]) * 64];
|
||||
}
|
||||
dc = dc << 2;
|
||||
dc = dc * 4;
|
||||
/* convert to unsigned because 128 is not added in the
|
||||
* standard IDCT */
|
||||
dc += 1024;
|
||||
|
||||
@@ -346,7 +346,7 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
|
||||
}
|
||||
}
|
||||
the_end:
|
||||
if (offset1 >= 0) {
|
||||
if (offset1 >= 0 && offset2 >= 0) {
|
||||
int w, h;
|
||||
uint8_t *bitmap;
|
||||
|
||||
|
||||
+2
-2
@@ -65,7 +65,7 @@ static int dxtory_decode_v1_410(AVCodecContext *avctx, AVFrame *pic,
|
||||
uint8_t *Y1, *Y2, *Y3, *Y4, *U, *V;
|
||||
int ret;
|
||||
|
||||
if (src_size < avctx->width * avctx->height * 9LL / 8) {
|
||||
if (src_size < FFALIGN(avctx->width, 4) * FFALIGN(avctx->height, 4) * 9LL / 8) {
|
||||
av_log(avctx, AV_LOG_ERROR, "packet too small\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ static int dxtory_decode_v1_420(AVCodecContext *avctx, AVFrame *pic,
|
||||
uint8_t *Y1, *Y2, *U, *V;
|
||||
int ret;
|
||||
|
||||
if (src_size < avctx->width * avctx->height * 3LL / 2) {
|
||||
if (src_size < FFALIGN(avctx->width, 2) * FFALIGN(avctx->height, 2) * 3LL / 2) {
|
||||
av_log(avctx, AV_LOG_ERROR, "packet too small\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@@ -381,14 +381,19 @@ static void guess_mv(ERContext *s)
|
||||
#define MV_UNCHANGED 1
|
||||
const int mb_stride = s->mb_stride;
|
||||
const int mb_width = s->mb_width;
|
||||
const int mb_height = s->mb_height;
|
||||
int mb_height = s->mb_height;
|
||||
int i, depth, num_avail;
|
||||
int mb_x, mb_y, mot_step, mot_stride;
|
||||
|
||||
if (s->last_pic.f && s->last_pic.f->data[0])
|
||||
mb_height = FFMIN(mb_height, (s->last_pic.f->height+15)>>4);
|
||||
if (s->next_pic.f && s->next_pic.f->data[0])
|
||||
mb_height = FFMIN(mb_height, (s->next_pic.f->height+15)>>4);
|
||||
|
||||
set_mv_strides(s, &mot_step, &mot_stride);
|
||||
|
||||
num_avail = 0;
|
||||
for (i = 0; i < s->mb_num; i++) {
|
||||
for (i = 0; i < mb_width * mb_height; i++) {
|
||||
const int mb_xy = s->mb_index2xy[i];
|
||||
int f = 0;
|
||||
int error = s->error_status_table[mb_xy];
|
||||
@@ -413,7 +418,7 @@ static void guess_mv(ERContext *s)
|
||||
|
||||
if ((!(s->avctx->error_concealment&FF_EC_GUESS_MVS)) ||
|
||||
num_avail <= mb_width / 2) {
|
||||
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
|
||||
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;
|
||||
int mv_dir = (s->last_pic.f && s->last_pic.f->data[0]) ? MV_DIR_FORWARD : MV_DIR_BACKWARD;
|
||||
@@ -442,7 +447,7 @@ static void guess_mv(ERContext *s)
|
||||
int score_sum = 0;
|
||||
|
||||
changed = 0;
|
||||
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
|
||||
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;
|
||||
int mv_predictor[8][2] = { { 0 } };
|
||||
@@ -675,7 +680,7 @@ skip_last_mv:
|
||||
if (none_left)
|
||||
return;
|
||||
|
||||
for (i = 0; i < s->mb_num; i++) {
|
||||
for (i = 0; i < mb_width * mb_height; i++) {
|
||||
int mb_xy = s->mb_index2xy[i];
|
||||
if (fixed[mb_xy])
|
||||
fixed[mb_xy] = MV_FROZEN;
|
||||
|
||||
+5
-5
@@ -459,7 +459,7 @@ static int huf_build_dec_table(const uint64_t *hcode, int im,
|
||||
lc += 8; \
|
||||
}
|
||||
|
||||
#define get_code(po, rlc, c, lc, gb, out, oe) \
|
||||
#define get_code(po, rlc, c, lc, gb, out, oe, outb) \
|
||||
{ \
|
||||
if (po == rlc) { \
|
||||
if (lc < 8) \
|
||||
@@ -468,7 +468,7 @@ static int huf_build_dec_table(const uint64_t *hcode, int im,
|
||||
\
|
||||
cs = c >> lc; \
|
||||
\
|
||||
if (out + cs > oe) \
|
||||
if (out + cs > oe || out == outb) \
|
||||
return AVERROR_INVALIDDATA; \
|
||||
\
|
||||
s = out[-1]; \
|
||||
@@ -501,7 +501,7 @@ static int huf_decode(const uint64_t *hcode, const HufDec *hdecod,
|
||||
|
||||
if (pl.len) {
|
||||
lc -= pl.len;
|
||||
get_code(pl.lit, rlc, c, lc, gb, out, oe);
|
||||
get_code(pl.lit, rlc, c, lc, gb, out, oe, outb);
|
||||
} else {
|
||||
int j;
|
||||
|
||||
@@ -518,7 +518,7 @@ static int huf_decode(const uint64_t *hcode, const HufDec *hdecod,
|
||||
if ((hcode[pl.p[j]] >> 6) ==
|
||||
((c >> (lc - l)) & ((1LL << l) - 1))) {
|
||||
lc -= l;
|
||||
get_code(pl.p[j], rlc, c, lc, gb, out, oe);
|
||||
get_code(pl.p[j], rlc, c, lc, gb, out, oe, outb);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -539,7 +539,7 @@ static int huf_decode(const uint64_t *hcode, const HufDec *hdecod,
|
||||
|
||||
if (pl.len) {
|
||||
lc -= pl.len;
|
||||
get_code(pl.lit, rlc, c, lc, gb, out, oe);
|
||||
get_code(pl.lit, rlc, c, lc, gb, out, oe, outb);
|
||||
} else {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
+17
-12
@@ -66,7 +66,7 @@ av_cold int ffv1_common_init(AVCodecContext *avctx)
|
||||
|
||||
av_cold int ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs)
|
||||
{
|
||||
int j;
|
||||
int j, i;
|
||||
|
||||
fs->plane_count = f->plane_count;
|
||||
fs->transparency = f->transparency;
|
||||
@@ -80,10 +80,15 @@ av_cold int ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs)
|
||||
if (!p->state)
|
||||
return AVERROR(ENOMEM);
|
||||
} else {
|
||||
if (!p->vlc_state)
|
||||
p->vlc_state = av_malloc_array(p->context_count, sizeof(VlcState));
|
||||
if (!p->vlc_state)
|
||||
return AVERROR(ENOMEM);
|
||||
if (!p->vlc_state) {
|
||||
p->vlc_state = av_mallocz_array(p->context_count, sizeof(VlcState));
|
||||
if (!p->vlc_state)
|
||||
return AVERROR(ENOMEM);
|
||||
for (i = 0; i < p->context_count; i++) {
|
||||
p->vlc_state[i].error_sum = 4;
|
||||
p->vlc_state[i].count = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +106,7 @@ av_cold int ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs)
|
||||
av_cold int ffv1_init_slices_state(FFV1Context *f)
|
||||
{
|
||||
int i, ret;
|
||||
for (i = 0; i < f->slice_count; i++) {
|
||||
for (i = 0; i < f->max_slice_count; i++) {
|
||||
FFV1Context *fs = f->slice_context[i];
|
||||
if ((ret = ffv1_init_slice_state(f, fs)) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
@@ -113,10 +118,10 @@ av_cold int ffv1_init_slice_contexts(FFV1Context *f)
|
||||
{
|
||||
int i;
|
||||
|
||||
f->slice_count = f->num_h_slices * f->num_v_slices;
|
||||
av_assert0(f->slice_count > 0);
|
||||
f->max_slice_count = f->num_h_slices * f->num_v_slices;
|
||||
av_assert0(f->max_slice_count > 0);
|
||||
|
||||
for (i = 0; i < f->slice_count; i++) {
|
||||
for (i = 0; i < f->max_slice_count; i++) {
|
||||
int sx = i % f->num_h_slices;
|
||||
int sy = i / f->num_h_slices;
|
||||
int sxs = f->avctx->width * sx / f->num_h_slices;
|
||||
@@ -210,7 +215,7 @@ av_cold int ffv1_close(AVCodecContext *avctx)
|
||||
ff_thread_release_buffer(avctx, &s->last_picture);
|
||||
av_frame_free(&s->last_picture.f);
|
||||
|
||||
for (j = 0; j < s->slice_count; j++) {
|
||||
for (j = 0; j < s->max_slice_count; j++) {
|
||||
FFV1Context *fs = s->slice_context[j];
|
||||
for (i = 0; i < s->plane_count; i++) {
|
||||
PlaneContext *p = &fs->plane[i];
|
||||
@@ -224,14 +229,14 @@ av_cold int ffv1_close(AVCodecContext *avctx)
|
||||
av_freep(&avctx->stats_out);
|
||||
for (j = 0; j < s->quant_table_count; j++) {
|
||||
av_freep(&s->initial_states[j]);
|
||||
for (i = 0; i < s->slice_count; i++) {
|
||||
for (i = 0; i < s->max_slice_count; i++) {
|
||||
FFV1Context *sf = s->slice_context[i];
|
||||
av_freep(&sf->rc_stat2[j]);
|
||||
}
|
||||
av_freep(&s->rc_stat2[j]);
|
||||
}
|
||||
|
||||
for (i = 0; i < s->slice_count; i++)
|
||||
for (i = 0; i < s->max_slice_count; i++)
|
||||
av_freep(&s->slice_context[i]);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -117,6 +117,7 @@ typedef struct FFV1Context {
|
||||
|
||||
struct FFV1Context *slice_context[MAX_SLICES];
|
||||
int slice_count;
|
||||
int max_slice_count;
|
||||
int num_v_slices;
|
||||
int num_h_slices;
|
||||
int slice_width;
|
||||
|
||||
+20
-7
@@ -47,8 +47,11 @@ static inline av_flatten int get_symbol_inline(RangeCoder *c, uint8_t *state,
|
||||
else {
|
||||
int i, e, a;
|
||||
e = 0;
|
||||
while (get_rac(c, state + 1 + FFMIN(e, 9))) // 1..10
|
||||
while (get_rac(c, state + 1 + FFMIN(e, 9))) { // 1..10
|
||||
e++;
|
||||
if (e > 31)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
a = 1;
|
||||
for (i = e - 1; i >= 0; i--)
|
||||
@@ -302,7 +305,7 @@ static int decode_slice_header(FFV1Context *f, FFV1Context *fs)
|
||||
for (i = 0; i < f->plane_count; i++) {
|
||||
PlaneContext * const p = &fs->plane[i];
|
||||
int idx = get_symbol(c, state, 0);
|
||||
if (idx > (unsigned)f->quant_table_count) {
|
||||
if (idx >= (unsigned)f->quant_table_count) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "quant_table_index out of range\n");
|
||||
return -1;
|
||||
}
|
||||
@@ -405,6 +408,7 @@ static int decode_slice(AVCodecContext *c, void *arg)
|
||||
if (ffv1_init_slice_state(f, fs) < 0)
|
||||
return AVERROR(ENOMEM);
|
||||
if (decode_slice_header(f, fs) < 0) {
|
||||
fs->slice_x = fs->slice_y = fs->slice_height = fs->slice_width = 0;
|
||||
fs->slice_damaged = 1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -499,7 +503,10 @@ static int read_quant_tables(RangeCoder *c,
|
||||
int context_count = 1;
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
context_count *= read_quant_table(c, quant_table[i], context_count);
|
||||
int ret = read_quant_table(c, quant_table[i], context_count);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
context_count *= ret;
|
||||
if (context_count > 32768U) {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -561,8 +568,11 @@ static int read_extra_header(FFV1Context *f)
|
||||
}
|
||||
|
||||
f->quant_table_count = get_symbol(c, state, 0);
|
||||
if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES)
|
||||
if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || !f->quant_table_count) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "quant table count %d is invalid\n", f->quant_table_count);
|
||||
f->quant_table_count = 0;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
for (i = 0; i < f->quant_table_count; i++) {
|
||||
f->context_count[i] = read_quant_tables(c, f->quant_tables[i]);
|
||||
@@ -772,6 +782,7 @@ static int read_header(FFV1Context *f)
|
||||
av_log(f->avctx, AV_LOG_ERROR, "read_quant_table error\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
f->slice_count = f->max_slice_count;
|
||||
} else if (f->version < 3) {
|
||||
f->slice_count = get_symbol(c, state, 0);
|
||||
} else {
|
||||
@@ -786,8 +797,8 @@ static int read_header(FFV1Context *f)
|
||||
p -= size + trailer;
|
||||
}
|
||||
}
|
||||
if (f->slice_count > (unsigned)MAX_SLICES || f->slice_count <= 0) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "slice count %d is invalid\n", f->slice_count);
|
||||
if (f->slice_count > (unsigned)MAX_SLICES || f->slice_count <= 0 || f->slice_count > f->max_slice_count) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "slice count %d is invalid (max=%d)\n", f->slice_count, f->max_slice_count);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@@ -929,6 +940,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
else v = buf_p - c->bytestream_start;
|
||||
if (buf_p - c->bytestream_start < v) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Slice pointer chain broken\n");
|
||||
ff_thread_report_progress(&f->picture, INT_MAX, 0);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
buf_p -= v;
|
||||
@@ -1010,6 +1022,7 @@ static int init_thread_copy(AVCodecContext *avctx)
|
||||
f->picture.f = NULL;
|
||||
f->last_picture.f = NULL;
|
||||
f->sample_buffer = NULL;
|
||||
f->max_slice_count = 0;
|
||||
f->slice_count = 0;
|
||||
|
||||
for (i = 0; i < f->quant_table_count; i++) {
|
||||
@@ -1085,7 +1098,7 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
|
||||
av_assert0(!fdst->sample_buffer);
|
||||
}
|
||||
|
||||
av_assert1(fdst->slice_count == fsrc->slice_count);
|
||||
av_assert1(fdst->max_slice_count == fsrc->max_slice_count);
|
||||
|
||||
|
||||
ff_thread_release_buffer(dst, &fdst->picture);
|
||||
|
||||
@@ -755,6 +755,8 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
s->transparency = desc->nb_components == 4;
|
||||
if (!avctx->bits_per_raw_sample && !s->bits_per_raw_sample)
|
||||
s->bits_per_raw_sample = 8;
|
||||
else if (!s->bits_per_raw_sample)
|
||||
s->bits_per_raw_sample = 8;
|
||||
break;
|
||||
case AV_PIX_FMT_RGB32:
|
||||
s->colorspace = 1;
|
||||
@@ -974,6 +976,7 @@ slices_ok:
|
||||
|
||||
if ((ret = ffv1_init_slice_contexts(s)) < 0)
|
||||
return ret;
|
||||
s->slice_count = s->max_slice_count;
|
||||
if ((ret = ffv1_init_slices_state(s)) < 0)
|
||||
return ret;
|
||||
|
||||
@@ -983,7 +986,7 @@ slices_ok:
|
||||
if (!avctx->stats_out)
|
||||
return AVERROR(ENOMEM);
|
||||
for (i = 0; i < s->quant_table_count; i++)
|
||||
for (j = 0; j < s->slice_count; j++) {
|
||||
for (j = 0; j < s->max_slice_count; j++) {
|
||||
FFV1Context *sf = s->slice_context[j];
|
||||
av_assert0(!sf->rc_stat2[i]);
|
||||
sf->rc_stat2[i] = av_mallocz(s->context_count[i] *
|
||||
@@ -1207,6 +1210,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
for (i = 0; i < f->quant_table_count; i++)
|
||||
memset(f->rc_stat2[i], 0, f->context_count[i] * sizeof(*f->rc_stat2[i]));
|
||||
|
||||
av_assert0(f->slice_count == f->max_slice_count);
|
||||
for (j = 0; j < f->slice_count; j++) {
|
||||
FFV1Context *fs = f->slice_context[j];
|
||||
for (i = 0; i < 256; i++) {
|
||||
|
||||
@@ -1021,7 +1021,7 @@ static int count_frame_header(FlacEncodeContext *s)
|
||||
count += 16;
|
||||
|
||||
/* explicit sample rate */
|
||||
count += ((s->sr_code[0] == 12) + (s->sr_code[0] > 12)) * 8;
|
||||
count += ((s->sr_code[0] == 12) + (s->sr_code[0] > 12) * 2) * 8;
|
||||
|
||||
/* frame header CRC-8 */
|
||||
count += 8;
|
||||
|
||||
@@ -413,6 +413,10 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
|
||||
}
|
||||
|
||||
if (has_diff) {
|
||||
if (size < 3) {
|
||||
av_log(avctx, AV_LOG_ERROR, "size too small for diff\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (!s->keyframe) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Inter frame without keyframe\n");
|
||||
@@ -440,6 +444,10 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
|
||||
int row = get_bits(&gb, 8);
|
||||
av_log(avctx, AV_LOG_DEBUG, "%dx%d zlibprime_curr %dx%d\n",
|
||||
i, j, col, row);
|
||||
if (size < 3) {
|
||||
av_log(avctx, AV_LOG_ERROR, "size too small for zlibprime_curr\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
size -= 2;
|
||||
avpriv_request_sample(avctx, "zlibprime_curr");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
|
||||
@@ -111,7 +111,7 @@ static av_cold int flashsv_encode_init(AVCodecContext *avctx)
|
||||
|
||||
if (avctx->width > 4095 || avctx->height > 4095) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Input dimensions too large, input must be max 4096x4096 !\n");
|
||||
"Input dimensions too large, input must be max 4095x4095 !\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -746,7 +746,7 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
|
||||
c->tile_height = bytestream2_get_be32(&bc);
|
||||
if (c->tile_width <= 0 || c->tile_height <= 0 ||
|
||||
((c->tile_width | c->tile_height) & 0xF) ||
|
||||
c->tile_width * 4LL * c->tile_height >= INT_MAX
|
||||
c->tile_width * (uint64_t)c->tile_height >= INT_MAX / 4
|
||||
) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Invalid tile dimensions %dx%d\n",
|
||||
@@ -877,6 +877,8 @@ header_fail:
|
||||
c->height = 0;
|
||||
c->tiles_x =
|
||||
c->tiles_y = 0;
|
||||
c->tile_width =
|
||||
c->tile_height = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -43,6 +43,7 @@ typedef struct GIFContext {
|
||||
const AVClass *class;
|
||||
LZWState *lzw;
|
||||
uint8_t *buf;
|
||||
int buf_size;
|
||||
AVFrame *last_frame;
|
||||
int flags;
|
||||
uint32_t palette[AVPALETTE_COUNT]; ///< local reference palette for !pal8
|
||||
@@ -174,7 +175,7 @@ static int gif_image_write_image(AVCodecContext *avctx,
|
||||
|
||||
bytestream_put_byte(bytestream, 0x08);
|
||||
|
||||
ff_lzw_encode_init(s->lzw, s->buf, 2 * width * height,
|
||||
ff_lzw_encode_init(s->lzw, s->buf, s->buf_size,
|
||||
12, FF_LZW_GIF, put_bits);
|
||||
|
||||
ptr = buf + y_start*linesize + x_start;
|
||||
@@ -232,7 +233,8 @@ static av_cold int gif_encode_init(AVCodecContext *avctx)
|
||||
s->transparent_index = -1;
|
||||
|
||||
s->lzw = av_mallocz(ff_lzw_encode_state_size);
|
||||
s->buf = av_malloc(avctx->width*avctx->height*2);
|
||||
s->buf_size = avctx->width*avctx->height*2 + 1000;
|
||||
s->buf = av_malloc(s->buf_size);
|
||||
s->tmpl = av_malloc(avctx->width);
|
||||
if (!s->tmpl || !s->buf || !s->lzw)
|
||||
return AVERROR(ENOMEM);
|
||||
@@ -324,6 +326,7 @@ static int gif_encode_close(AVCodecContext *avctx)
|
||||
|
||||
av_freep(&s->lzw);
|
||||
av_freep(&s->buf);
|
||||
s->buf_size = 0;
|
||||
av_frame_free(&s->last_frame);
|
||||
av_freep(&s->tmpl);
|
||||
return 0;
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ static inline int get_ue_golomb(GetBitContext *gb)
|
||||
int log = 2 * av_log2(buf) - 31;
|
||||
LAST_SKIP_BITS(re, gb, 32 - log);
|
||||
CLOSE_READER(re, gb);
|
||||
if (CONFIG_FTRAPV && log < 0) {
|
||||
if (log < 7) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Invalid UE golomb code\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
+43
-2
@@ -1642,6 +1642,47 @@ again:
|
||||
|
||||
ret = 0;
|
||||
end:
|
||||
|
||||
#if CONFIG_ERROR_RESILIENCE
|
||||
sl = h->slice_ctx;
|
||||
/*
|
||||
* FIXME: Error handling code does not seem to support interlaced
|
||||
* when slices span multiple rows
|
||||
* The ff_er_add_slice calls don't work right for bottom
|
||||
* fields; they cause massive erroneous error concealing
|
||||
* Error marking covers both fields (top and bottom).
|
||||
* This causes a mismatched s->error_count
|
||||
* and a bad error table. Further, the error count goes to
|
||||
* INT_MAX when called for bottom field, because mb_y is
|
||||
* past end by one (callers fault) and resync_mb_y != 0
|
||||
* causes problems for the first MB line, too.
|
||||
*/
|
||||
if (!FIELD_PICTURE(h) && h->current_slice && !h->sps.new && h->enable_er) {
|
||||
int use_last_pic = h->last_pic_for_ec.f->buf[0] && !sl->ref_count[0];
|
||||
|
||||
ff_h264_set_erpic(&sl->er.cur_pic, h->cur_pic_ptr);
|
||||
|
||||
if (use_last_pic) {
|
||||
ff_h264_set_erpic(&sl->er.last_pic, &h->last_pic_for_ec);
|
||||
sl->ref_list[0][0].parent = &h->last_pic_for_ec;
|
||||
memcpy(sl->ref_list[0][0].data, h->last_pic_for_ec.f->data, sizeof(sl->ref_list[0][0].data));
|
||||
memcpy(sl->ref_list[0][0].linesize, h->last_pic_for_ec.f->linesize, sizeof(sl->ref_list[0][0].linesize));
|
||||
sl->ref_list[0][0].reference = h->last_pic_for_ec.reference;
|
||||
} else if (sl->ref_count[0]) {
|
||||
ff_h264_set_erpic(&sl->er.last_pic, sl->ref_list[0][0].parent);
|
||||
} else
|
||||
ff_h264_set_erpic(&sl->er.last_pic, NULL);
|
||||
|
||||
if (sl->ref_count[1])
|
||||
ff_h264_set_erpic(&sl->er.next_pic, sl->ref_list[1][0].parent);
|
||||
|
||||
sl->er.ref_count = sl->ref_count[0];
|
||||
|
||||
ff_er_frame_end(&sl->er);
|
||||
if (use_last_pic)
|
||||
memset(&sl->ref_list[0][0], 0, sizeof(sl->ref_list[0][0]));
|
||||
}
|
||||
#endif /* CONFIG_ERROR_RESILIENCE */
|
||||
/* clean up */
|
||||
if (h->cur_pic_ptr && !h->droppable) {
|
||||
ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX,
|
||||
@@ -1696,7 +1737,7 @@ static int is_extra(const uint8_t *buf, int buf_size)
|
||||
const uint8_t *p= buf+6;
|
||||
while(cnt--){
|
||||
int nalsize= AV_RB16(p) + 2;
|
||||
if(nalsize > buf_size - (p-buf) || p[2]!=0x67)
|
||||
if(nalsize > buf_size - (p-buf) || (p[2] & 0x9F) != 7)
|
||||
return 0;
|
||||
p += nalsize;
|
||||
}
|
||||
@@ -1705,7 +1746,7 @@ static int is_extra(const uint8_t *buf, int buf_size)
|
||||
return 0;
|
||||
while(cnt--){
|
||||
int nalsize= AV_RB16(p) + 2;
|
||||
if(nalsize > buf_size - (p-buf) || p[2]!=0x68)
|
||||
if(nalsize > buf_size - (p-buf) || (p[2] & 0x9F) != 8)
|
||||
return 0;
|
||||
p += nalsize;
|
||||
}
|
||||
|
||||
@@ -2026,6 +2026,7 @@ decode_intra_mb:
|
||||
const int mb_size = ff_h264_mb_sizes[h->sps.chroma_format_idc] *
|
||||
h->sps.bit_depth_luma >> 3;
|
||||
const uint8_t *ptr;
|
||||
int ret;
|
||||
|
||||
// We assume these blocks are very rare so we do not optimize it.
|
||||
// FIXME The two following lines get the bitstream position in the cabac
|
||||
@@ -2042,7 +2043,9 @@ decode_intra_mb:
|
||||
sl->intra_pcm_ptr = ptr;
|
||||
ptr += mb_size;
|
||||
|
||||
ff_init_cabac_decoder(&sl->cabac, ptr, sl->cabac.bytestream_end - ptr);
|
||||
ret = ff_init_cabac_decoder(&sl->cabac, ptr, sl->cabac.bytestream_end - ptr);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
// All blocks are present
|
||||
h->cbp_table[mb_xy] = 0xf7ef;
|
||||
|
||||
@@ -158,6 +158,7 @@ static void MCFUNC(hl_motion)(const H264Context *h, H264SliceContext *sl,
|
||||
}
|
||||
}
|
||||
|
||||
prefetch_motion(h, sl, 1, PIXEL_SHIFT, CHROMA_IDC);
|
||||
if (USES_LIST(mb_type, 1))
|
||||
prefetch_motion(h, sl, 1, PIXEL_SHIFT, CHROMA_IDC);
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
|
||||
buf += ctx->length_size;
|
||||
unit_type = *buf & 0x1f;
|
||||
|
||||
if (buf + nal_size > buf_end || nal_size < 0)
|
||||
if (nal_size > buf_end - buf || nal_size < 0)
|
||||
goto fail;
|
||||
|
||||
if (unit_type == 7)
|
||||
|
||||
@@ -181,47 +181,6 @@ int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup)
|
||||
h->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
|
||||
ff_vdpau_h264_picture_complete(h);
|
||||
|
||||
#if CONFIG_ERROR_RESILIENCE
|
||||
av_assert0(sl == h->slice_ctx);
|
||||
/*
|
||||
* FIXME: Error handling code does not seem to support interlaced
|
||||
* when slices span multiple rows
|
||||
* The ff_er_add_slice calls don't work right for bottom
|
||||
* fields; they cause massive erroneous error concealing
|
||||
* Error marking covers both fields (top and bottom).
|
||||
* This causes a mismatched s->error_count
|
||||
* and a bad error table. Further, the error count goes to
|
||||
* INT_MAX when called for bottom field, because mb_y is
|
||||
* past end by one (callers fault) and resync_mb_y != 0
|
||||
* causes problems for the first MB line, too.
|
||||
*/
|
||||
if (!FIELD_PICTURE(h) && h->current_slice && !h->sps.new && h->enable_er) {
|
||||
int use_last_pic = h->last_pic_for_ec.f->buf[0] && !sl->ref_count[0];
|
||||
|
||||
ff_h264_set_erpic(&sl->er.cur_pic, h->cur_pic_ptr);
|
||||
|
||||
if (use_last_pic) {
|
||||
ff_h264_set_erpic(&sl->er.last_pic, &h->last_pic_for_ec);
|
||||
sl->ref_list[0][0].parent = &h->last_pic_for_ec;
|
||||
memcpy(sl->ref_list[0][0].data, h->last_pic_for_ec.f->data, sizeof(sl->ref_list[0][0].data));
|
||||
memcpy(sl->ref_list[0][0].linesize, h->last_pic_for_ec.f->linesize, sizeof(sl->ref_list[0][0].linesize));
|
||||
sl->ref_list[0][0].reference = h->last_pic_for_ec.reference;
|
||||
} else if (sl->ref_count[0]) {
|
||||
ff_h264_set_erpic(&sl->er.last_pic, sl->ref_list[0][0].parent);
|
||||
} else
|
||||
ff_h264_set_erpic(&sl->er.last_pic, NULL);
|
||||
|
||||
if (sl->ref_count[1])
|
||||
ff_h264_set_erpic(&sl->er.next_pic, sl->ref_list[1][0].parent);
|
||||
|
||||
sl->er.ref_count = sl->ref_count[0];
|
||||
|
||||
ff_er_frame_end(&sl->er);
|
||||
if (use_last_pic)
|
||||
memset(&sl->ref_list[0][0], 0, sizeof(sl->ref_list[0][0]));
|
||||
}
|
||||
#endif /* CONFIG_ERROR_RESILIENCE */
|
||||
|
||||
if (!in_setup && !h->droppable)
|
||||
ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX,
|
||||
h->picture_structure == PICT_BOTTOM_FIELD);
|
||||
|
||||
+11
-6
@@ -122,6 +122,14 @@ static int add_sorted(H264Picture **sorted, H264Picture **src, int len, int limi
|
||||
return out_i;
|
||||
}
|
||||
|
||||
static int mismatches_ref(H264Context *h, H264Picture *pic)
|
||||
{
|
||||
AVFrame *f = pic->f;
|
||||
return (h->cur_pic_ptr->f->width != f->width ||
|
||||
h->cur_pic_ptr->f->height != f->height ||
|
||||
h->cur_pic_ptr->f->format != f->format);
|
||||
}
|
||||
|
||||
int ff_h264_fill_default_ref_list(H264Context *h, H264SliceContext *sl)
|
||||
{
|
||||
int i, len;
|
||||
@@ -193,10 +201,7 @@ int ff_h264_fill_default_ref_list(H264Context *h, H264SliceContext *sl)
|
||||
for (j = 0; j<1+(sl->slice_type_nos == AV_PICTURE_TYPE_B); j++) {
|
||||
for (i = 0; i < sl->ref_count[j]; i++) {
|
||||
if (h->default_ref_list[j][i].parent) {
|
||||
AVFrame *f = h->default_ref_list[j][i].parent->f;
|
||||
if (h->cur_pic_ptr->f->width != f->width ||
|
||||
h->cur_pic_ptr->f->height != f->height ||
|
||||
h->cur_pic_ptr->f->format != f->format) {
|
||||
if (mismatches_ref(h, h->default_ref_list[j][i].parent)) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "Discarding mismatching reference\n");
|
||||
memset(&h->default_ref_list[j][i], 0, sizeof(h->default_ref_list[j][i]));
|
||||
}
|
||||
@@ -298,14 +303,14 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h, H264SliceContext *sl)
|
||||
|
||||
long_idx = pic_num_extract(h, pic_id, &pic_structure);
|
||||
|
||||
if (long_idx > 31) {
|
||||
if (long_idx > 31U) {
|
||||
av_log(h->avctx, AV_LOG_ERROR,
|
||||
"long_term_pic_idx overflow\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
ref = h->long_ref[long_idx];
|
||||
assert(!(ref && !ref->reference));
|
||||
if (ref && (ref->reference & pic_structure)) {
|
||||
if (ref && (ref->reference & pic_structure) && !mismatches_ref(h, ref)) {
|
||||
ref->pic_id = pic_id;
|
||||
assert(ref->long_ref);
|
||||
i = 0;
|
||||
|
||||
+24
-12
@@ -778,7 +778,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 + sl->ref_list[1][0].poc == 2 * cur_poc) {
|
||||
sl->ref_list[0][0].poc + (int64_t)sl->ref_list[1][0].poc == 2 * cur_poc) {
|
||||
sl->use_weight = 0;
|
||||
sl->use_weight_chroma = 0;
|
||||
return;
|
||||
@@ -799,7 +799,7 @@ static void implicit_weight_table(const H264Context *h, H264SliceContext *sl, in
|
||||
sl->chroma_log2_weight_denom = 5;
|
||||
|
||||
for (ref0 = ref_start; ref0 < ref_count0; ref0++) {
|
||||
int poc0 = sl->ref_list[0][ref0].poc;
|
||||
int64_t poc0 = sl->ref_list[0][ref0].poc;
|
||||
for (ref1 = ref_start; ref1 < ref_count1; ref1++) {
|
||||
int w = 32;
|
||||
if (!sl->ref_list[0][ref0].parent->long_ref && !sl->ref_list[1][ref1].parent->long_ref) {
|
||||
@@ -1086,6 +1086,7 @@ static int h264_slice_header_init(H264Context *h)
|
||||
nb_slices = max_slices;
|
||||
}
|
||||
h->slice_context_count = nb_slices;
|
||||
h->max_contexts = FFMIN(h->max_contexts, nb_slices);
|
||||
|
||||
if (!HAVE_THREADS || !(h->avctx->active_thread_type & FF_THREAD_SLICE)) {
|
||||
ret = ff_h264_slice_context_init(h, &h->slice_ctx[0]);
|
||||
@@ -1159,6 +1160,15 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl)
|
||||
|
||||
if (first_mb_in_slice == 0) { // FIXME better field boundary detection
|
||||
if (h->current_slice) {
|
||||
if (h->max_contexts > 1) {
|
||||
if (!h->single_decode_warning) {
|
||||
av_log(h->avctx, AV_LOG_WARNING, "Cannot decode multiple access units as slice threads\n");
|
||||
h->single_decode_warning = 1;
|
||||
}
|
||||
h->max_contexts = 1;
|
||||
return SLICE_SINGLETHREAD;
|
||||
}
|
||||
|
||||
if (h->cur_pic_ptr && FIELD_PICTURE(h) && h->first_field) {
|
||||
ff_h264_field_end(h, h->slice_ctx, 1);
|
||||
h->current_slice = 0;
|
||||
@@ -1930,12 +1940,12 @@ static av_always_inline void fill_filter_caches_inter(const H264Context *h,
|
||||
if (USES_LIST(top_type, list)) {
|
||||
const int b_xy = h->mb2b_xy[top_xy] + 3 * b_stride;
|
||||
const int b8_xy = 4 * top_xy + 2;
|
||||
int (*ref2frm)[64] = (void*)(sl->ref2frm[h->slice_table[top_xy] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2));
|
||||
int *ref2frm = sl->ref2frm[h->slice_table[top_xy] & (MAX_SLICES - 1)][list] + (MB_MBAFF(sl) ? 20 : 2);
|
||||
AV_COPY128(mv_dst - 1 * 8, h->cur_pic.motion_val[list][b_xy + 0]);
|
||||
ref_cache[0 - 1 * 8] =
|
||||
ref_cache[1 - 1 * 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 0]];
|
||||
ref_cache[1 - 1 * 8] = ref2frm[h->cur_pic.ref_index[list][b8_xy + 0]];
|
||||
ref_cache[2 - 1 * 8] =
|
||||
ref_cache[3 - 1 * 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 1]];
|
||||
ref_cache[3 - 1 * 8] = ref2frm[h->cur_pic.ref_index[list][b8_xy + 1]];
|
||||
} else {
|
||||
AV_ZERO128(mv_dst - 1 * 8);
|
||||
AV_WN32A(&ref_cache[0 - 1 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);
|
||||
@@ -1945,15 +1955,15 @@ static av_always_inline void fill_filter_caches_inter(const H264Context *h,
|
||||
if (USES_LIST(left_type[LTOP], list)) {
|
||||
const int b_xy = h->mb2b_xy[left_xy[LTOP]] + 3;
|
||||
const int b8_xy = 4 * left_xy[LTOP] + 1;
|
||||
int (*ref2frm)[64] =(void*)( sl->ref2frm[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2));
|
||||
int *ref2frm = sl->ref2frm[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][list] + (MB_MBAFF(sl) ? 20 : 2);
|
||||
AV_COPY32(mv_dst - 1 + 0, h->cur_pic.motion_val[list][b_xy + b_stride * 0]);
|
||||
AV_COPY32(mv_dst - 1 + 8, h->cur_pic.motion_val[list][b_xy + b_stride * 1]);
|
||||
AV_COPY32(mv_dst - 1 + 16, h->cur_pic.motion_val[list][b_xy + b_stride * 2]);
|
||||
AV_COPY32(mv_dst - 1 + 24, h->cur_pic.motion_val[list][b_xy + b_stride * 3]);
|
||||
ref_cache[-1 + 0] =
|
||||
ref_cache[-1 + 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 2 * 0]];
|
||||
ref_cache[-1 + 8] = ref2frm[h->cur_pic.ref_index[list][b8_xy + 2 * 0]];
|
||||
ref_cache[-1 + 16] =
|
||||
ref_cache[-1 + 24] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 2 * 1]];
|
||||
ref_cache[-1 + 24] = ref2frm[h->cur_pic.ref_index[list][b8_xy + 2 * 1]];
|
||||
} else {
|
||||
AV_ZERO32(mv_dst - 1 + 0);
|
||||
AV_ZERO32(mv_dst - 1 + 8);
|
||||
@@ -1978,9 +1988,9 @@ static av_always_inline void fill_filter_caches_inter(const H264Context *h,
|
||||
|
||||
{
|
||||
int8_t *ref = &h->cur_pic.ref_index[list][4 * mb_xy];
|
||||
int (*ref2frm)[64] = (void*)(sl->ref2frm[sl->slice_num & (MAX_SLICES - 1)][0] + (MB_MBAFF(sl) ? 20 : 2));
|
||||
uint32_t ref01 = (pack16to32(ref2frm[list][ref[0]], ref2frm[list][ref[1]]) & 0x00FF00FF) * 0x0101;
|
||||
uint32_t ref23 = (pack16to32(ref2frm[list][ref[2]], ref2frm[list][ref[3]]) & 0x00FF00FF) * 0x0101;
|
||||
int *ref2frm = sl->ref2frm[sl->slice_num & (MAX_SLICES - 1)][list] + (MB_MBAFF(sl) ? 20 : 2);
|
||||
uint32_t ref01 = (pack16to32(ref2frm[ref[0]], ref2frm[ref[1]]) & 0x00FF00FF) * 0x0101;
|
||||
uint32_t ref23 = (pack16to32(ref2frm[ref[2]], ref2frm[ref[3]]) & 0x00FF00FF) * 0x0101;
|
||||
AV_WN32A(&ref_cache[0 * 8], ref01);
|
||||
AV_WN32A(&ref_cache[1 * 8], ref01);
|
||||
AV_WN32A(&ref_cache[2 * 8], ref23);
|
||||
@@ -2309,9 +2319,11 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg)
|
||||
align_get_bits(&sl->gb);
|
||||
|
||||
/* init cabac */
|
||||
ff_init_cabac_decoder(&sl->cabac,
|
||||
ret = ff_init_cabac_decoder(&sl->cabac,
|
||||
sl->gb.buffer + get_bits_count(&sl->gb) / 8,
|
||||
(get_bits_left(&sl->gb) + 7) / 8);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ff_h264_init_cabac_states(h, sl);
|
||||
|
||||
|
||||
+26
-6
@@ -730,7 +730,7 @@ static int hls_slice_header(HEVCContext *s)
|
||||
av_freep(&sh->entry_point_offset);
|
||||
av_freep(&sh->offset);
|
||||
av_freep(&sh->size);
|
||||
sh->entry_point_offset = av_malloc_array(sh->num_entry_point_offsets, sizeof(int));
|
||||
sh->entry_point_offset = av_malloc_array(sh->num_entry_point_offsets, sizeof(unsigned));
|
||||
sh->offset = av_malloc_array(sh->num_entry_point_offsets, sizeof(int));
|
||||
sh->size = av_malloc_array(sh->num_entry_point_offsets, sizeof(int));
|
||||
if (!sh->entry_point_offset || !sh->offset || !sh->size) {
|
||||
@@ -795,6 +795,8 @@ static int hls_slice_header(HEVCContext *s)
|
||||
s->HEVClc->tu.cu_qp_offset_cb = 0;
|
||||
s->HEVClc->tu.cu_qp_offset_cr = 0;
|
||||
|
||||
s->no_rasl_output_flag = IS_IDR(s) || IS_BLA(s) || (s->nal_unit_type == NAL_CRA_NUT && s->last_eos);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2385,6 +2387,8 @@ static int hls_decode_entry_wpp(AVCodecContext *avctxt, void *input_ctb_row, int
|
||||
|
||||
if (more_data < 0) {
|
||||
s->tab_slice_address[ctb_addr_rs] = -1;
|
||||
avpriv_atomic_int_set(&s1->wpp_err, 1);
|
||||
ff_thread_report_progress2(s->avctx, ctb_row ,thread, SHIFT_CTB_WPP);
|
||||
return more_data;
|
||||
}
|
||||
|
||||
@@ -2422,8 +2426,8 @@ static int hls_slice_data_wpp(HEVCContext *s, const uint8_t *nal, int length)
|
||||
HEVCLocalContext *lc = s->HEVClc;
|
||||
int *ret = av_malloc_array(s->sh.num_entry_point_offsets + 1, sizeof(int));
|
||||
int *arg = av_malloc_array(s->sh.num_entry_point_offsets + 1, sizeof(int));
|
||||
int offset;
|
||||
int startheader, cmpt = 0;
|
||||
int64_t offset;
|
||||
int64_t startheader, cmpt = 0;
|
||||
int i, j, res = 0;
|
||||
|
||||
if (!ret || !arg) {
|
||||
@@ -2432,11 +2436,18 @@ static int hls_slice_data_wpp(HEVCContext *s, const uint8_t *nal, int length)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
if (s->sh.slice_ctb_addr_rs + s->sh.num_entry_point_offsets * s->sps->ctb_width >= s->sps->ctb_width * s->sps->ctb_height) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "WPP ctb addresses are wrong (%d %d %d %d)\n",
|
||||
s->sh.slice_ctb_addr_rs, s->sh.num_entry_point_offsets,
|
||||
s->sps->ctb_width, s->sps->ctb_height
|
||||
);
|
||||
res = AVERROR_INVALIDDATA;
|
||||
goto error;
|
||||
}
|
||||
|
||||
ff_alloc_entries(s->avctx, s->sh.num_entry_point_offsets + 1);
|
||||
|
||||
if (!s->sList[1]) {
|
||||
ff_alloc_entries(s->avctx, s->sh.num_entry_point_offsets + 1);
|
||||
|
||||
|
||||
for (i = 1; i < s->threads_number; i++) {
|
||||
s->sList[i] = av_malloc(sizeof(HEVCContext));
|
||||
memcpy(s->sList[i], s, sizeof(HEVCContext));
|
||||
@@ -2469,6 +2480,11 @@ static int hls_slice_data_wpp(HEVCContext *s, const uint8_t *nal, int length)
|
||||
}
|
||||
if (s->sh.num_entry_point_offsets != 0) {
|
||||
offset += s->sh.entry_point_offset[s->sh.num_entry_point_offsets - 1] - cmpt;
|
||||
if (length < offset) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "entry_point_offset table is corrupted\n");
|
||||
res = AVERROR_INVALIDDATA;
|
||||
goto error;
|
||||
}
|
||||
s->sh.size[s->sh.num_entry_point_offsets - 1] = length - offset;
|
||||
s->sh.offset[s->sh.num_entry_point_offsets - 1] = offset;
|
||||
|
||||
@@ -2495,6 +2511,7 @@ static int hls_slice_data_wpp(HEVCContext *s, const uint8_t *nal, int length)
|
||||
|
||||
for (i = 0; i <= s->sh.num_entry_point_offsets; i++)
|
||||
res += ret[i];
|
||||
error:
|
||||
av_free(ret);
|
||||
av_free(arg);
|
||||
return res;
|
||||
@@ -3353,6 +3370,7 @@ static int hevc_update_thread_context(AVCodecContext *dst,
|
||||
s->pocTid0 = s0->pocTid0;
|
||||
s->max_ra = s0->max_ra;
|
||||
s->eos = s0->eos;
|
||||
s->no_rasl_output_flag = s0->no_rasl_output_flag;
|
||||
|
||||
s->is_nalff = s0->is_nalff;
|
||||
s->nal_length_size = s0->nal_length_size;
|
||||
@@ -3457,6 +3475,7 @@ static av_cold int hevc_decode_init(AVCodecContext *avctx)
|
||||
|
||||
s->enable_parallel_tiles = 0;
|
||||
s->picture_struct = 0;
|
||||
s->eos = 1;
|
||||
|
||||
if(avctx->active_thread_type & FF_THREAD_SLICE)
|
||||
s->threads_number = avctx->thread_count;
|
||||
@@ -3498,6 +3517,7 @@ static void hevc_decode_flush(AVCodecContext *avctx)
|
||||
HEVCContext *s = avctx->priv_data;
|
||||
ff_hevc_flush_dpb(s);
|
||||
s->max_ra = INT_MAX;
|
||||
s->eos = 1;
|
||||
}
|
||||
|
||||
#define OFFSET(x) offsetof(HEVCContext, x)
|
||||
|
||||
+2
-1
@@ -609,7 +609,7 @@ typedef struct SliceHeader {
|
||||
|
||||
unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand
|
||||
|
||||
int *entry_point_offset;
|
||||
unsigned *entry_point_offset;
|
||||
int * offset;
|
||||
int * size;
|
||||
int num_entry_point_offsets;
|
||||
@@ -842,6 +842,7 @@ typedef struct HEVCContext {
|
||||
int bs_height;
|
||||
|
||||
int is_decoded;
|
||||
int no_rasl_output_flag;
|
||||
|
||||
HEVCPredContext hpc;
|
||||
HEVCDSPContext hevcdsp;
|
||||
|
||||
@@ -883,11 +883,13 @@ static av_always_inline int mvd_decode(HEVCContext *s)
|
||||
int k = 1;
|
||||
|
||||
while (k < CABAC_MAX_BIN && get_cabac_bypass(&s->HEVClc->cc)) {
|
||||
ret += 1 << k;
|
||||
ret += 1U << k;
|
||||
k++;
|
||||
}
|
||||
if (k == CABAC_MAX_BIN)
|
||||
if (k == CABAC_MAX_BIN) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", k);
|
||||
return 0;
|
||||
}
|
||||
while (k--)
|
||||
ret += get_cabac_bypass(&s->HEVClc->cc) << k;
|
||||
return get_cabac_bypass_sign(&s->HEVClc->cc, -ret);
|
||||
@@ -1025,8 +1027,10 @@ static av_always_inline int coeff_abs_level_remaining_decode(HEVCContext *s, int
|
||||
|
||||
while (prefix < CABAC_MAX_BIN && get_cabac_bypass(&s->HEVClc->cc))
|
||||
prefix++;
|
||||
if (prefix == CABAC_MAX_BIN)
|
||||
if (prefix == CABAC_MAX_BIN) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", prefix);
|
||||
return 0;
|
||||
}
|
||||
if (prefix < 3) {
|
||||
for (i = 0; i < rc_rice_param; i++)
|
||||
suffix = (suffix << 1) | get_cabac_bypass(&s->HEVClc->cc);
|
||||
|
||||
@@ -806,6 +806,9 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
|
||||
}
|
||||
|
||||
sps->chroma_format_idc = get_ue_golomb_long(gb);
|
||||
if (sps->chroma_format_idc > 3U) {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (sps->chroma_format_idc == 3)
|
||||
sps->separate_colour_plane_flag = get_bits1(gb);
|
||||
|
||||
@@ -174,7 +174,7 @@ int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush)
|
||||
int min_poc = INT_MAX;
|
||||
int i, min_idx, ret;
|
||||
|
||||
if (s->sh.no_output_of_prior_pics_flag == 1) {
|
||||
if (s->sh.no_output_of_prior_pics_flag == 1 && s->no_rasl_output_flag == 1) {
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) {
|
||||
HEVCFrame *frame = &s->DPB[i];
|
||||
if (!(frame->flags & HEVC_FRAME_FLAG_BUMPING) && frame->poc != s->poc &&
|
||||
|
||||
+2
-2
@@ -417,8 +417,8 @@ static int hqx_decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
info_tag = AV_RL32(src);
|
||||
if (info_tag == MKTAG('I', 'N', 'F', 'O')) {
|
||||
int info_offset = AV_RL32(src + 4);
|
||||
if (info_offset > UINT32_MAX - 8 || info_offset + 8 > avpkt->size) {
|
||||
unsigned info_offset = AV_RL32(src + 4);
|
||||
if (info_offset > INT_MAX || info_offset + 8 > avpkt->size) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Invalid INFO header offset: 0x%08"PRIX32" is too large.\n",
|
||||
info_offset);
|
||||
|
||||
+35
-2
@@ -236,9 +236,41 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width,
|
||||
int x_shift;
|
||||
int yheight;
|
||||
int i, y;
|
||||
int max_step[4];
|
||||
|
||||
if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB ||
|
||||
!is_yuv_planar(desc)) return -1;
|
||||
if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
|
||||
return -1;
|
||||
|
||||
if (!is_yuv_planar(desc)) {
|
||||
if (src)
|
||||
return -1; //TODO: Not yet implemented
|
||||
|
||||
av_image_fill_max_pixsteps(max_step, NULL, desc);
|
||||
|
||||
if (padtop || padleft) {
|
||||
memset(dst->data[0], color[0],
|
||||
dst->linesize[0] * padtop + (padleft * max_step[0]));
|
||||
}
|
||||
|
||||
if (padleft || padright) {
|
||||
optr = dst->data[0] + dst->linesize[0] * padtop +
|
||||
(dst->linesize[0] - (padright * max_step[0]));
|
||||
yheight = height - 1 - (padtop + padbottom);
|
||||
for (y = 0; y < yheight; y++) {
|
||||
memset(optr, color[0], (padleft + padright) * max_step[0]);
|
||||
optr += dst->linesize[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (padbottom || padright) {
|
||||
optr = dst->data[0] + dst->linesize[0] * (height - padbottom) -
|
||||
(padright * max_step[0]);
|
||||
memset(optr, color[0], dst->linesize[0] * padbottom +
|
||||
(padright * max_step[0]));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
x_shift = i ? desc->log2_chroma_w : 0;
|
||||
@@ -284,6 +316,7 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width,
|
||||
(padbottom >> y_shift) + (padright >> x_shift));
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+9
-6
@@ -146,6 +146,7 @@ static int ir2_decode_frame(AVCodecContext *avctx,
|
||||
AVFrame *picture = data;
|
||||
AVFrame * const p = s->picture;
|
||||
int start, ret;
|
||||
int ltab, ctab;
|
||||
|
||||
if ((ret = ff_reget_buffer(avctx, p)) < 0)
|
||||
return ret;
|
||||
@@ -167,34 +168,36 @@ static int ir2_decode_frame(AVCodecContext *avctx,
|
||||
|
||||
init_get_bits(&s->gb, buf + start, (buf_size - start) * 8);
|
||||
|
||||
ltab = buf[0x22] & 3;
|
||||
ctab = buf[0x22] >> 2;
|
||||
if (s->decode_delta) { /* intraframe */
|
||||
if ((ret = ir2_decode_plane(s, avctx->width, avctx->height,
|
||||
p->data[0], p->linesize[0],
|
||||
ir2_luma_table)) < 0)
|
||||
ir2_delta_table[ltab])) < 0)
|
||||
return ret;
|
||||
|
||||
/* swapped U and V */
|
||||
if ((ret = ir2_decode_plane(s, avctx->width >> 2, avctx->height >> 2,
|
||||
p->data[2], p->linesize[2],
|
||||
ir2_luma_table)) < 0)
|
||||
ir2_delta_table[ctab])) < 0)
|
||||
return ret;
|
||||
if ((ret = ir2_decode_plane(s, avctx->width >> 2, avctx->height >> 2,
|
||||
p->data[1], p->linesize[1],
|
||||
ir2_luma_table)) < 0)
|
||||
ir2_delta_table[ctab])) < 0)
|
||||
return ret;
|
||||
} else { /* interframe */
|
||||
if ((ret = ir2_decode_plane_inter(s, avctx->width, avctx->height,
|
||||
p->data[0], p->linesize[0],
|
||||
ir2_luma_table)) < 0)
|
||||
ir2_delta_table[ltab])) < 0)
|
||||
return ret;
|
||||
/* swapped U and V */
|
||||
if ((ret = ir2_decode_plane_inter(s, avctx->width >> 2, avctx->height >> 2,
|
||||
p->data[2], p->linesize[2],
|
||||
ir2_luma_table)) < 0)
|
||||
ir2_delta_table[ctab])) < 0)
|
||||
return ret;
|
||||
if ((ret = ir2_decode_plane_inter(s, avctx->width >> 2, avctx->height >> 2,
|
||||
p->data[1], p->linesize[1],
|
||||
ir2_luma_table)) < 0)
|
||||
ir2_delta_table[ctab])) < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
+201
-105
@@ -27,115 +27,211 @@
|
||||
#define IR2_CODES 143
|
||||
static const uint16_t ir2_codes[IR2_CODES][2] = {
|
||||
#ifdef BITSTREAM_READER_LE
|
||||
{0x0000, 3}, {0x0004, 3}, {0x0006, 3}, {0x0001, 5},
|
||||
{0x0009, 5}, {0x0019, 5}, {0x000D, 5}, {0x001D, 5},
|
||||
{0x0023, 6}, {0x0013, 6}, {0x0033, 6}, {0x000B, 6},
|
||||
{0x002B, 6}, {0x001B, 6}, {0x0007, 8}, {0x0087, 8},
|
||||
{0x0027, 8}, {0x00A7, 8}, {0x0067, 8}, {0x00E7, 8},
|
||||
{0x0097, 8}, {0x0057, 8}, {0x0037, 8}, {0x00B7, 8},
|
||||
{0x00F7, 8}, {0x000F, 9}, {0x008F, 9}, {0x018F, 9},
|
||||
{0x014F, 9}, {0x00CF, 9}, {0x002F, 9}, {0x012F, 9},
|
||||
{0x01AF, 9}, {0x006F, 9}, {0x00EF, 9}, {0x01EF, 9},
|
||||
{0x001F, 10}, {0x021F, 10}, {0x011F, 10}, {0x031F, 10},
|
||||
{0x009F, 10}, {0x029F, 10}, {0x019F, 10}, {0x039F, 10},
|
||||
{0x005F, 10}, {0x025F, 10}, {0x015F, 10}, {0x035F, 10},
|
||||
{0x00DF, 10}, {0x02DF, 10}, {0x01DF, 10}, {0x03DF, 10},
|
||||
{0x003F, 13}, {0x103F, 13}, {0x083F, 13}, {0x183F, 13},
|
||||
{0x043F, 13}, {0x143F, 13}, {0x0C3F, 13}, {0x1C3F, 13},
|
||||
{0x023F, 13}, {0x123F, 13}, {0x0A3F, 13}, {0x1A3F, 13},
|
||||
{0x063F, 13}, {0x163F, 13}, {0x0E3F, 13}, {0x1E3F, 13},
|
||||
{0x013F, 13}, {0x113F, 13}, {0x093F, 13}, {0x193F, 13},
|
||||
{0x053F, 13}, {0x153F, 13}, {0x0D3F, 13}, {0x1D3F, 13},
|
||||
{0x033F, 13}, {0x133F, 13}, {0x0B3F, 13}, {0x1B3F, 13},
|
||||
{0x073F, 13}, {0x173F, 13}, {0x0F3F, 13}, {0x1F3F, 13},
|
||||
{0x00BF, 13}, {0x10BF, 13}, {0x08BF, 13}, {0x18BF, 13},
|
||||
{0x04BF, 13}, {0x14BF, 13}, {0x0CBF, 13}, {0x1CBF, 13},
|
||||
{0x02BF, 13}, {0x12BF, 13}, {0x0ABF, 13}, {0x1ABF, 13},
|
||||
{0x06BF, 13}, {0x16BF, 13}, {0x0EBF, 13}, {0x1EBF, 13},
|
||||
{0x01BF, 13}, {0x11BF, 13}, {0x09BF, 13}, {0x19BF, 13},
|
||||
{0x05BF, 13}, {0x15BF, 13}, {0x0DBF, 13}, {0x1DBF, 13},
|
||||
{0x03BF, 13}, {0x13BF, 13}, {0x0BBF, 13}, {0x1BBF, 13},
|
||||
{0x07BF, 13}, {0x17BF, 13}, {0x0FBF, 13}, {0x1FBF, 13},
|
||||
{0x007F, 14}, {0x207F, 14}, {0x107F, 14}, {0x307F, 14},
|
||||
{0x087F, 14}, {0x287F, 14}, {0x187F, 14}, {0x387F, 14},
|
||||
{0x047F, 14}, {0x247F, 14}, {0x147F, 14}, {0x0002, 3},
|
||||
{0x0011, 5}, {0x0005, 5}, {0x0015, 5}, {0x0003, 6},
|
||||
{0x003B, 6}, {0x0047, 8}, {0x00C7, 8}, {0x0017, 8},
|
||||
{0x00D7, 8}, {0x0077, 8}, {0x010F, 9}, {0x004F, 9},
|
||||
{0x01CF, 9}, {0x00AF, 9}, {0x016F, 9},
|
||||
{ 0x0000, 3 }, { 0x0004, 3 }, { 0x0006, 3 }, { 0x0001, 5 },
|
||||
{ 0x0009, 5 }, { 0x0019, 5 }, { 0x000D, 5 }, { 0x001D, 5 },
|
||||
{ 0x0023, 6 }, { 0x0013, 6 }, { 0x0033, 6 }, { 0x000B, 6 },
|
||||
{ 0x002B, 6 }, { 0x001B, 6 }, { 0x0007, 8 }, { 0x0087, 8 },
|
||||
{ 0x0027, 8 }, { 0x00A7, 8 }, { 0x0067, 8 }, { 0x00E7, 8 },
|
||||
{ 0x0097, 8 }, { 0x0057, 8 }, { 0x0037, 8 }, { 0x00B7, 8 },
|
||||
{ 0x00F7, 8 }, { 0x000F, 9 }, { 0x008F, 9 }, { 0x018F, 9 },
|
||||
{ 0x014F, 9 }, { 0x00CF, 9 }, { 0x002F, 9 }, { 0x012F, 9 },
|
||||
{ 0x01AF, 9 }, { 0x006F, 9 }, { 0x00EF, 9 }, { 0x01EF, 9 },
|
||||
{ 0x001F, 10 }, { 0x021F, 10 }, { 0x011F, 10 }, { 0x031F, 10 },
|
||||
{ 0x009F, 10 }, { 0x029F, 10 }, { 0x019F, 10 }, { 0x039F, 10 },
|
||||
{ 0x005F, 10 }, { 0x025F, 10 }, { 0x015F, 10 }, { 0x035F, 10 },
|
||||
{ 0x00DF, 10 }, { 0x02DF, 10 }, { 0x01DF, 10 }, { 0x03DF, 10 },
|
||||
{ 0x003F, 13 }, { 0x103F, 13 }, { 0x083F, 13 }, { 0x183F, 13 },
|
||||
{ 0x043F, 13 }, { 0x143F, 13 }, { 0x0C3F, 13 }, { 0x1C3F, 13 },
|
||||
{ 0x023F, 13 }, { 0x123F, 13 }, { 0x0A3F, 13 }, { 0x1A3F, 13 },
|
||||
{ 0x063F, 13 }, { 0x163F, 13 }, { 0x0E3F, 13 }, { 0x1E3F, 13 },
|
||||
{ 0x013F, 13 }, { 0x113F, 13 }, { 0x093F, 13 }, { 0x193F, 13 },
|
||||
{ 0x053F, 13 }, { 0x153F, 13 }, { 0x0D3F, 13 }, { 0x1D3F, 13 },
|
||||
{ 0x033F, 13 }, { 0x133F, 13 }, { 0x0B3F, 13 }, { 0x1B3F, 13 },
|
||||
{ 0x073F, 13 }, { 0x173F, 13 }, { 0x0F3F, 13 }, { 0x1F3F, 13 },
|
||||
{ 0x00BF, 13 }, { 0x10BF, 13 }, { 0x08BF, 13 }, { 0x18BF, 13 },
|
||||
{ 0x04BF, 13 }, { 0x14BF, 13 }, { 0x0CBF, 13 }, { 0x1CBF, 13 },
|
||||
{ 0x02BF, 13 }, { 0x12BF, 13 }, { 0x0ABF, 13 }, { 0x1ABF, 13 },
|
||||
{ 0x06BF, 13 }, { 0x16BF, 13 }, { 0x0EBF, 13 }, { 0x1EBF, 13 },
|
||||
{ 0x01BF, 13 }, { 0x11BF, 13 }, { 0x09BF, 13 }, { 0x19BF, 13 },
|
||||
{ 0x05BF, 13 }, { 0x15BF, 13 }, { 0x0DBF, 13 }, { 0x1DBF, 13 },
|
||||
{ 0x03BF, 13 }, { 0x13BF, 13 }, { 0x0BBF, 13 }, { 0x1BBF, 13 },
|
||||
{ 0x07BF, 13 }, { 0x17BF, 13 }, { 0x0FBF, 13 }, { 0x1FBF, 13 },
|
||||
{ 0x007F, 14 }, { 0x207F, 14 }, { 0x107F, 14 }, { 0x307F, 14 },
|
||||
{ 0x087F, 14 }, { 0x287F, 14 }, { 0x187F, 14 }, { 0x387F, 14 },
|
||||
{ 0x047F, 14 }, { 0x247F, 14 }, { 0x147F, 14 }, { 0x0002, 3 },
|
||||
{ 0x0011, 5 }, { 0x0005, 5 }, { 0x0015, 5 }, { 0x0003, 6 },
|
||||
{ 0x003B, 6 }, { 0x0047, 8 }, { 0x00C7, 8 }, { 0x0017, 8 },
|
||||
{ 0x00D7, 8 }, { 0x0077, 8 }, { 0x010F, 9 }, { 0x004F, 9 },
|
||||
{ 0x01CF, 9 }, { 0x00AF, 9 }, { 0x016F, 9 },
|
||||
#else
|
||||
{0x0000, 3}, {0x0001, 3}, {0x0003, 3}, {0x0010, 5},
|
||||
{0x0012, 5}, {0x0013, 5}, {0x0016, 5}, {0x0017, 5},
|
||||
{0x0031, 6}, {0x0032, 6}, {0x0033, 6}, {0x0034, 6},
|
||||
{0x0035, 6}, {0x0036, 6}, {0x00E0, 8}, {0x00E1, 8},
|
||||
{0x00E4, 8}, {0x00E5, 8}, {0x00E6, 8}, {0x00E7, 8},
|
||||
{0x00E9, 8}, {0x00EA, 8}, {0x00EC, 8}, {0x00ED, 8},
|
||||
{0x00EF, 8}, {0x01E0, 9}, {0x01E2, 9}, {0x01E3, 9},
|
||||
{0x01E5, 9}, {0x01E6, 9}, {0x01E8, 9}, {0x01E9, 9},
|
||||
{0x01EB, 9}, {0x01EC, 9}, {0x01EE, 9}, {0x01EF, 9},
|
||||
{0x03E0, 10}, {0x03E1, 10}, {0x03E2, 10}, {0x03E3, 10},
|
||||
{0x03E4, 10}, {0x03E5, 10}, {0x03E6, 10}, {0x03E7, 10},
|
||||
{0x03E8, 10}, {0x03E9, 10}, {0x03EA, 10}, {0x03EB, 10},
|
||||
{0x03EC, 10}, {0x03ED, 10}, {0x03EE, 10}, {0x03EF, 10},
|
||||
{0x1F80, 13}, {0x1F81, 13}, {0x1F82, 13}, {0x1F83, 13},
|
||||
{0x1F84, 13}, {0x1F85, 13}, {0x1F86, 13}, {0x1F87, 13},
|
||||
{0x1F88, 13}, {0x1F89, 13}, {0x1F8A, 13}, {0x1F8B, 13},
|
||||
{0x1F8C, 13}, {0x1F8D, 13}, {0x1F8E, 13}, {0x1F8F, 13},
|
||||
{0x1F90, 13}, {0x1F91, 13}, {0x1F92, 13}, {0x1F93, 13},
|
||||
{0x1F94, 13}, {0x1F95, 13}, {0x1F96, 13}, {0x1F97, 13},
|
||||
{0x1F98, 13}, {0x1F99, 13}, {0x1F9A, 13}, {0x1F9B, 13},
|
||||
{0x1F9C, 13}, {0x1F9D, 13}, {0x1F9E, 13}, {0x1F9F, 13},
|
||||
{0x1FA0, 13}, {0x1FA1, 13}, {0x1FA2, 13}, {0x1FA3, 13},
|
||||
{0x1FA4, 13}, {0x1FA5, 13}, {0x1FA6, 13}, {0x1FA7, 13},
|
||||
{0x1FA8, 13}, {0x1FA9, 13}, {0x1FAA, 13}, {0x1FAB, 13},
|
||||
{0x1FAC, 13}, {0x1FAD, 13}, {0x1FAE, 13}, {0x1FAF, 13},
|
||||
{0x1FB0, 13}, {0x1FB1, 13}, {0x1FB2, 13}, {0x1FB3, 13},
|
||||
{0x1FB4, 13}, {0x1FB5, 13}, {0x1FB6, 13}, {0x1FB7, 13},
|
||||
{0x1FB8, 13}, {0x1FB9, 13}, {0x1FBA, 13}, {0x1FBB, 13},
|
||||
{0x1FBC, 13}, {0x1FBD, 13}, {0x1FBE, 13}, {0x1FBF, 13},
|
||||
{0x3F80, 14}, {0x3F81, 14}, {0x3F82, 14}, {0x3F83, 14},
|
||||
{0x3F84, 14}, {0x3F85, 14}, {0x3F86, 14}, {0x3F87, 14},
|
||||
{0x3F88, 14}, {0x3F89, 14}, {0x3F8A, 14}, {0x0002, 3},
|
||||
{0x0011, 5}, {0x0014, 5}, {0x0015, 5}, {0x0030, 6},
|
||||
{0x0037, 6}, {0x00E2, 8}, {0x00E3, 8}, {0x00E8, 8},
|
||||
{0x00EB, 8}, {0x00EE, 8}, {0x01E1, 9}, {0x01E4, 9},
|
||||
{0x01E7, 9}, {0x01EA, 9}, {0x01ED, 9}
|
||||
{ 0x0000, 3 }, { 0x0001, 3 }, { 0x0003, 3 }, { 0x0010, 5 },
|
||||
{ 0x0012, 5 }, { 0x0013, 5 }, { 0x0016, 5 }, { 0x0017, 5 },
|
||||
{ 0x0031, 6 }, { 0x0032, 6 }, { 0x0033, 6 }, { 0x0034, 6 },
|
||||
{ 0x0035, 6 }, { 0x0036, 6 }, { 0x00E0, 8 }, { 0x00E1, 8 },
|
||||
{ 0x00E4, 8 }, { 0x00E5, 8 }, { 0x00E6, 8 }, { 0x00E7, 8 },
|
||||
{ 0x00E9, 8 }, { 0x00EA, 8 }, { 0x00EC, 8 }, { 0x00ED, 8 },
|
||||
{ 0x00EF, 8 }, { 0x01E0, 9 }, { 0x01E2, 9 }, { 0x01E3, 9 },
|
||||
{ 0x01E5, 9 }, { 0x01E6, 9 }, { 0x01E8, 9 }, { 0x01E9, 9 },
|
||||
{ 0x01EB, 9 }, { 0x01EC, 9 }, { 0x01EE, 9 }, { 0x01EF, 9 },
|
||||
{ 0x03E0, 10 }, { 0x03E1, 10 }, { 0x03E2, 10 }, { 0x03E3, 10 },
|
||||
{ 0x03E4, 10 }, { 0x03E5, 10 }, { 0x03E6, 10 }, { 0x03E7, 10 },
|
||||
{ 0x03E8, 10 }, { 0x03E9, 10 }, { 0x03EA, 10 }, { 0x03EB, 10 },
|
||||
{ 0x03EC, 10 }, { 0x03ED, 10 }, { 0x03EE, 10 }, { 0x03EF, 10 },
|
||||
{ 0x1F80, 13 }, { 0x1F81, 13 }, { 0x1F82, 13 }, { 0x1F83, 13 },
|
||||
{ 0x1F84, 13 }, { 0x1F85, 13 }, { 0x1F86, 13 }, { 0x1F87, 13 },
|
||||
{ 0x1F88, 13 }, { 0x1F89, 13 }, { 0x1F8A, 13 }, { 0x1F8B, 13 },
|
||||
{ 0x1F8C, 13 }, { 0x1F8D, 13 }, { 0x1F8E, 13 }, { 0x1F8F, 13 },
|
||||
{ 0x1F90, 13 }, { 0x1F91, 13 }, { 0x1F92, 13 }, { 0x1F93, 13 },
|
||||
{ 0x1F94, 13 }, { 0x1F95, 13 }, { 0x1F96, 13 }, { 0x1F97, 13 },
|
||||
{ 0x1F98, 13 }, { 0x1F99, 13 }, { 0x1F9A, 13 }, { 0x1F9B, 13 },
|
||||
{ 0x1F9C, 13 }, { 0x1F9D, 13 }, { 0x1F9E, 13 }, { 0x1F9F, 13 },
|
||||
{ 0x1FA0, 13 }, { 0x1FA1, 13 }, { 0x1FA2, 13 }, { 0x1FA3, 13 },
|
||||
{ 0x1FA4, 13 }, { 0x1FA5, 13 }, { 0x1FA6, 13 }, { 0x1FA7, 13 },
|
||||
{ 0x1FA8, 13 }, { 0x1FA9, 13 }, { 0x1FAA, 13 }, { 0x1FAB, 13 },
|
||||
{ 0x1FAC, 13 }, { 0x1FAD, 13 }, { 0x1FAE, 13 }, { 0x1FAF, 13 },
|
||||
{ 0x1FB0, 13 }, { 0x1FB1, 13 }, { 0x1FB2, 13 }, { 0x1FB3, 13 },
|
||||
{ 0x1FB4, 13 }, { 0x1FB5, 13 }, { 0x1FB6, 13 }, { 0x1FB7, 13 },
|
||||
{ 0x1FB8, 13 }, { 0x1FB9, 13 }, { 0x1FBA, 13 }, { 0x1FBB, 13 },
|
||||
{ 0x1FBC, 13 }, { 0x1FBD, 13 }, { 0x1FBE, 13 }, { 0x1FBF, 13 },
|
||||
{ 0x3F80, 14 }, { 0x3F81, 14 }, { 0x3F82, 14 }, { 0x3F83, 14 },
|
||||
{ 0x3F84, 14 }, { 0x3F85, 14 }, { 0x3F86, 14 }, { 0x3F87, 14 },
|
||||
{ 0x3F88, 14 }, { 0x3F89, 14 }, { 0x3F8A, 14 }, { 0x0002, 3 },
|
||||
{ 0x0011, 5 }, { 0x0014, 5 }, { 0x0015, 5 }, { 0x0030, 6 },
|
||||
{ 0x0037, 6 }, { 0x00E2, 8 }, { 0x00E3, 8 }, { 0x00E8, 8 },
|
||||
{ 0x00EB, 8 }, { 0x00EE, 8 }, { 0x01E1, 9 }, { 0x01E4, 9 },
|
||||
{ 0x01E7, 9 }, { 0x01EA, 9 }, { 0x01ED, 9 },
|
||||
#endif
|
||||
};
|
||||
|
||||
static const uint8_t ir2_luma_table[256] = {
|
||||
0x80, 0x80, 0x84, 0x84, 0x7C, 0x7C, 0x7F, 0x85,
|
||||
0x81, 0x7B, 0x85, 0x7F, 0x7B, 0x81, 0x8C, 0x8C,
|
||||
0x74, 0x74, 0x83, 0x8D, 0x7D, 0x73, 0x8D, 0x83,
|
||||
0x73, 0x7D, 0x77, 0x89, 0x89, 0x77, 0x89, 0x77,
|
||||
0x77, 0x89, 0x8C, 0x95, 0x74, 0x6B, 0x95, 0x8C,
|
||||
0x6B, 0x74, 0x7C, 0x90, 0x84, 0x70, 0x90, 0x7C,
|
||||
0x70, 0x84, 0x96, 0x96, 0x6A, 0x6A, 0x82, 0x98,
|
||||
0x7E, 0x68, 0x98, 0x82, 0x68, 0x7E, 0x97, 0xA2,
|
||||
0x69, 0x5E, 0xA2, 0x97, 0x5E, 0x69, 0xA2, 0xA2,
|
||||
0x5E, 0x5E, 0x8B, 0xA3, 0x75, 0x5D, 0xA3, 0x8B,
|
||||
0x5D, 0x75, 0x71, 0x95, 0x8F, 0x6B, 0x95, 0x71,
|
||||
0x6B, 0x8F, 0x78, 0x9D, 0x88, 0x63, 0x9D, 0x78,
|
||||
0x63, 0x88, 0x7F, 0xA7, 0x81, 0x59, 0xA7, 0x7F,
|
||||
0x59, 0x81, 0xA4, 0xB1, 0x5C, 0x4F, 0xB1, 0xA4,
|
||||
0x4F, 0x5C, 0x96, 0xB1, 0x6A, 0x4F, 0xB1, 0x96,
|
||||
0x4F, 0x6A, 0xB2, 0xB2, 0x4E, 0x4E, 0x65, 0x9B,
|
||||
0x9B, 0x65, 0x9B, 0x65, 0x65, 0x9B, 0x89, 0xB4,
|
||||
0x77, 0x4C, 0xB4, 0x89, 0x4C, 0x77, 0x6A, 0xA3,
|
||||
0x96, 0x5D, 0xA3, 0x6A, 0x5D, 0x96, 0x73, 0xAC,
|
||||
0x8D, 0x54, 0xAC, 0x73, 0x54, 0x8D, 0xB4, 0xC3,
|
||||
0x4C, 0x3D, 0xC3, 0xB4, 0x3D, 0x4C, 0xA4, 0xC3,
|
||||
0x5C, 0x3D, 0xC3, 0xA4, 0x3D, 0x5C, 0xC4, 0xC4,
|
||||
0x3C, 0x3C, 0x96, 0xC6, 0x6A, 0x3A, 0xC6, 0x96,
|
||||
0x3A, 0x6A, 0x7C, 0xBA, 0x84, 0x46, 0xBA, 0x7C,
|
||||
0x46, 0x84, 0x5B, 0xAB, 0xA5, 0x55, 0xAB, 0x5B,
|
||||
0x55, 0xA5, 0x63, 0xB4, 0x9D, 0x4C, 0xB4, 0x63,
|
||||
0x4C, 0x9D, 0x86, 0xCA, 0x7A, 0x36, 0xCA, 0x86,
|
||||
0x36, 0x7A, 0xB6, 0xD7, 0x4A, 0x29, 0xD7, 0xB6,
|
||||
0x29, 0x4A, 0xC8, 0xD7, 0x38, 0x29, 0xD7, 0xC8,
|
||||
0x29, 0x38, 0xA4, 0xD8, 0x5C, 0x28, 0xD8, 0xA4,
|
||||
0x28, 0x5C, 0x6C, 0xC1, 0x94, 0x3F, 0xC1, 0x6C,
|
||||
0x3F, 0x94, 0xD9, 0xD9, 0x27, 0x27, 0x80, 0x80
|
||||
static const uint8_t ir2_delta_table[4][256] = {
|
||||
{ 0x80, 0x80, 0x84, 0x84, 0x7C, 0x7C, 0x7F, 0x85,
|
||||
0x81, 0x7B, 0x85, 0x7F, 0x7B, 0x81, 0x8C, 0x8C,
|
||||
0x74, 0x74, 0x83, 0x8D, 0x7D, 0x73, 0x8D, 0x83,
|
||||
0x73, 0x7D, 0x77, 0x89, 0x89, 0x77, 0x89, 0x77,
|
||||
0x77, 0x89, 0x8C, 0x95, 0x74, 0x6B, 0x95, 0x8C,
|
||||
0x6B, 0x74, 0x7C, 0x90, 0x84, 0x70, 0x90, 0x7C,
|
||||
0x70, 0x84, 0x96, 0x96, 0x6A, 0x6A, 0x82, 0x98,
|
||||
0x7E, 0x68, 0x98, 0x82, 0x68, 0x7E, 0x97, 0xA2,
|
||||
0x69, 0x5E, 0xA2, 0x97, 0x5E, 0x69, 0xA2, 0xA2,
|
||||
0x5E, 0x5E, 0x8B, 0xA3, 0x75, 0x5D, 0xA3, 0x8B,
|
||||
0x5D, 0x75, 0x71, 0x95, 0x8F, 0x6B, 0x95, 0x71,
|
||||
0x6B, 0x8F, 0x78, 0x9D, 0x88, 0x63, 0x9D, 0x78,
|
||||
0x63, 0x88, 0x7F, 0xA7, 0x81, 0x59, 0xA7, 0x7F,
|
||||
0x59, 0x81, 0xA4, 0xB1, 0x5C, 0x4F, 0xB1, 0xA4,
|
||||
0x4F, 0x5C, 0x96, 0xB1, 0x6A, 0x4F, 0xB1, 0x96,
|
||||
0x4F, 0x6A, 0xB2, 0xB2, 0x4E, 0x4E, 0x65, 0x9B,
|
||||
0x9B, 0x65, 0x9B, 0x65, 0x65, 0x9B, 0x89, 0xB4,
|
||||
0x77, 0x4C, 0xB4, 0x89, 0x4C, 0x77, 0x6A, 0xA3,
|
||||
0x96, 0x5D, 0xA3, 0x6A, 0x5D, 0x96, 0x73, 0xAC,
|
||||
0x8D, 0x54, 0xAC, 0x73, 0x54, 0x8D, 0xB4, 0xC3,
|
||||
0x4C, 0x3D, 0xC3, 0xB4, 0x3D, 0x4C, 0xA4, 0xC3,
|
||||
0x5C, 0x3D, 0xC3, 0xA4, 0x3D, 0x5C, 0xC4, 0xC4,
|
||||
0x3C, 0x3C, 0x96, 0xC6, 0x6A, 0x3A, 0xC6, 0x96,
|
||||
0x3A, 0x6A, 0x7C, 0xBA, 0x84, 0x46, 0xBA, 0x7C,
|
||||
0x46, 0x84, 0x5B, 0xAB, 0xA5, 0x55, 0xAB, 0x5B,
|
||||
0x55, 0xA5, 0x63, 0xB4, 0x9D, 0x4C, 0xB4, 0x63,
|
||||
0x4C, 0x9D, 0x86, 0xCA, 0x7A, 0x36, 0xCA, 0x86,
|
||||
0x36, 0x7A, 0xB6, 0xD7, 0x4A, 0x29, 0xD7, 0xB6,
|
||||
0x29, 0x4A, 0xC8, 0xD7, 0x38, 0x29, 0xD7, 0xC8,
|
||||
0x29, 0x38, 0xA4, 0xD8, 0x5C, 0x28, 0xD8, 0xA4,
|
||||
0x28, 0x5C, 0x6C, 0xC1, 0x94, 0x3F, 0xC1, 0x6C,
|
||||
0x3F, 0x94, 0xD9, 0xD9, 0x27, 0x27, 0x80, 0x80, },
|
||||
{ 0x80, 0x80, 0x85, 0x85, 0x7B, 0x7B, 0x7E, 0x87,
|
||||
0x82, 0x79, 0x87, 0x7E, 0x79, 0x82, 0x8F, 0x8F,
|
||||
0x71, 0x71, 0x84, 0x8F, 0x7C, 0x71, 0x8F, 0x84,
|
||||
0x71, 0x7C, 0x75, 0x8B, 0x8B, 0x75, 0x8B, 0x75,
|
||||
0x75, 0x8B, 0x8E, 0x9A, 0x72, 0x66, 0x9A, 0x8E,
|
||||
0x66, 0x72, 0x7B, 0x93, 0x85, 0x6D, 0x93, 0x7B,
|
||||
0x6D, 0x85, 0x9B, 0x9B, 0x65, 0x65, 0x82, 0x9D,
|
||||
0x7E, 0x63, 0x9D, 0x82, 0x63, 0x7E, 0x9B, 0xA8,
|
||||
0x65, 0x58, 0xA8, 0x9B, 0x58, 0x65, 0xA9, 0xA9,
|
||||
0x57, 0x57, 0x8D, 0xAA, 0x73, 0x56, 0xAA, 0x8D,
|
||||
0x56, 0x73, 0x6E, 0x99, 0x92, 0x67, 0x99, 0x6E,
|
||||
0x67, 0x92, 0x76, 0xA2, 0x8A, 0x5E, 0xA2, 0x76,
|
||||
0x5E, 0x8A, 0x7F, 0xAF, 0x81, 0x51, 0xAF, 0x7F,
|
||||
0x51, 0x81, 0xAB, 0xBA, 0x55, 0x46, 0xBA, 0xAB,
|
||||
0x46, 0x55, 0x9A, 0xBB, 0x66, 0x45, 0xBB, 0x9A,
|
||||
0x45, 0x66, 0xBB, 0xBB, 0x45, 0x45, 0x60, 0xA0,
|
||||
0xA0, 0x60, 0xA0, 0x60, 0x60, 0xA0, 0x8B, 0xBE,
|
||||
0x75, 0x42, 0xBE, 0x8B, 0x42, 0x75, 0x66, 0xAA,
|
||||
0x9A, 0x56, 0xAA, 0x66, 0x56, 0x9A, 0x70, 0xB5,
|
||||
0x90, 0x4B, 0xB5, 0x70, 0x4B, 0x90, 0xBE, 0xCF,
|
||||
0x42, 0x31, 0xCF, 0xBE, 0x31, 0x42, 0xAB, 0xD0,
|
||||
0x55, 0x30, 0xD0, 0xAB, 0x30, 0x55, 0xD1, 0xD1,
|
||||
0x2F, 0x2F, 0x9A, 0xD3, 0x66, 0x2D, 0xD3, 0x9A,
|
||||
0x2D, 0x66, 0x7B, 0xC5, 0x85, 0x3B, 0xC5, 0x7B,
|
||||
0x3B, 0x85, 0x54, 0xB4, 0xAC, 0x4C, 0xB4, 0x54,
|
||||
0x4C, 0xAC, 0x5E, 0xBE, 0xA2, 0x42, 0xBE, 0x5E,
|
||||
0x42, 0xA2, 0x87, 0xD8, 0x79, 0x28, 0xD8, 0x87,
|
||||
0x28, 0x79, 0xC0, 0xE8, 0x40, 0x18, 0xE8, 0xC0,
|
||||
0x18, 0x40, 0xD5, 0xE8, 0x2B, 0x18, 0xE8, 0xD5,
|
||||
0x18, 0x2B, 0xAB, 0xE9, 0x55, 0x17, 0xE9, 0xAB,
|
||||
0x17, 0x55, 0x68, 0xCD, 0x98, 0x33, 0xCD, 0x68,
|
||||
0x33, 0x98, 0xEA, 0xEA, 0x16, 0x16, 0x80, 0x80, },
|
||||
{ 0x80, 0x80, 0x86, 0x86, 0x7A, 0x7A, 0x7E, 0x88,
|
||||
0x82, 0x78, 0x88, 0x7E, 0x78, 0x82, 0x92, 0x92,
|
||||
0x6E, 0x6E, 0x85, 0x92, 0x7B, 0x6E, 0x92, 0x85,
|
||||
0x6E, 0x7B, 0x73, 0x8D, 0x8D, 0x73, 0x8D, 0x73,
|
||||
0x73, 0x8D, 0x91, 0x9E, 0x6F, 0x62, 0x9E, 0x91,
|
||||
0x62, 0x6F, 0x79, 0x97, 0x87, 0x69, 0x97, 0x79,
|
||||
0x69, 0x87, 0xA0, 0xA0, 0x60, 0x60, 0x83, 0xA2,
|
||||
0x7D, 0x5E, 0xA2, 0x83, 0x5E, 0x7D, 0xA0, 0xB0,
|
||||
0x60, 0x50, 0xB0, 0xA0, 0x50, 0x60, 0xB1, 0xB1,
|
||||
0x4F, 0x4F, 0x8F, 0xB2, 0x71, 0x4E, 0xB2, 0x8F,
|
||||
0x4E, 0x71, 0x6B, 0x9E, 0x95, 0x62, 0x9E, 0x6B,
|
||||
0x62, 0x95, 0x74, 0xA9, 0x8C, 0x57, 0xA9, 0x74,
|
||||
0x57, 0x8C, 0x7F, 0xB8, 0x81, 0x48, 0xB8, 0x7F,
|
||||
0x48, 0x81, 0xB4, 0xC5, 0x4C, 0x3B, 0xC5, 0xB4,
|
||||
0x3B, 0x4C, 0x9F, 0xC6, 0x61, 0x3A, 0xC6, 0x9F,
|
||||
0x3A, 0x61, 0xC6, 0xC6, 0x3A, 0x3A, 0x59, 0xA7,
|
||||
0xA7, 0x59, 0xA7, 0x59, 0x59, 0xA7, 0x8D, 0xCA,
|
||||
0x73, 0x36, 0xCA, 0x8D, 0x36, 0x73, 0x61, 0xB2,
|
||||
0x9F, 0x4E, 0xB2, 0x61, 0x4E, 0x9F, 0x6D, 0xBF,
|
||||
0x93, 0x41, 0xBF, 0x6D, 0x41, 0x93, 0xCA, 0xDF,
|
||||
0x36, 0x21, 0xDF, 0xCA, 0x21, 0x36, 0xB3, 0xDF,
|
||||
0x4D, 0x21, 0xDF, 0xB3, 0x21, 0x4D, 0xE1, 0xE1,
|
||||
0x1F, 0x1F, 0x9F, 0xE3, 0x61, 0x1D, 0xE3, 0x9F,
|
||||
0x1D, 0x61, 0x7A, 0xD3, 0x86, 0x2D, 0xD3, 0x7A,
|
||||
0x2D, 0x86, 0x4C, 0xBE, 0xB4, 0x42, 0xBE, 0x4C,
|
||||
0x42, 0xB4, 0x57, 0xCA, 0xA9, 0x36, 0xCA, 0x57,
|
||||
0x36, 0xA9, 0x88, 0xE9, 0x78, 0x17, 0xE9, 0x88,
|
||||
0x17, 0x78, 0xCC, 0xFB, 0x34, 0x05, 0xFB, 0xCC,
|
||||
0x05, 0x34, 0xE6, 0xFB, 0x1A, 0x05, 0xFB, 0xE6,
|
||||
0x05, 0x1A, 0xB4, 0xFD, 0x4C, 0x03, 0xFD, 0xB4,
|
||||
0x03, 0x4C, 0x63, 0xDC, 0x9D, 0x24, 0xDC, 0x63,
|
||||
0x24, 0x9D, 0xFE, 0xFE, 0x02, 0x02, 0x80, 0x80, },
|
||||
{ 0x80, 0x80, 0x87, 0x87, 0x79, 0x79, 0x7E, 0x89,
|
||||
0x82, 0x77, 0x89, 0x7E, 0x77, 0x82, 0x95, 0x95,
|
||||
0x6B, 0x6B, 0x86, 0x96, 0x7A, 0x6A, 0x96, 0x86,
|
||||
0x6A, 0x7A, 0x70, 0x90, 0x90, 0x70, 0x90, 0x70,
|
||||
0x70, 0x90, 0x94, 0xA4, 0x6C, 0x5C, 0xA4, 0x94,
|
||||
0x5C, 0x6C, 0x78, 0x9B, 0x88, 0x65, 0x9B, 0x78,
|
||||
0x65, 0x88, 0xA6, 0xA6, 0x5A, 0x5A, 0x83, 0xA9,
|
||||
0x7D, 0x57, 0xA9, 0x83, 0x57, 0x7D, 0xA6, 0xB9,
|
||||
0x5A, 0x47, 0xB9, 0xA6, 0x47, 0x5A, 0xBA, 0xBA,
|
||||
0x46, 0x46, 0x92, 0xBC, 0x6E, 0x44, 0xBC, 0x92,
|
||||
0x44, 0x6E, 0x67, 0xA3, 0x99, 0x5D, 0xA3, 0x67,
|
||||
0x5D, 0x99, 0x72, 0xB0, 0x8E, 0x50, 0xB0, 0x72,
|
||||
0x50, 0x8E, 0x7F, 0xC3, 0x81, 0x3D, 0xC3, 0x7F,
|
||||
0x3D, 0x81, 0xBE, 0xD2, 0x42, 0x2E, 0xD2, 0xBE,
|
||||
0x2E, 0x42, 0xA5, 0xD4, 0x5B, 0x2C, 0xD4, 0xA5,
|
||||
0x2C, 0x5B, 0xD4, 0xD4, 0x2C, 0x2C, 0x52, 0xAE,
|
||||
0xAE, 0x52, 0xAE, 0x52, 0x52, 0xAE, 0x8F, 0xD8,
|
||||
0x71, 0x28, 0xD8, 0x8F, 0x28, 0x71, 0x5B, 0xBB,
|
||||
0xA5, 0x45, 0xBB, 0x5B, 0x45, 0xA5, 0x69, 0xCB,
|
||||
0x97, 0x35, 0xCB, 0x69, 0x35, 0x97, 0xD8, 0xF0,
|
||||
0x28, 0x10, 0xF0, 0xD8, 0x10, 0x28, 0xBD, 0xF1,
|
||||
0x43, 0x0F, 0xF1, 0xBD, 0x0F, 0x43, 0xF3, 0xF3,
|
||||
0x0D, 0x0D, 0xA5, 0xF6, 0x5B, 0x0A, 0xF6, 0xA5,
|
||||
0x0A, 0x5B, 0x78, 0xE2, 0x88, 0x1E, 0xE2, 0x78,
|
||||
0x1E, 0x88, 0x42, 0xC9, 0xBE, 0x37, 0xC9, 0x42,
|
||||
0x37, 0xBE, 0x4F, 0xD8, 0xB1, 0x28, 0xD8, 0x4F,
|
||||
0x28, 0xB1, 0x8A, 0xFD, 0x76, 0x03, 0xFD, 0x8A,
|
||||
0x03, 0x76, 0xDB, 0xFF, 0x25, 0x01, 0xFF, 0xDB,
|
||||
0x01, 0x25, 0xF9, 0xFF, 0x07, 0x01, 0xFF, 0xF9,
|
||||
0x01, 0x07, 0xBE, 0xFF, 0x42, 0x01, 0xFF, 0xBE,
|
||||
0x01, 0x42, 0x5E, 0xED, 0xA2, 0x13, 0xED, 0x5E,
|
||||
0x13, 0xA2, 0xFF, 0xFF, 0x01, 0x01, 0x80, 0x80, },
|
||||
};
|
||||
|
||||
#endif /* AVCODEC_INDEO2DATA_H */
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "avcodec.h"
|
||||
#include "bytestream.h"
|
||||
#include "hpeldsp.h"
|
||||
@@ -949,7 +950,7 @@ static void ipvideo_decode_opcodes(IpvideoContext *s, AVFrame *frame)
|
||||
}
|
||||
}
|
||||
if (bytestream2_get_bytes_left(&s->stream_ptr) > 1) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
av_log(s->avctx, AV_LOG_DEBUG,
|
||||
"decode finished with %d bytes left over\n",
|
||||
bytestream2_get_bytes_left(&s->stream_ptr));
|
||||
}
|
||||
@@ -987,12 +988,15 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
|
||||
AVFrame *frame = data;
|
||||
int ret;
|
||||
|
||||
if (buf_size < 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* decoding map contains 4 bits of information per 8x8 block */
|
||||
s->decoding_map_size = avctx->width * avctx->height / (8 * 8 * 2);
|
||||
s->decoding_map_size = AV_RL16(avpkt->data);
|
||||
|
||||
/* compressed buffer needs to be large enough to at least hold an entire
|
||||
* decoding map */
|
||||
if (buf_size < s->decoding_map_size)
|
||||
if (buf_size < s->decoding_map_size + 2)
|
||||
return buf_size;
|
||||
|
||||
if (av_packet_get_side_data(avpkt, AV_PKT_DATA_PARAM_CHANGE, NULL)) {
|
||||
@@ -1000,8 +1004,8 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
|
||||
av_frame_unref(s->second_last_frame);
|
||||
}
|
||||
|
||||
s->decoding_map = buf;
|
||||
bytestream2_init(&s->stream_ptr, buf + s->decoding_map_size,
|
||||
s->decoding_map = buf + 2;
|
||||
bytestream2_init(&s->stream_ptr, buf + 2 + s->decoding_map_size,
|
||||
buf_size - s->decoding_map_size);
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
/**
|
||||
* Table of number of bits a motion vector component needs.
|
||||
*/
|
||||
static uint8_t mv_penalty[MAX_FCODE+1][MAX_MV*2+1];
|
||||
static uint8_t mv_penalty[MAX_FCODE+1][MAX_DMV*2+1];
|
||||
|
||||
/**
|
||||
* Minimal fcode that a motion vector component would need.
|
||||
@@ -677,7 +677,7 @@ static av_cold void init_mv_penalty_and_fcode(MpegEncContext *s)
|
||||
int mv;
|
||||
|
||||
for(f_code=1; f_code<=MAX_FCODE; f_code++){
|
||||
for(mv=-MAX_MV; mv<=MAX_MV; mv++){
|
||||
for(mv=-MAX_DMV; mv<=MAX_DMV; mv++){
|
||||
int len;
|
||||
|
||||
if(mv==0) len= ff_mvtab[0][1];
|
||||
@@ -698,7 +698,7 @@ static av_cold void init_mv_penalty_and_fcode(MpegEncContext *s)
|
||||
}
|
||||
}
|
||||
|
||||
mv_penalty[f_code][mv+MAX_MV]= len;
|
||||
mv_penalty[f_code][mv+MAX_DMV]= len;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -30,6 +30,7 @@
|
||||
|
||||
#define BITSTREAM_READER_LE
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/timer.h"
|
||||
#include "avcodec.h"
|
||||
#include "get_bits.h"
|
||||
@@ -310,7 +311,7 @@ av_cold int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg,
|
||||
|
||||
ivi_free_buffers(planes);
|
||||
|
||||
if (cfg->pic_width < 1 || cfg->pic_height < 1 ||
|
||||
if (av_image_check_size(cfg->pic_width, cfg->pic_height, 0, NULL) < 0 ||
|
||||
cfg->luma_bands < 1 || cfg->chroma_bands < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
|
||||
@@ -17,8 +17,46 @@
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* **********************************************************************************************************************
|
||||
*
|
||||
*
|
||||
*
|
||||
* This source code incorporates work covered by the following copyright and
|
||||
* permission notice:
|
||||
*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2007, Callum Lerwick <seg@haxxed.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* JPEG2000 image encoder
|
||||
* @file
|
||||
|
||||
+10
-1
@@ -28,6 +28,7 @@
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/mem.h"
|
||||
#include "avcodec.h"
|
||||
#include "jpeg2000.h"
|
||||
@@ -210,9 +211,17 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
|
||||
codsty->nreslevels2decode - 1,
|
||||
codsty->transform))
|
||||
return ret;
|
||||
// component size comp->coord is uint16_t so ir cannot overflow
|
||||
|
||||
if (av_image_check_size(comp->coord[0][1] - comp->coord[0][0],
|
||||
comp->coord[1][1] - comp->coord[1][0], 0, avctx))
|
||||
return AVERROR_INVALIDDATA;
|
||||
csize = (comp->coord[0][1] - comp->coord[0][0]) *
|
||||
(comp->coord[1][1] - comp->coord[1][0]);
|
||||
if (comp->coord[0][1] > 32768 ||
|
||||
comp->coord[1][1] > 32768) {
|
||||
av_log(avctx, AV_LOG_ERROR, "component size too large\n");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
if (codsty->transform == FF_DWT97) {
|
||||
comp->i_data = NULL;
|
||||
|
||||
@@ -252,6 +252,10 @@ static int get_siz(Jpeg2000DecoderContext *s)
|
||||
avpriv_request_sample(s->avctx, "Support for image offsets");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
if (s->width > 32768U || s->height > 32768U) {
|
||||
avpriv_request_sample(s->avctx, "Large Dimensions");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
if (ncomponents <= 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid number of components: %d\n",
|
||||
@@ -705,10 +709,10 @@ static int init_tile(Jpeg2000DecoderContext *s, int tileno)
|
||||
Jpeg2000QuantStyle *qntsty = tile->qntsty + compno;
|
||||
int ret; // global bandno
|
||||
|
||||
comp->coord_o[0][0] = FFMAX(tilex * s->tile_width + s->tile_offset_x, s->image_offset_x);
|
||||
comp->coord_o[0][1] = FFMIN((tilex + 1) * s->tile_width + s->tile_offset_x, s->width);
|
||||
comp->coord_o[1][0] = FFMAX(tiley * s->tile_height + s->tile_offset_y, s->image_offset_y);
|
||||
comp->coord_o[1][1] = FFMIN((tiley + 1) * s->tile_height + s->tile_offset_y, s->height);
|
||||
comp->coord_o[0][0] = av_clip(tilex * (int64_t)s->tile_width + s->tile_offset_x, s->image_offset_x, s->width);
|
||||
comp->coord_o[0][1] = av_clip((tilex + 1) * (int64_t)s->tile_width + s->tile_offset_x, s->image_offset_x, s->width);
|
||||
comp->coord_o[1][0] = av_clip(tiley * (int64_t)s->tile_height + s->tile_offset_y, s->image_offset_y, s->height);
|
||||
comp->coord_o[1][1] = av_clip((tiley + 1) * (int64_t)s->tile_height + s->tile_offset_y, s->image_offset_y, s->height);
|
||||
if (compno) {
|
||||
comp->coord_o[0][0] /= s->cdx[compno];
|
||||
comp->coord_o[0][1] /= s->cdx[compno];
|
||||
@@ -1102,6 +1106,10 @@ static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty,
|
||||
ff_mqc_initdec(&t1->mqc, cblk->data);
|
||||
|
||||
while (passno--) {
|
||||
if (bpno < 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "bpno became negative\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
switch(pass_t) {
|
||||
case 0:
|
||||
decode_sigpass(t1, width, height, bpno + 1, bandpos,
|
||||
@@ -1278,11 +1286,15 @@ static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
|
||||
if (tile->codsty[0].mct)
|
||||
mct_decode(s, tile);
|
||||
|
||||
if (s->cdef[0] < 0) {
|
||||
for (x = 0; x < s->ncomponents; x++)
|
||||
s->cdef[x] = x + 1;
|
||||
if ((s->ncomponents & 1) == 0)
|
||||
s->cdef[s->ncomponents-1] = 0;
|
||||
for (x = 0; x < s->ncomponents; x++) {
|
||||
if (s->cdef[x] < 0) {
|
||||
for (x = 0; x < s->ncomponents; x++) {
|
||||
s->cdef[x] = x + 1;
|
||||
}
|
||||
if ((s->ncomponents & 1) == 0)
|
||||
s->cdef[s->ncomponents-1] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (s->precision <= 8) {
|
||||
@@ -1400,6 +1412,7 @@ static void jpeg2000_dec_cleanup(Jpeg2000DecoderContext *s)
|
||||
memset(s->codsty, 0, sizeof(s->codsty));
|
||||
memset(s->qntsty, 0, sizeof(s->qntsty));
|
||||
s->numXtiles = s->numYtiles = 0;
|
||||
s->ncomponents = 0;
|
||||
}
|
||||
|
||||
static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
|
||||
@@ -1454,6 +1467,10 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
|
||||
|
||||
switch (marker) {
|
||||
case JPEG2000_SIZ:
|
||||
if (s->ncomponents) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Duplicate SIZ\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
ret = get_siz(s);
|
||||
if (!s->tile)
|
||||
s->numXtiles = s->numYtiles = 0;
|
||||
|
||||
@@ -540,6 +540,9 @@ int ff_jpeg2000_dwt_init(DWTContext *s, uint16_t border[2][2],
|
||||
|
||||
int ff_dwt_encode(DWTContext *s, void *t)
|
||||
{
|
||||
if (s->ndeclevels == 0)
|
||||
return 0;
|
||||
|
||||
switch(s->type){
|
||||
case FF_DWT97:
|
||||
dwt_encode97_float(s, t); break;
|
||||
@@ -555,6 +558,9 @@ int ff_dwt_encode(DWTContext *s, void *t)
|
||||
|
||||
int ff_dwt_decode(DWTContext *s, void *t)
|
||||
{
|
||||
if (s->ndeclevels == 0)
|
||||
return 0;
|
||||
|
||||
switch (s->type) {
|
||||
case FF_DWT97:
|
||||
dwt_decode97_float(s, t);
|
||||
|
||||
@@ -326,7 +326,7 @@ static int libopus_encode(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
} else
|
||||
audio = frame->data[0];
|
||||
} else {
|
||||
if (!opus->afq.remaining_samples)
|
||||
if (!opus->afq.remaining_samples || (!opus->afq.frame_alloc && !opus->afq.frame_count))
|
||||
return 0;
|
||||
audio = opus->samples;
|
||||
memset(audio, 0, opus->opts.packet_size * sample_size);
|
||||
|
||||
@@ -222,9 +222,19 @@ static int utvideo_decode_frame(AVCodecContext *avctx, void *data,
|
||||
pic->data[0] = utv->buffer + utv->buf_size + pic->linesize[0];
|
||||
break;
|
||||
}
|
||||
pic->width = w;
|
||||
pic->height = h;
|
||||
pic->format = avctx->pix_fmt;
|
||||
|
||||
if (avctx->refcounted_frames) {
|
||||
int ret = av_frame_ref((AVFrame*)data, pic);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else {
|
||||
av_frame_move_ref((AVFrame*)data, pic);
|
||||
}
|
||||
|
||||
*got_frame = 1;
|
||||
av_frame_move_ref((AVFrame*)data, pic);
|
||||
|
||||
return avpkt->size;
|
||||
}
|
||||
|
||||
@@ -41,8 +41,9 @@ static av_cold int libwebp_anim_encode_init(AVCodecContext *avctx)
|
||||
int ret = ff_libwebp_encode_init_common(avctx);
|
||||
if (!ret) {
|
||||
LibWebPAnimContext *s = avctx->priv_data;
|
||||
WebPAnimEncoderOptions enc_options;
|
||||
WebPAnimEncoderOptions enc_options = { 0 };
|
||||
WebPAnimEncoderOptionsInit(&enc_options);
|
||||
enc_options.verbose = av_log_get_level() >= AV_LOG_VERBOSE;
|
||||
// TODO(urvang): Expose some options on command-line perhaps.
|
||||
s->enc = WebPAnimEncoderNew(avctx->width, avctx->height, &enc_options);
|
||||
if (!s->enc)
|
||||
|
||||
@@ -164,6 +164,8 @@ static char *microdvd_load_tags(struct microdvd_tag *tags, char *s)
|
||||
|
||||
/* Position */
|
||||
case 'P':
|
||||
if (!*s)
|
||||
break;
|
||||
tag.persistent = MICRODVD_PERSISTENT_ON;
|
||||
tag.data1 = (*s++ == '1');
|
||||
if (*s != '}')
|
||||
|
||||
@@ -4369,7 +4369,7 @@ BI_MC_COPY(64);
|
||||
#undef BI_MC_COPY
|
||||
|
||||
#define BI_MC(PEL, DIR, WIDTH, TAP, DIR1, FILT_DIR) \
|
||||
void ff_hevc_put_hevc_bi_##PEL##_##DIR####WIDTH##_8_msa(uint8_t *dst, \
|
||||
void ff_hevc_put_hevc_bi_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst, \
|
||||
ptrdiff_t dst_stride, \
|
||||
uint8_t *src, \
|
||||
ptrdiff_t src_stride, \
|
||||
@@ -4423,7 +4423,7 @@ BI_MC(epel, v, 32, 4, vt, my);
|
||||
#undef BI_MC
|
||||
|
||||
#define BI_MC_HV(PEL, DIR, WIDTH, TAP, DIR1) \
|
||||
void ff_hevc_put_hevc_bi_##PEL##_##DIR####WIDTH##_8_msa(uint8_t *dst, \
|
||||
void ff_hevc_put_hevc_bi_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst, \
|
||||
ptrdiff_t dst_stride, \
|
||||
uint8_t *src, \
|
||||
ptrdiff_t src_stride, \
|
||||
|
||||
@@ -5454,7 +5454,7 @@ BI_W_MC_COPY(64);
|
||||
#undef BI_W_MC_COPY
|
||||
|
||||
#define BI_W_MC(PEL, DIR, WIDTH, TAP, DIR1, FILT_DIR) \
|
||||
void ff_hevc_put_hevc_bi_w_##PEL##_##DIR####WIDTH##_8_msa(uint8_t *dst, \
|
||||
void ff_hevc_put_hevc_bi_w_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst, \
|
||||
ptrdiff_t \
|
||||
dst_stride, \
|
||||
uint8_t *src, \
|
||||
@@ -5521,7 +5521,7 @@ BI_W_MC(epel, v, 32, 4, vt, my);
|
||||
#undef BI_W_MC
|
||||
|
||||
#define BI_W_MC_HV(PEL, DIR, WIDTH, TAP, DIR1) \
|
||||
void ff_hevc_put_hevc_bi_w_##PEL##_##DIR####WIDTH##_8_msa(uint8_t *dst, \
|
||||
void ff_hevc_put_hevc_bi_w_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst, \
|
||||
ptrdiff_t \
|
||||
dst_stride, \
|
||||
uint8_t *src, \
|
||||
|
||||
@@ -3871,7 +3871,7 @@ UNI_MC_COPY(64);
|
||||
#undef UNI_MC_COPY
|
||||
|
||||
#define UNI_MC(PEL, DIR, WIDTH, TAP, DIR1, FILT_DIR) \
|
||||
void ff_hevc_put_hevc_uni_##PEL##_##DIR####WIDTH##_8_msa(uint8_t *dst, \
|
||||
void ff_hevc_put_hevc_uni_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst, \
|
||||
ptrdiff_t \
|
||||
dst_stride, \
|
||||
uint8_t *src, \
|
||||
@@ -3925,7 +3925,7 @@ UNI_MC(epel, v, 32, 4, vt, my);
|
||||
#undef UNI_MC
|
||||
|
||||
#define UNI_MC_HV(PEL, DIR, WIDTH, TAP, DIR1) \
|
||||
void ff_hevc_put_hevc_uni_##PEL##_##DIR####WIDTH##_8_msa(uint8_t *dst, \
|
||||
void ff_hevc_put_hevc_uni_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst, \
|
||||
ptrdiff_t \
|
||||
dst_stride, \
|
||||
uint8_t *src, \
|
||||
|
||||
@@ -4687,7 +4687,7 @@ UNIWGT_MC_COPY(64);
|
||||
#undef UNIWGT_MC_COPY
|
||||
|
||||
#define UNI_W_MC(PEL, DIR, WIDTH, TAP, DIR1, FILT_DIR) \
|
||||
void ff_hevc_put_hevc_uni_w_##PEL##_##DIR####WIDTH##_8_msa(uint8_t *dst, \
|
||||
void ff_hevc_put_hevc_uni_w_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst, \
|
||||
ptrdiff_t \
|
||||
dst_stride, \
|
||||
uint8_t *src, \
|
||||
@@ -4746,7 +4746,7 @@ UNI_W_MC(epel, v, 32, 4, vt, my);
|
||||
#undef UNI_W_MC
|
||||
|
||||
#define UNI_W_MC_HV(PEL, DIR, WIDTH, TAP, DIR1) \
|
||||
void ff_hevc_put_hevc_uni_w_##PEL##_##DIR####WIDTH##_8_msa(uint8_t *dst, \
|
||||
void ff_hevc_put_hevc_uni_w_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst, \
|
||||
ptrdiff_t \
|
||||
dst_stride, \
|
||||
uint8_t *src, \
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "libavcodec/hevcdsp.h"
|
||||
|
||||
#define MC(PEL, DIR, WIDTH) \
|
||||
void ff_hevc_put_hevc_##PEL##_##DIR####WIDTH##_8_msa(int16_t *dst, \
|
||||
void ff_hevc_put_hevc_##PEL##_##DIR##WIDTH##_8_msa(int16_t *dst, \
|
||||
uint8_t *src, \
|
||||
ptrdiff_t src_stride, \
|
||||
int height, \
|
||||
@@ -102,7 +102,7 @@ MC(epel, hv, 64);
|
||||
#undef MC
|
||||
|
||||
#define UNI_MC(PEL, DIR, WIDTH) \
|
||||
void ff_hevc_put_hevc_uni_##PEL##_##DIR####WIDTH##_8_msa(uint8_t *dst, \
|
||||
void ff_hevc_put_hevc_uni_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst, \
|
||||
ptrdiff_t dst_stride, \
|
||||
uint8_t *src, \
|
||||
ptrdiff_t src_stride, \
|
||||
@@ -181,7 +181,7 @@ UNI_MC(epel, hv, 64);
|
||||
#undef UNI_MC
|
||||
|
||||
#define UNI_W_MC(PEL, DIR, WIDTH) \
|
||||
void ff_hevc_put_hevc_uni_w_##PEL##_##DIR####WIDTH##_8_msa(uint8_t *dst, \
|
||||
void ff_hevc_put_hevc_uni_w_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst, \
|
||||
ptrdiff_t \
|
||||
dst_stride, \
|
||||
uint8_t *src, \
|
||||
@@ -265,7 +265,7 @@ UNI_W_MC(epel, hv, 64);
|
||||
#undef UNI_W_MC
|
||||
|
||||
#define BI_MC(PEL, DIR, WIDTH) \
|
||||
void ff_hevc_put_hevc_bi_##PEL##_##DIR####WIDTH##_8_msa(uint8_t *dst, \
|
||||
void ff_hevc_put_hevc_bi_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst, \
|
||||
ptrdiff_t dst_stride, \
|
||||
uint8_t *src, \
|
||||
ptrdiff_t src_stride, \
|
||||
@@ -345,7 +345,7 @@ BI_MC(epel, hv, 64);
|
||||
#undef BI_MC
|
||||
|
||||
#define BI_W_MC(PEL, DIR, WIDTH) \
|
||||
void ff_hevc_put_hevc_bi_w_##PEL##_##DIR####WIDTH##_8_msa(uint8_t *dst, \
|
||||
void ff_hevc_put_hevc_bi_w_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst, \
|
||||
ptrdiff_t \
|
||||
dst_stride, \
|
||||
uint8_t *src, \
|
||||
|
||||
@@ -3792,7 +3792,7 @@ MC_COPY(64);
|
||||
#undef MC_COPY
|
||||
|
||||
#define MC(PEL, DIR, WIDTH, TAP, DIR1, FILT_DIR) \
|
||||
void ff_hevc_put_hevc_##PEL##_##DIR####WIDTH##_8_msa(int16_t *dst, \
|
||||
void ff_hevc_put_hevc_##PEL##_##DIR##WIDTH##_8_msa(int16_t *dst, \
|
||||
uint8_t *src, \
|
||||
ptrdiff_t src_stride, \
|
||||
int height, \
|
||||
@@ -3843,7 +3843,7 @@ MC(epel, v, 32, 4, vt, my);
|
||||
#undef MC
|
||||
|
||||
#define MC_HV(PEL, DIR, WIDTH, TAP, DIR1) \
|
||||
void ff_hevc_put_hevc_##PEL##_##DIR####WIDTH##_8_msa(int16_t *dst, \
|
||||
void ff_hevc_put_hevc_##PEL##_##DIR##WIDTH##_8_msa(int16_t *dst, \
|
||||
uint8_t *src, \
|
||||
ptrdiff_t src_stride, \
|
||||
int height, \
|
||||
|
||||
+47
-19
@@ -98,6 +98,15 @@ static void parse_avid(MJpegDecodeContext *s, uint8_t *buf, int len)
|
||||
av_log(s->avctx, AV_LOG_INFO, "AVID: len:%d %d\n", len, len > 14 ? buf[12] : -1);
|
||||
}
|
||||
|
||||
static void init_idct(AVCodecContext *avctx)
|
||||
{
|
||||
MJpegDecodeContext *s = avctx->priv_data;
|
||||
|
||||
ff_idctdsp_init(&s->idsp, avctx);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->scantable,
|
||||
ff_zigzag_direct);
|
||||
}
|
||||
|
||||
av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
MJpegDecodeContext *s = avctx->priv_data;
|
||||
@@ -112,9 +121,7 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
|
||||
s->avctx = avctx;
|
||||
ff_blockdsp_init(&s->bdsp, avctx);
|
||||
ff_hpeldsp_init(&s->hdsp, avctx->flags);
|
||||
ff_idctdsp_init(&s->idsp, avctx);
|
||||
ff_init_scantable(s->idsp.idct_permutation, &s->scantable,
|
||||
ff_zigzag_direct);
|
||||
init_idct(avctx);
|
||||
s->buffer_size = 0;
|
||||
s->buffer = NULL;
|
||||
s->start_code = -1;
|
||||
@@ -267,7 +274,6 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
|
||||
/* XXX: verify len field validity */
|
||||
len = get_bits(&s->gb, 16);
|
||||
s->avctx->bits_per_raw_sample =
|
||||
bits = get_bits(&s->gb, 8);
|
||||
|
||||
if (bits > 16 || bits < 1) {
|
||||
@@ -275,6 +281,11 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (s->avctx->bits_per_raw_sample != bits) {
|
||||
av_log(s->avctx, AV_LOG_INFO, "Changeing bps to %d\n", bits);
|
||||
s->avctx->bits_per_raw_sample = bits;
|
||||
init_idct(s->avctx);
|
||||
}
|
||||
if (s->pegasus_rct)
|
||||
bits = 9;
|
||||
if (bits == 9 && !s->pegasus_rct)
|
||||
@@ -617,7 +628,8 @@ unk_pixfmt:
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "decode_sof0: error, len(%d) mismatch\n", len);
|
||||
}
|
||||
|
||||
if (s->rgb && !s->lossless && !s->ls) {
|
||||
if ((s->rgb && !s->lossless && !s->ls) ||
|
||||
(!s->rgb && s->ls && s->nb_components > 1)) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Unsupported coding and pixel format combination\n");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
@@ -982,7 +994,7 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
|
||||
return -1;
|
||||
|
||||
left[i] = buffer[mb_x][i] =
|
||||
mask & (pred + (dc << point_transform));
|
||||
mask & (pred + (dc * (1 << point_transform)));
|
||||
}
|
||||
|
||||
if (s->restart_interval && !--s->restart_count) {
|
||||
@@ -990,7 +1002,14 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
|
||||
skip_bits(&s->gb, 16); /* skip RSTn */
|
||||
}
|
||||
}
|
||||
if (s->nb_components == 4) {
|
||||
if (s->rct && s->nb_components == 4) {
|
||||
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
|
||||
ptr[4*mb_x + 2] = buffer[mb_x][0] - ((buffer[mb_x][1] + buffer[mb_x][2] - 0x200) >> 2);
|
||||
ptr[4*mb_x + 1] = buffer[mb_x][1] + ptr[4*mb_x + 2];
|
||||
ptr[4*mb_x + 3] = buffer[mb_x][2] + ptr[4*mb_x + 2];
|
||||
ptr[4*mb_x + 0] = buffer[mb_x][3];
|
||||
}
|
||||
} else if (s->nb_components == 4) {
|
||||
for(i=0; i<nb_components; i++) {
|
||||
int c= s->comp_index[i];
|
||||
if (s->bits <= 8) {
|
||||
@@ -1081,7 +1100,10 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
|
||||
dc = mjpeg_decode_dc(s, s->dc_index[i]);
|
||||
if(dc == 0xFFFFF)
|
||||
return -1;
|
||||
if(bits<=8){
|
||||
if ( h * mb_x + x >= s->width
|
||||
|| 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){
|
||||
@@ -1149,7 +1171,10 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
|
||||
dc = mjpeg_decode_dc(s, s->dc_index[i]);
|
||||
if(dc == 0xFFFFF)
|
||||
return -1;
|
||||
if(bits<=8){
|
||||
if ( h * mb_x + x >= s->width
|
||||
|| 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
|
||||
@@ -1217,7 +1242,7 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
|
||||
int mb_bitmask_size,
|
||||
const AVFrame *reference)
|
||||
{
|
||||
int i, mb_x, mb_y;
|
||||
int i, mb_x, mb_y, chroma_h_shift, chroma_v_shift, chroma_width, chroma_height;
|
||||
uint8_t *data[MAX_COMPONENTS];
|
||||
const uint8_t *reference_data[MAX_COMPONENTS];
|
||||
int linesize[MAX_COMPONENTS];
|
||||
@@ -1234,6 +1259,11 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
|
||||
|
||||
s->restart_count = 0;
|
||||
|
||||
av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt, &chroma_h_shift,
|
||||
&chroma_v_shift);
|
||||
chroma_width = FF_CEIL_RSHIFT(s->width, chroma_h_shift);
|
||||
chroma_height = FF_CEIL_RSHIFT(s->height, chroma_v_shift);
|
||||
|
||||
for (i = 0; i < nb_components; i++) {
|
||||
int c = s->comp_index[i];
|
||||
data[c] = s->picture_ptr->data[c];
|
||||
@@ -1270,8 +1300,8 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
|
||||
|
||||
if (s->interlaced && s->bottom_field)
|
||||
block_offset += linesize[c] >> 1;
|
||||
if ( 8*(h * mb_x + x) < s->width
|
||||
&& 8*(v * mb_y + y) < s->height) {
|
||||
if ( 8*(h * mb_x + x) < ((c == 1) || (c == 2) ? chroma_width : s->width)
|
||||
&& 8*(v * mb_y + y) < ((c == 1) || (c == 2) ? chroma_height : s->height)) {
|
||||
ptr = data[c] + block_offset;
|
||||
} else
|
||||
ptr = NULL;
|
||||
@@ -1346,12 +1376,10 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (!Al) {
|
||||
// s->coefs_finished is a bitmask for coefficients coded
|
||||
// ss and se are parameters telling start and end coefficients
|
||||
s->coefs_finished[c] |= (2ULL << se) - (1ULL << ss);
|
||||
last_scan = !~s->coefs_finished[c];
|
||||
}
|
||||
// s->coefs_finished is a bitmask for coefficients coded
|
||||
// ss and se are parameters telling start and end coefficients
|
||||
s->coefs_finished[c] |= (2ULL << se) - (1ULL << ss);
|
||||
last_scan = !Al && !~s->coefs_finished[c];
|
||||
|
||||
if (s->interlaced && s->bottom_field)
|
||||
data += linesize >> 1;
|
||||
@@ -1931,7 +1959,7 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
|
||||
while (b < t) {
|
||||
uint8_t x = src[b++];
|
||||
put_bits(&pb, 8, x);
|
||||
if (x == 0xFF) {
|
||||
if (x == 0xFF && b < t) {
|
||||
x = src[b++];
|
||||
if (x & 0x80) {
|
||||
av_log(s->avctx, AV_LOG_WARNING, "Invalid escape sequence\n");
|
||||
|
||||
@@ -119,6 +119,16 @@ static void jpeg_put_comments(AVCodecContext *avctx, PutBitContext *p)
|
||||
uint8_t *ptr;
|
||||
|
||||
if (avctx->sample_aspect_ratio.num > 0 && avctx->sample_aspect_ratio.den > 0) {
|
||||
AVRational sar = avctx->sample_aspect_ratio;
|
||||
|
||||
if (sar.num > 65535 || sar.den > 65535) {
|
||||
if (!av_reduce(&sar.num, &sar.den, avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den, 65535))
|
||||
av_log(avctx, AV_LOG_WARNING,
|
||||
"Cannot store exact aspect ratio %d:%d\n",
|
||||
avctx->sample_aspect_ratio.num,
|
||||
avctx->sample_aspect_ratio.den);
|
||||
}
|
||||
|
||||
/* JFIF header */
|
||||
put_marker(p, APP0);
|
||||
put_bits(p, 16, 16);
|
||||
@@ -128,8 +138,8 @@ static void jpeg_put_comments(AVCodecContext *avctx, PutBitContext *p)
|
||||
* released revision. */
|
||||
put_bits(p, 16, 0x0102);
|
||||
put_bits(p, 8, 0); /* units type: 0 - aspect ratio */
|
||||
put_bits(p, 16, avctx->sample_aspect_ratio.num);
|
||||
put_bits(p, 16, avctx->sample_aspect_ratio.den);
|
||||
put_bits(p, 16, sar.num);
|
||||
put_bits(p, 16, sar.den);
|
||||
put_bits(p, 8, 0); /* thumbnail width */
|
||||
put_bits(p, 8, 0); /* thumbnail height */
|
||||
}
|
||||
|
||||
@@ -908,7 +908,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
|
||||
c->penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_cmp);
|
||||
c->sub_penalty_factor= get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_sub_cmp);
|
||||
c->mb_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->mb_cmp);
|
||||
c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV;
|
||||
c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_DMV;
|
||||
|
||||
get_limits(s, 16*mb_x, 16*mb_y);
|
||||
c->skip=0;
|
||||
@@ -1084,7 +1084,7 @@ int ff_pre_estimate_p_frame_motion(MpegEncContext * s,
|
||||
av_assert0(s->quarter_sample==0 || s->quarter_sample==1);
|
||||
|
||||
c->pre_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_pre_cmp);
|
||||
c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV;
|
||||
c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_DMV;
|
||||
|
||||
get_limits(s, 16*mb_x, 16*mb_y);
|
||||
c->skip=0;
|
||||
@@ -1133,7 +1133,7 @@ static int estimate_motion_b(MpegEncContext *s, int mb_x, int mb_y,
|
||||
const int shift= 1+s->quarter_sample;
|
||||
const int mot_stride = s->mb_stride;
|
||||
const int mot_xy = mb_y*mot_stride + mb_x;
|
||||
uint8_t * const mv_penalty= c->mv_penalty[f_code] + MAX_MV;
|
||||
uint8_t * const mv_penalty= c->mv_penalty[f_code] + MAX_DMV;
|
||||
int mv_scale;
|
||||
|
||||
c->penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_cmp);
|
||||
@@ -1207,8 +1207,8 @@ static inline int check_bidir_mv(MpegEncContext * s,
|
||||
//FIXME better f_code prediction (max mv & distance)
|
||||
//FIXME pointers
|
||||
MotionEstContext * const c= &s->me;
|
||||
uint8_t * const mv_penalty_f= c->mv_penalty[s->f_code] + MAX_MV; // f_code of the prev frame
|
||||
uint8_t * const mv_penalty_b= c->mv_penalty[s->b_code] + MAX_MV; // f_code of the prev frame
|
||||
uint8_t * const mv_penalty_f= c->mv_penalty[s->f_code] + MAX_DMV; // f_code of the prev frame
|
||||
uint8_t * const mv_penalty_b= c->mv_penalty[s->b_code] + MAX_DMV; // f_code of the prev frame
|
||||
int stride= c->stride;
|
||||
uint8_t *dest_y = c->scratchpad;
|
||||
uint8_t *ptr;
|
||||
@@ -1421,7 +1421,7 @@ static inline int direct_search(MpegEncContext * s, int mb_x, int mb_y)
|
||||
int mx, my, xmin, xmax, ymin, ymax;
|
||||
int16_t (*mv_table)[2]= s->b_direct_mv_table;
|
||||
|
||||
c->current_mv_penalty= c->mv_penalty[1] + MAX_MV;
|
||||
c->current_mv_penalty= c->mv_penalty[1] + MAX_DMV;
|
||||
ymin= xmin=(-32)>>shift;
|
||||
ymax= xmax= 31>>shift;
|
||||
|
||||
@@ -1557,11 +1557,11 @@ void ff_estimate_b_frame_motion(MpegEncContext * s,
|
||||
if (s->avctx->flags & CODEC_FLAG_INTERLACED_ME) {
|
||||
//FIXME mb type penalty
|
||||
c->skip=0;
|
||||
c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV;
|
||||
c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_DMV;
|
||||
fimin= interlaced_search(s, 0,
|
||||
s->b_field_mv_table[0], s->b_field_select_table[0],
|
||||
s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1], 0);
|
||||
c->current_mv_penalty= c->mv_penalty[s->b_code] + MAX_MV;
|
||||
c->current_mv_penalty= c->mv_penalty[s->b_code] + MAX_DMV;
|
||||
bimin= interlaced_search(s, 2,
|
||||
s->b_field_mv_table[1], s->b_field_select_table[1],
|
||||
s->b_back_mv_table[xy][0], s->b_back_mv_table[xy][1], 0);
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
struct MpegEncContext;
|
||||
|
||||
#define MAX_MV 4096
|
||||
#define MAX_DMV (2*MAX_MV)
|
||||
|
||||
/**
|
||||
* Motion estimation context.
|
||||
@@ -80,7 +81,7 @@ typedef struct MotionEstContext {
|
||||
op_pixels_func(*hpel_avg)[4];
|
||||
qpel_mc_func(*qpel_put)[16];
|
||||
qpel_mc_func(*qpel_avg)[16];
|
||||
uint8_t (*mv_penalty)[MAX_MV * 2 + 1]; ///< bit amount needed to encode a MV
|
||||
uint8_t (*mv_penalty)[MAX_DMV * 2 + 1]; ///< bit amount needed to encode a MV
|
||||
uint8_t *current_mv_penalty;
|
||||
int (*sub_motion_search)(struct MpegEncContext *s,
|
||||
int *mx_ptr, int *my_ptr, int dmin,
|
||||
|
||||
@@ -1928,7 +1928,7 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
|
||||
(left && show_bits(&s->gb, FFMIN(left, 23)) && !is_d10) ||
|
||||
((avctx->err_recognition & (AV_EF_BITSTREAM | AV_EF_AGGRESSIVE)) && left > 8)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "end mismatch left=%d %0X\n",
|
||||
left, show_bits(&s->gb, FFMIN(left, 23)));
|
||||
left, left>0 ? show_bits(&s->gb, FFMIN(left, 23)) : 0);
|
||||
return AVERROR_INVALIDDATA;
|
||||
} else
|
||||
goto eos;
|
||||
@@ -2152,8 +2152,6 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
|
||||
if (check_marker(&s->gb, "in sequence header") == 0) {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->width = width;
|
||||
s->height = height;
|
||||
|
||||
s->avctx->rc_buffer_size = get_bits(&s->gb, 10) * 1024 * 16;
|
||||
skip_bits(&s->gb, 1);
|
||||
@@ -2185,6 +2183,9 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
s->width = width;
|
||||
s->height = height;
|
||||
|
||||
/* We set MPEG-2 parameters so that it emulates MPEG-1. */
|
||||
s->progressive_sequence = 1;
|
||||
s->progressive_frame = 1;
|
||||
|
||||
@@ -52,7 +52,7 @@ static const uint8_t svcd_scan_offset_placeholder[] = {
|
||||
0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
};
|
||||
|
||||
static uint8_t mv_penalty[MAX_FCODE + 1][MAX_MV * 2 + 1];
|
||||
static uint8_t mv_penalty[MAX_FCODE + 1][MAX_DMV * 2 + 1];
|
||||
static uint8_t fcode_tab[MAX_MV * 2 + 1];
|
||||
|
||||
static uint8_t uni_mpeg1_ac_vlc_len[64 * 64 * 2];
|
||||
@@ -144,9 +144,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
{
|
||||
MpegEncContext *s = avctx->priv_data;
|
||||
|
||||
if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO && avctx->height > 2800)
|
||||
avctx->thread_count = 1;
|
||||
|
||||
if (ff_mpv_encode_init(avctx) < 0)
|
||||
return -1;
|
||||
|
||||
@@ -1051,7 +1048,7 @@ av_cold void ff_mpeg1_encode_init(MpegEncContext *s)
|
||||
}
|
||||
|
||||
for (f_code = 1; f_code <= MAX_FCODE; f_code++)
|
||||
for (mv = -MAX_MV; mv <= MAX_MV; mv++) {
|
||||
for (mv = -MAX_DMV; mv <= MAX_DMV; mv++) {
|
||||
int len;
|
||||
|
||||
if (mv == 0) {
|
||||
@@ -1074,7 +1071,7 @@ av_cold void ff_mpeg1_encode_init(MpegEncContext *s)
|
||||
2 + bit_size;
|
||||
}
|
||||
|
||||
mv_penalty[f_code][mv + MAX_MV] = len;
|
||||
mv_penalty[f_code][mv + MAX_DMV] = len;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ void ff_mpeg4_encode_mb(MpegEncContext *s,
|
||||
void ff_mpeg4_pred_ac(MpegEncContext *s, int16_t *block, int n,
|
||||
int dir);
|
||||
void ff_set_mpeg4_time(MpegEncContext *s);
|
||||
void ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
|
||||
int ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
|
||||
|
||||
int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb);
|
||||
void ff_mpeg4_encode_video_packet_header(MpegEncContext *s);
|
||||
|
||||
@@ -882,7 +882,7 @@ int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx)
|
||||
const int part_a_end = s->pict_type == AV_PICTURE_TYPE_I ? (ER_DC_END | ER_MV_END) : ER_MV_END;
|
||||
|
||||
mb_num = mpeg4_decode_partition_a(ctx);
|
||||
if (mb_num < 0) {
|
||||
if (mb_num <= 0) {
|
||||
ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y,
|
||||
s->mb_x, s->mb_y, part_a_error);
|
||||
return -1;
|
||||
@@ -1875,6 +1875,10 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
int last = 0;
|
||||
for (i = 0; i < 64; i++) {
|
||||
int j;
|
||||
if (get_bits_left(gb) < 8) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "insufficient data for custom matrix\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
v = get_bits(gb, 8);
|
||||
if (v == 0)
|
||||
break;
|
||||
@@ -1898,6 +1902,10 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
|
||||
int last = 0;
|
||||
for (i = 0; i < 64; i++) {
|
||||
int j;
|
||||
if (get_bits_left(gb) < 8) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "insufficient data for custom matrix\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
v = get_bits(gb, 8);
|
||||
if (v == 0)
|
||||
break;
|
||||
|
||||
@@ -1086,7 +1086,7 @@ static void mpeg4_encode_vol_header(MpegEncContext *s,
|
||||
}
|
||||
|
||||
/* write mpeg4 VOP header */
|
||||
void ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number)
|
||||
int ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number)
|
||||
{
|
||||
int time_incr;
|
||||
int time_div, time_mod;
|
||||
@@ -1112,6 +1112,12 @@ void ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number)
|
||||
time_mod = FFUMOD(s->time, s->avctx->time_base.den);
|
||||
time_incr = time_div - s->last_time_base;
|
||||
av_assert0(time_incr >= 0);
|
||||
|
||||
// This limits the frame duration to max 1 hour
|
||||
if (time_incr > 3600) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "time_incr %d too large\n", time_incr);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
while (time_incr--)
|
||||
put_bits(&s->pb, 1, 1);
|
||||
|
||||
@@ -1137,6 +1143,8 @@ void ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number)
|
||||
put_bits(&s->pb, 3, s->f_code); /* fcode_for */
|
||||
if (s->pict_type == AV_PICTURE_TYPE_B)
|
||||
put_bits(&s->pb, 3, s->b_code); /* fcode_back */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static av_cold void init_uni_dc_tab(void)
|
||||
|
||||
@@ -1657,9 +1657,11 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr,
|
||||
uint32_t header;
|
||||
int ret;
|
||||
|
||||
int skipped = 0;
|
||||
while(buf_size && !*buf){
|
||||
buf++;
|
||||
buf_size--;
|
||||
skipped++;
|
||||
}
|
||||
|
||||
if (buf_size < HEADER_SIZE)
|
||||
@@ -1714,7 +1716,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr,
|
||||
return ret;
|
||||
}
|
||||
s->frame_size = 0;
|
||||
return buf_size;
|
||||
return buf_size + skipped;
|
||||
}
|
||||
|
||||
static void mp_flush(MPADecodeContext *ctx)
|
||||
|
||||
@@ -1257,6 +1257,7 @@ static void clear_context(MpegEncContext *s)
|
||||
|
||||
s->parse_context.buffer = NULL;
|
||||
s->parse_context.buffer_size = 0;
|
||||
s->parse_context.overread = 0;
|
||||
s->bitstream_buffer = NULL;
|
||||
s->allocated_bitstream_buffer_size = 0;
|
||||
s->picture = NULL;
|
||||
|
||||
@@ -72,7 +72,7 @@ static int sse_mb(MpegEncContext *s);
|
||||
static void denoise_dct_c(MpegEncContext *s, int16_t *block);
|
||||
static int dct_quantize_trellis_c(MpegEncContext *s, int16_t *block, int n, int qscale, int *overflow);
|
||||
|
||||
static uint8_t default_mv_penalty[MAX_FCODE + 1][MAX_MV * 2 + 1];
|
||||
static uint8_t default_mv_penalty[MAX_FCODE + 1][MAX_DMV * 2 + 1];
|
||||
static uint8_t default_fcode_tab[MAX_MV * 2 + 1];
|
||||
|
||||
const AVOption ff_mpv_generic_options[] = {
|
||||
@@ -317,6 +317,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
|
||||
break;
|
||||
}
|
||||
|
||||
avctx->bits_per_raw_sample = av_clip(avctx->bits_per_raw_sample, 0, 8);
|
||||
s->bit_rate = avctx->bit_rate;
|
||||
s->width = avctx->width;
|
||||
s->height = avctx->height;
|
||||
@@ -2739,6 +2740,11 @@ int ff_mpv_reallocate_putbitbuffer(MpegEncContext *s, size_t threshold, size_t s
|
||||
uint8_t *new_buffer = NULL;
|
||||
int new_buffer_size = 0;
|
||||
|
||||
if ((s->avctx->internal->byte_buffer_size + size_increase) >= INT_MAX/8) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Cannot reallocate putbit buffer\n");
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
av_fast_padded_malloc(&new_buffer, &new_buffer_size,
|
||||
s->avctx->internal->byte_buffer_size + size_increase);
|
||||
if (!new_buffer)
|
||||
@@ -3722,9 +3728,11 @@ static int encode_picture(MpegEncContext *s, int picture_number)
|
||||
ff_wmv2_encode_picture_header(s, picture_number);
|
||||
else if (CONFIG_MSMPEG4_ENCODER && s->msmpeg4_version)
|
||||
ff_msmpeg4_encode_picture_header(s, picture_number);
|
||||
else if (CONFIG_MPEG4_ENCODER && s->h263_pred)
|
||||
ff_mpeg4_encode_picture_header(s, picture_number);
|
||||
else if (CONFIG_RV10_ENCODER && s->codec_id == AV_CODEC_ID_RV10) {
|
||||
else if (CONFIG_MPEG4_ENCODER && s->h263_pred) {
|
||||
ret = ff_mpeg4_encode_picture_header(s, picture_number);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else if (CONFIG_RV10_ENCODER && s->codec_id == AV_CODEC_ID_RV10) {
|
||||
ret = ff_rv10_encode_picture_header(s, picture_number);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
+6
-1
@@ -210,8 +210,13 @@ static int decode_555(GetByteContext *gB, uint16_t *dst, int stride,
|
||||
last_symbol = b << 8 | bytestream2_get_byte(gB);
|
||||
else if (b > 129) {
|
||||
repeat = 0;
|
||||
while (b-- > 130)
|
||||
while (b-- > 130) {
|
||||
if (repeat >= (INT_MAX >> 8) - 1) {
|
||||
av_log(NULL, AV_LOG_ERROR, "repeat overflow\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
repeat = (repeat << 8) + bytestream2_get_byte(gB) + 1;
|
||||
}
|
||||
if (last_symbol == -2) {
|
||||
int skip = FFMIN((unsigned)repeat, dst + w - p);
|
||||
repeat -= skip;
|
||||
|
||||
+9
-2
@@ -211,9 +211,16 @@ static inline int get_egolomb(GetBitContext *gb)
|
||||
{
|
||||
int v = 4;
|
||||
|
||||
while (get_bits1(gb)) v++;
|
||||
while (get_bits1(gb)) {
|
||||
v++;
|
||||
if (v > 30) {
|
||||
av_log(NULL, AV_LOG_WARNING, "Too large golomb code in get_egolomb.\n");
|
||||
v = 30;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (1 << v) + get_bits(gb, v);
|
||||
return (1 << v) + get_bits_long(gb, v);
|
||||
}
|
||||
|
||||
static int on2avc_decode_pairs(On2AVCContext *c, GetBitContext *gb, float *dst,
|
||||
|
||||
@@ -824,7 +824,7 @@ static inline void silk_stabilize_lsf(int16_t nlsf[16], int order, const uint16_
|
||||
|
||||
/* upper extent */
|
||||
for (i = order; i > k; i--)
|
||||
max_center -= min_delta[k];
|
||||
max_center -= min_delta[i];
|
||||
max_center -= min_delta[k] >> 1;
|
||||
|
||||
/* move apart */
|
||||
|
||||
@@ -538,7 +538,7 @@ static int opus_decode_packet(AVCodecContext *avctx, void *data,
|
||||
memset(frame->extended_data[i], 0, frame->linesize[0]);
|
||||
}
|
||||
|
||||
if (c->gain_i) {
|
||||
if (c->gain_i && decoded_samples > 0) {
|
||||
c->fdsp->vector_fmul_scalar((float*)frame->extended_data[i],
|
||||
(float*)frame->extended_data[i],
|
||||
c->gain, FFALIGN(decoded_samples, 8));
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/opt.h"
|
||||
|
||||
#define RGBA(r,g,b,a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
|
||||
#define RGBA(r,g,b,a) (((unsigned)(a) << 24) | ((r) << 16) | ((g) << 8) | (b))
|
||||
#define MAX_EPOCH_PALETTES 8 // Max 8 allowed per PGS epoch
|
||||
#define MAX_EPOCH_OBJECTS 64 // Max 64 allowed per PGS epoch
|
||||
#define MAX_OBJECT_REFS 2 // Max objects per display set
|
||||
@@ -354,8 +354,14 @@ static int parse_palette_segment(AVCodecContext *avctx,
|
||||
cb = bytestream_get_byte(&buf);
|
||||
alpha = bytestream_get_byte(&buf);
|
||||
|
||||
YUV_TO_RGB1(cb, cr);
|
||||
YUV_TO_RGB2(r, g, b, y);
|
||||
/* Default to BT.709 colorimetry. In case of <= 576 height use BT.601 */
|
||||
if (avctx->height <= 0 || avctx->height > 576) {
|
||||
YUV_TO_RGB1_CCIR_BT709(cb, cr);
|
||||
} else {
|
||||
YUV_TO_RGB1_CCIR(cb, cr);
|
||||
}
|
||||
|
||||
YUV_TO_RGB2_CCIR(r, g, b, y);
|
||||
|
||||
ff_dlog(avctx, "Color %d := (%d,%d,%d,%d)\n", color_id, r, g, b, alpha);
|
||||
|
||||
|
||||
+3
-1
@@ -946,7 +946,7 @@ static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s,
|
||||
for (x = s->x_offset; x < s->x_offset + s->cur_w; ++x, foreground += s->bpp, background += s->bpp) {
|
||||
size_t b;
|
||||
uint8_t foreground_alpha, background_alpha, output_alpha;
|
||||
uint8_t output[4];
|
||||
uint8_t output[10];
|
||||
|
||||
// Since we might be blending alpha onto alpha, we use the following equations:
|
||||
// output_alpha = foreground_alpha + (1 - foreground_alpha) * background_alpha
|
||||
@@ -986,6 +986,8 @@ static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s,
|
||||
|
||||
output_alpha = foreground_alpha + FAST_DIV255((255 - foreground_alpha) * background_alpha);
|
||||
|
||||
av_assert0(s->bpp <= 10);
|
||||
|
||||
for (b = 0; b < s->bpp - 1; ++b) {
|
||||
if (output_alpha == 0) {
|
||||
output[b] = 0;
|
||||
|
||||
@@ -193,6 +193,12 @@ int ff_slice_thread_init(AVCodecContext *avctx)
|
||||
w32thread_init();
|
||||
#endif
|
||||
|
||||
// We cannot do this in the encoder init as the threads are created before
|
||||
if (av_codec_is_encoder(avctx->codec) &&
|
||||
avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO &&
|
||||
avctx->height > 2800)
|
||||
thread_count = avctx->thread_count = 1;
|
||||
|
||||
if (!thread_count) {
|
||||
int nb_cpus = av_cpu_count();
|
||||
if (avctx->height)
|
||||
|
||||
+15
-7
@@ -105,7 +105,7 @@ static inline void flush_put_bits(PutBitContext *s)
|
||||
s->bit_buf <<= s->bit_left;
|
||||
#endif
|
||||
while (s->bit_left < 32) {
|
||||
/* XXX: should test end of buffer */
|
||||
av_assert0(s->buf_ptr < s->buf_end);
|
||||
#ifdef BITSTREAM_WRITER_LE
|
||||
*s->buf_ptr++ = s->bit_buf;
|
||||
s->bit_buf >>= 8;
|
||||
@@ -163,9 +163,13 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
|
||||
#ifdef BITSTREAM_WRITER_LE
|
||||
bit_buf |= value << (32 - bit_left);
|
||||
if (n >= bit_left) {
|
||||
av_assert2(s->buf_ptr+3<s->buf_end);
|
||||
AV_WL32(s->buf_ptr, bit_buf);
|
||||
s->buf_ptr += 4;
|
||||
if (3 < s->buf_end - s->buf_ptr) {
|
||||
AV_WL32(s->buf_ptr, bit_buf);
|
||||
s->buf_ptr += 4;
|
||||
} else {
|
||||
av_log(NULL, AV_LOG_ERROR, "Internal error, put_bits buffer too small\n");
|
||||
av_assert2(0);
|
||||
}
|
||||
bit_buf = value >> bit_left;
|
||||
bit_left += 32;
|
||||
}
|
||||
@@ -177,9 +181,13 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
|
||||
} else {
|
||||
bit_buf <<= bit_left;
|
||||
bit_buf |= value >> (n - bit_left);
|
||||
av_assert2(s->buf_ptr+3<s->buf_end);
|
||||
AV_WB32(s->buf_ptr, bit_buf);
|
||||
s->buf_ptr += 4;
|
||||
if (3 < s->buf_end - s->buf_ptr) {
|
||||
AV_WB32(s->buf_ptr, bit_buf);
|
||||
s->buf_ptr += 4;
|
||||
} else {
|
||||
av_log(NULL, AV_LOG_ERROR, "Internal error, put_bits buffer too small\n");
|
||||
av_assert2(0);
|
||||
}
|
||||
bit_left += 32 - n;
|
||||
bit_buf = value;
|
||||
}
|
||||
|
||||
+1
-1
@@ -258,7 +258,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
buf += buf_size - context->frame_size;
|
||||
|
||||
len = context->frame_size - (avctx->pix_fmt==AV_PIX_FMT_PAL8 ? AVPALETTE_SIZE : 0);
|
||||
if (buf_size < len && (avctx->codec_tag & 0xFFFFFF) != MKTAG('B','I','T', 0)) {
|
||||
if (buf_size < len && ((avctx->codec_tag & 0xFFFFFF) != MKTAG('B','I','T', 0) || !need_copy)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid buffer size, packet size %d < expected frame_size %d\n", buf_size, len);
|
||||
av_buffer_unref(&frame->buf[0]);
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
@@ -290,12 +290,6 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
|
||||
short *output_bak = NULL;
|
||||
int lenout;
|
||||
|
||||
if (s->input_channels == s->output_channels && s->ratio == 1.0 && 0) {
|
||||
/* nothing to do */
|
||||
memcpy(output, input, nb_samples * s->input_channels * sizeof(short));
|
||||
return nb_samples;
|
||||
}
|
||||
|
||||
if (s->sample_fmt[0] != AV_SAMPLE_FMT_S16) {
|
||||
int istride[1] = { s->sample_size[0] };
|
||||
int ostride[1] = { 2 };
|
||||
|
||||
@@ -668,6 +668,10 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
/* get output buffer */
|
||||
frame->nb_samples = unp_size / (avctx->channels * (bits + 1));
|
||||
if (unp_size % (avctx->channels * (bits + 1))) {
|
||||
av_log(avctx, AV_LOG_ERROR, "unp_size %d is odd\n", unp_size);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
return ret;
|
||||
samples = (int16_t *)frame->data[0];
|
||||
|
||||
@@ -563,6 +563,8 @@ static inline int get_symbol(RangeCoder *c, uint8_t *state, int is_signed){
|
||||
e= 0;
|
||||
while(get_rac(c, state+1 + FFMIN(e,9))){ //1..10
|
||||
e++;
|
||||
if (e > 31)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
a= 1;
|
||||
|
||||
@@ -284,7 +284,7 @@ static int encode_q_branch(SnowContext *s, int level, int x, int y){
|
||||
c->penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_cmp);
|
||||
c->sub_penalty_factor= get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_sub_cmp);
|
||||
c->mb_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->mb_cmp);
|
||||
c->current_mv_penalty= c->mv_penalty[s->m.f_code=1] + MAX_MV;
|
||||
c->current_mv_penalty= c->mv_penalty[s->m.f_code=1] + MAX_DMV;
|
||||
|
||||
c->xmin = - x*block_w - 16+3;
|
||||
c->ymin = - y*block_w - 16+3;
|
||||
|
||||
@@ -925,6 +925,13 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
|
||||
s->frame_size = s->channels*s->block_align*s->downsampling;
|
||||
// avctx->frame_size = s->block_align;
|
||||
|
||||
if (s->num_taps * s->channels > s->frame_size) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"number of taps times channels (%d * %d) larger than frame size %d\n",
|
||||
s->num_taps, s->channels, s->frame_size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d.%d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n",
|
||||
s->version, s->minor_version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user