Compare commits

..

6 Commits

Author SHA1 Message Date
Michael Niedermayer 47e784f881 Bump versions after 6.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-29 16:19:14 +01:00
Michael Niedermayer 0e15b2b828 doc/APIchanges: Add 6.1 cut point
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-29 16:19:14 +01:00
Michael Niedermayer 9d3a7d30c4 Bump versions prior to 6.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-29 15:34:05 +01:00
Zhao Zhili 105657540b avutil/hwcontext_vaapi: return ENOSYS for unsupported operation
av_hwframe_transfer_data try with src_ctx first. If the operation
failed with AVERROR(ENOSYS), it will try again with dst_ctx. Return
AVERROR(EINVAL) makes the second step being skipped.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-10-29 13:58:52 +08:00
Zhao Zhili 63078b4599 avutil/hwcontext_vulkan: cuda doesn't belong to valid_sw_formats
Move it to transfer_get_formats.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-10-29 13:58:30 +08:00
Zhao Zhili 891f70c6d5 avutil/hwcontext_vulkan: fix memleak when device_create is skipped
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-10-29 13:57:43 +08:00
291 changed files with 1007 additions and 2312 deletions
+1 -377
View File
@@ -1,383 +1,7 @@
Entries are sorted chronologically from oldest to youngest within each release,
releases are sorted from youngest to oldest.
version 6.1.2
avcodec/snow: Fix off by 1 error in run_buffer
avcodec/utils: apply the same alignment to YUV410 as we do to YUV420 for snow
swscale: [loongarch] Fix checkasm-sw_yuv2rgb failure.
avcodec/pngenc: fix sBIT writing for indexed-color PNGs
avcodec/pngdec: use 8-bit sBIT cap for indexed PNGs per spec
avcodec/videotoolboxenc: Fix bitrate doesn't work as expected
Changelog: update
avdevice/dshow: Don't skip audio devices if no video device is present
avcodec/hdrenc: Allocate more space
avcodec/cfhdenc: Height of 16 is not supported
avcodec/cfhdenc: Allocate more space
avcodec/osq: fix integer overflow when applying factor
avcodec/osq: avoid using too large numbers for shifts and integers in update_residue_parameter()
avcodec/vaapi_encode: Check hwctx
avcodec/proresdec: Consider negative bits left
avcodec/alsdec: Clear shift_value
avcodec/hevc/hevcdec: Do not allow slices to depend on failed slices
avfilter/vf_xfade: Check ff_inlink_consume_frame() for failure
avutil/slicethread: Check pthread_*_init() for failure
avutil/frame: Check log2_crop_align
avutil/buffer: Check ff_mutex_init() for failure
avformat/xmv: Check this_packet_size
avformat/ty: rec_size seems to only need 32bit
avformat/tty: Check avio_size()
avformat/siff: Basic pkt_size check
avformat/sauce: Check avio_size() for failure
avformat/sapdec: Check ffurl_get_file_handle() for error
avformat/nsvdec: Check asize for PCM
avformat/mp3dec: Check header_filesize
avformat/mp3dec; Check for avio_size() failure
avformat/mov: Use 64bit for str_size
avformat/mm: Check length
avformat/hnm: Check *chunk_size
avformat/hlsenc: Check ret
avformat/bintext: Check avio_size() return
avformat/asfdec_o: Check size of index object
avfilter/vf_scale: Check ff_scale_adjust_dimensions() for failure
avfilter/scale_eval: Use 64bit, check values in ff_scale_adjust_dimensions()
avfilter/vf_lut3d: Check av_scanf()
avfilter/vf_elbg: Use unsigned for shifting into the top bit
avfilter/vf_deshake_opencl: Ensure that the first iteration initializes the best variables
swscale/output: Fix integer overflows in yuv2rgba64_X_c_template
avformat/mxfdec: Reorder elements of expression in bisect loop
avutil/timecode: Use a 64bit framenum internally
avcodec/pnmdec: Use 64bit for input size check
avcodec/mpeg12enc: Use av_rescale() in vbv_buffer_size computation
avcodec/utvideoenc: Use unsigned shift to build flags
avcodec/j2kenc: Merge dwt_norm into lambda
avcodec/vc2enc: Fix overflows with storing large values
avcodec/mpegvideo_enc: Do not duplicate pictures on shifting
avdevice/dshow_capture: Fix error handling in ff_dshow_##prefix##_Create()
avcodec/tiff: Check value on positive signed targets
avfilter/vf_convolution_opencl: Assert that the filter name is one of the filters
avfilter/vf_bm3d: Dont round MSE2SSE to an integer
avdevice/dshow: Remove NULL check on pin
avdevice/dshow: check ff_dshow_pin_ConnectionMediaType() for failure
avdevice/dshow: Check device_filter_unique_name before use
avdevice/dshow: Cleanup also on av_log case
avdevice/dshow_filter: Use wcscpy_s()
avcodec/flac_parser: Assert that we do not overrun the link_penalty array
avcodec/osq: avoid signed overflow in downsample path
avcodec/pixlet: Simplify pfx computation
avcodec/motion_est: Fix score squaring overflow
avcodec/mlpenc: Use 64 for ml, mr
avcodec/loco: Check loco_get_rice() for failure
avcodec/loco: check get_ur_golomb_jpegls() for failure
avcodec/imm4: check cbphi for error
avcodec/iff: Use signed count
avcodec/golomb: Assert that k is in the supported range for get_ur/sr_golomb()
avcodec/golomb: Document return for get_ur_golomb_jpegls() and get_sr_golomb_flac()
avcodec/dxv: Fix type in get_opcodes()
avcodec/cri: Check length
avcodec/xsubdec: Check parse_timecode()
avutil/imgutils: av_image_check_size2() ensure width and height fit in 32bit
doc/examples/mux: remove nop
avcodec/proresenc_kostya: use unsigned alpha for rotation
avformat/rtpenc_rfc4175: Use 64bit in computation if copy_offset
avformat/rtmppkt: Simplify and deobfuscate amf_tag_skip() slightly
avformat/rmdec: use 64bit for audio_framesize checks
avutil/wchar_filename: Correct sizeof
avutil/hwcontext_d3d11va: correct sizeof IDirect3DSurface9
avutil/hwcontext_d3d11va: Free AVD3D11FrameDescriptor on error
avutil/hwcontext_d3d11va: correct sizeof AVD3D11FrameDescriptor
doc/examples/vaapi_encode: Try to check fwrite() for failure
avformat/usmdec: Initialize value
avformat/tls_schannel: Initialize ret
avformat/subfile: Assert that whence is a known case
avformat/subfile: Merge if into switch()
avformat/rtsp: Check that lower transport is handled in one of the if()
avformat/rtsp: initialize reply1
avformat/rtsp: use < 0 for error check
avformat/rtpenc_vc2hq: Check sizes
avfilter/af_aderivative: Free out on error
swscale/swscale: Use ptrdiff_t for linesize computations
avfilter/af_afir: Assert format
avfilter/af_afftdn: Assert format
avfilter/af_pan: check nb_output_channels before use
cbs_av1: Reject thirty-two zero bits in uvlc code
avfilter/af_mcompand: compute half frequency in double
avfilter/af_channelsplit: Assert that av_channel_layout_channel_from_index() succeeds
avfilter/af_aresample: Cleanup on av_channel_layout_copy() failure
tools/coverity: Phase 1 study of anti-halicogenic for coverity av_rescale()
avfilter/vf_avgblur: Check plane instead of AVFrame
avfilter/drawutils: Fix depthb computation
avfilter/avf_showcwt: Check av_parse_video_rate() for failure
avformat/rdt: Check pkt_len
avformat/mpeg: Check len in mpegps_probe()
avformat/mxfenc: resurrects the error print
avdevice/dshow: Check ICaptureGraphBuilder2_SetFiltergraph() for failure
avcodec/mfenc: check IMFSample_ConvertToContiguousBuffer() for failure
avcodec/vc1_loopfilter: Factor duplicate code in vc1_b_h_intfi_loop_filter()
avformat/img2dec: assert no pipe on ts_from_file
avcodec/cbs_jpeg: Try to move the read entity to one side in a test
fftools/ffmpeg_enc: Initialize fd
fftools/ffmpeg_enc: simplify opaque_ref check
avformat/mov: Check edit list for overflow
fftools/ffmpeg: Check read() for failure
MAINTAINERS: Add Timo Rothenpieler to server admins
swscale/output: Avoid undefined overflow in yuv2rgb_write_full()
swscale/output: alpha can become negative after scaling, use multiply
avcodec/targaenc: Allocate space for the palette
avcodec/r210enc: Use av_rescale for bitrate
avcodec/jfdctint_template: Fewer integer anomalies
avcodec/snowenc: MV limits due to mv_penalty table size
tools/target_dec_fuzzer: Adjust threshold for MV30
tools/target_dec_fuzzer: Adjust threshold for jpeg2000
avformat/mxfdec: Check container_ul->desc before use
avcodec/libvpxenc: Cleanup on error
MAINTAINERS: Update the entries for the release maintainer for FFmpeg
configure: update copyright year
doc/developer: Provide information about git send-email and gmail
avfilter/vf_rotate: Check ff_draw_init2() return value
avformat/mov: Use int64_t in intermediate for corrected_dts
avformat/mov: Use 64bit in intermediate for current_dts
avformat/matroskadec: Assert that num_levels is non negative
avformat/libzmq: Check av_strstart()
avformat/img2dec: Little JFIF / Exif cleanup
avformat/img2dec: Move DQT after unrelated if()
avformat/imfdec: Simplify get_next_track_with_minimum_timestamp()
avdevice/xcbgrab: Check sscanf() return
fftools/cmdutils: Add protective () to FLAGS
avformat/sdp: Check before appending ","
avcodec/ilbcdec: Remove dead code
avcodec/vp8: Check cond init
avcodec/vp8: Check mutex init
avcodec/proresenc_anatoliy: Assert that AV_PROFILE_UNKNOWN is replaced
avcodec/pcm-dvdenc: 64bit pkt-size
avcodec/notchlc: Check init_get_bits8() for failure
avcodec/tests/dct: Use 64bit in intermediate for error computation
avcodec/scpr3: Check add_dec() for failure
avcodec/rv34: assert that size is not 0 in rv34_gen_vlc_ext()
avcodec/wavpackenc: Use unsigned for potential 31bit shift
avcodec/tests/jpeg2000dwt: Use 64bit in comparission
avcodec/tests/jpeg2000dwt: Use 64bit in err2 computation
avformat/fwse: Remove always false expression
avcodec/sga: Make it clear that the return is intentionally not checked
avformat/asfdec_f: Use 64bit for preroll computation
avformat/argo_asf: Use 64bit in offset intermediate
avformat/ape: Use 64bit for final frame size
avformat/ac4dec: Check remaining space in ac4_probe()
avdevice/pulse_audio_enc: Use av_rescale() to avoid integer overflow
avcodec/vlc: Cleanup on multi table alloc failure in ff_vlc_init_multi_from_lengths()
avcodec/tiff: Assert init_get_bits8() success in unpack_gray()
avcodec/tiff: Assert init_get_bits8() success in horizontal_fill()
tools/decode_simple: Check avcodec_send_packet() for errors on flushing
swscale/yuv2rgb: Use 64bit for brightness computation
swscale/x86/swscale: use a clearer name for INPUT_PLANER_RGB_A_FUNC_CASE
avutil/tests/opt: Check av_set_options_string() for failure
avutil/tests/dict: Check av_dict_set() before get for failure
avdevice/dshow: fix badly indented line
avformat/demux: resurrect dead stores
avcodec/tests/bitstream_template: Assert bits_init8() return
tools/enc_recon_frame_test: Assert that av_image_get_linesize() succeeds
fftools/ffmpeg: prefer real errors over EOF in err_merge()
avcodec/png: more informative error message for invalid sBIT size
avcodec/pngdec: avoid erroring with sBIT on indexed-color images
avcodec/nvenc: fix segfault in intra-only mode
aarch64: Add OpenBSD runtime detection of dotprod and i8mm using sysctl
qsv: Initialize impl_value
avutil/hwcontext_qsv: fix GCC 14.1 warnings
lavc/vp9: reset segmentation fields when segmentation isn't enabled
configure: enable ffnvcodec, nvenc, nvdec for FreeBSD
avcodec/mscc & mwsc: Check loop counts before use
avcodec/mpegvideo_enc: Fix potential overflow in RD
avcodec/mpeg4videodec: assert impossible wrap points
avcodec/mpeg12dec: Use 64bit in bit computation
avcodec/vqcdec: Check init_get_bits8() for failure
avcodec/vble: Check av_image_get_buffer_size() for failure
avcodec/vp3: Replace check by assert
avcodec/vp8: Forward return of ff_vpx_init_range_decoder()
avcodec/jpeg2000dec: remove ST=3 case
avcodec/qsvdec: Check av_image_get_buffer_size() for failure
avcodec/exr: Fix preview overflow
avcodec/decode: decode_simple_internal() only implements audio and video
avcodec/fmvc: remove dead assignment
avcodec/h2645_sei: Remove dead checks
avcodec/h264_slice: Remove dead sps check
avcodec/lpc: copy levenson coeffs only when they have been computed
avutil/tests/base64: Check with too short output array
libavutil/base64: Try not to write over the array end
avcodec/cbs_av1: Avoid shift overflow
fftools/ffplay: Check return of swr_alloc_set_opts2()
tools/opt_common: Check for malloc failure
doc/examples/demux_decode: Simplify loop
avformat/concatdec: Check file
avcodec/mpegvideo_enc: Fix 1 line and one column images
avcodec/amrwbdec: assert mode to be valid in decode_fixed_vector()
avcodec/wavarc: fix integer overflow in decode_5elp() block type 2
swscale/output: Fix integer overflow in yuv2rgba64_full_1_c_template()
swscale/output: Fix integer overflow in yuv2rgba64_1_c_template
avcodec/av1dec: Change bit_depth to int
avcodec/av1dec: bit_depth cannot be another values than 8,10,12
avcodec/avs3_parser: assert the return value of init_get_bits()
avcodec/avs2_parser: Assert init_get_bits8() success with const size 15
avformat/mxfdec: Check body_offset
avformat/kvag: Check sample_rate
avcodec/atrac9dec: Check init_get_bits8() for failure
avcodec/ac3_parser: Check init_get_bits8() for failure
avcodec/pngdec: Check last AVFrame before deref
avcodec/hevcdec: Check ref frame
doc/examples/qsv_transcode: Initialize pointer before free
doc/examples/qsv_transcode: Simplify str_to_dict() loop
doc/examples/vaapi_transcode: Simplify loop
doc/examples/qsv_transcode: Simplify loop
avcodec/cbs_h2645: Check NAL space
avfilter/vf_thumbnail_cuda: Set ret before checking it
avfilter/signature_lookup: Dont copy uninitialized stuff around
avfilter/signature_lookup: Fix 2 differences to the refernce SW
avcodec/x86/vp3dsp_init: Set correct function pointer, fix crash
avformat/mp3dec: change bogus error message if read_header encounters EOF
avformat/mp3dec: simplify inner frame size check in mp3_read_header
avformat/mp3dec: only call ffio_ensure_seekback once
avutil/thread: fix pthread_setname_np parameters for NetBSD and Apple
avutil/thread: add support for setting thread name on *bsd and solaris
avutil/ppc/cpu: Also use the machdep.altivec sysctl on NetBSD
lavd/v4l2: Use proper field type for second parameter of ioctl() with BSD's
avfilter/avfilter: fix OOM case for default activate
avfilter/buffersrc: switch to activate
avcodec/mediacodecenc: set quality in cq mode
Update for 6.1.2
fate/subtitles: Ignore line endings for sub-scc test
avformat/mxfdec: Check index_edit_rate
swscale/utils: Fix xInc overflow
avcodec/wavarc: fix signed integer overflow in block type 6/19
doc/developer: (security) researchers should be credited
avformat/isom: Uninit layout in ff_mp4_read_dec_config_descr()
avcodec/exr: Dont use 64bits to hold 6bits
avcodec/exr: Check for remaining bits in huf_unpack_enc_table()
avcodec/apedec: Use NABS to avoid undefined negation
avformat/mpegts: Reset local nb_prg on add_program() failure
avformat/aiffdec: Check for previously set channels
avformat/mxfdec: Make edit_unit_byte_count unsigned
avformat/movenc: Check that cts fits in 32bit
avformat/mxfdec: Check first case of offset_temp computation for overflow
avcodec/jpeg2000htdec: warn about non zero roi shift
avcodec/jpeg2000htdec: Check magp before using it in a shift
avfilter/vf_signature: Dont crash on no frames
avformat/westwood_vqa: Fix 2g packets
avformat/matroskadec: Check timescale
avformat/wavdec: satuarte next_tag_ofs, data_end
avformat/wavdec: sanity check channels and bps before using them for block_align
avformat/sbgdec: Check for negative duration
avformat/rpl: Use 64bit for total_audio_size and check it
avformat/timecode: use 64bit for intermediate for rounding in fps_from_frame_rate()
avformat/mov: use 64bit for intermediate for rounding
avformat/jacosubdec: Use 64bit for abs
avformat/concatdec: Check user_duration sum
avcodec/wavarc: avoid signed integer overflow in AC code
avcodec/wavarc: Avoid signed integer overflow in sample
avcodec/truemotion1: Height not being a multiple of 4 is unsupported
avcodec/rtv1: fix undefined FFALIGN
avcodec/hcadec: do not allow code to continue after failed init
avcodec/hcadec: do not set hfr_group_count to invalid values
avformat/concatdec: clip outpoint - inpoint overflow in get_best_effort_duration()
avcodec/osq: avoid several signed integer overflows
avformat/jacosubdec: clarify code
avformat/cafdec: Check that data chunk end fits within 64bit
avformat/iff: Saturate avio_tell() + 12
avformat/dxa: Adjust order of operations around block align
avformat/cafdec: dont seek beyond 64bit
avformat/id3v2: read_uslt() check for the amount read
avcodec/vmixdec: Check shift before use
avformat/mov: Check sample_count and auxiliary_info_default_size to be 0
avformat/wady: Check >0 samplerate and channels 1 || 2.
avcodec/cbs_h266_syntax_template: Check tile_y
avcodec/proresenc_kostya: Remove bug similarity text
avcodec/vorbisdec: Check remaining data in vorbis_residue_decode_internal()
avformat/concatdec: Check in and outpoints to be to produce a positive representable duration
avcodec/8bps: Consider width in the minimal size check
libswscale/utils: Fix bayer to yuvj
swscale/swscale: Check srcSliceH for bayer
swscale/utils: Allocate more dithererror
avcodec/indeo3: Round dimensions up in allocate_frame_buffers()
avutil/rational: Document what is to be expected from av_d2q() of doubles representing rational numbers
avfilter/signature_lookup: Do not dereference NULL pointers after malloc failure
avfilter/signature_lookup: dont leave uncleared pointers in sll_free()
avcodec/mpegvideo_enc: Use ptrdiff_t for stride
libavformat/hlsenc.c: Populate OTI using AAC profile in write_codec_attr.
avformat/mov: Check if a key is longer than the atom containing it
avcodec/nvenc: support SDK 12.2 bit depth API
avcodec/nvenc: stop using long deprecated format specifiers
avfilter/buffersrc: fix overriding unknown channel layouts with negotiated one
avfilter/af_channelmap: disallow channel index 64
avfilter/af_channelmap: fix mapping if in_channel was a string but out_channel was not specified
avfilter/af_channelmap: fix error message if FL source channel was missing
avcodec/nvdec: reset bitstream_len/nb_slices when resetting bitstream pointer
avformat/mov: don't abort on duplicate Mastering Display Metadata boxes
fftools/ffplay: use correct buffersink channel layout parameters
avformat/mpegts: detect synchronous metadata KLV more reliably
swresample/resample: fix rounding errors with filter_size=1 and phase_shift=0
avformat/mxfdec: remove resolve_strong_ref usage with AnyType
avfilter/vf_convolution: add float user_rdiv[4] to allow user options to apply correctly
avformat/libsrt: use SRT_EPOLL_IN for waiting for an incoming connection
avformat/mxfdec: do not use AnyType when resolving Descriptors and MultipleDescriptors
avformat/mxfdec: move resolving Descriptors to the multi descriptor resolve function
avutil/hwcontext_d3d11va: prefer DXGI 1.1 factory when available
avcodec/libsvtav1: send the EOS signal without a one frame delay to allow for the library to operate in a low-delay mode
avcodec/libsvtav1: add version guard for external param
lavc/vvc: Read subpic ID when only one subpicture is present
lavc/vvc: Correct sps_num_subpics_minus1 minimum
avcodec/cbs_h2645: Avoid function pointer casts, fix UB
avcodec/cbs_h266_syntax_template: Don't omit unused function parameter
avcodec/cbs_h266_syntax_template: check aps_adaptation_parameter_set_id
lavc/vvc: Add check to num_multi_layer_olss
avcodec/cbs_h266: fix logic setting num_layers_in_ols when vps_ols_mode_idc is 2
avcodec/av1dec: fix matrix coefficients exposed by codec context
{avcodec,tests}: rename the bundled Mesa AV1 vulkan video headers
avformat/mov_chan: never override number of channels based on chan atom
avformat/mov_chan: do not assume channels are in native order
avfft: avoid overreads with RDFT API users
avcodec/nvdec: don't free NVDECContext->bitstream
avcodec/mediacodecdec: fix return EAGAIN after EOF
version 6.1.1
- avcodec/mpegvideo_enc: Dont copy beyond the image
- avfilter/vf_minterpolate: Check pts before division
- avfilter/avf_showwaves: Check history_nb_samples
- avformat/flacdec: Avoid double AVERRORS
- avfilter/vf_vidstabdetect: Avoid double AVERRORS
- avcodec/vaapi_encode: Avoid double AVERRORS
- avfilter/vf_swaprect: round coordinates down
- avfilter/vf_swaprect: Use height for vertical variables
- avfilter/vf_swaprect: assert that rectangles are within memory
- avfilter/af_alimiter: Check nextpos before use
- avfilter/f_reverse: Apply PTS compensation only when pts is available
- avfilter/af_stereowiden: Check length
- avformat/mov: Fix MSAN issue with stsd_id
- avcodec/jpegxl_parser: Check get_vlc2()
- avfilter/vf_weave: Fix odd height handling
- avfilter/edge_template: Fix small inputs with gaussian_blur()
- avfilter/vf_gradfun: Do not overread last line
- avfilter/avf_showspectrum: fix off by 1 error
- avcodec/jpegxl_parser: Add padding to cs_buffer
- avformat/mov: do not set sign bit for chunk_offsets
- avcodec/jpeglsdec: Check Jpeg-LS LSE
- avcodec/osq: Implement flush()
- configure: Enable section_data_rel_ro for FreeBSD and NetBSD aarch64 / arm
- avcodec/cbs_h266: more restrictive check on pps_tile_idx_delta_val
- avcodec/jpeg2000htdec: check if block decoding will exceed internal precision
- tools/target_dec_fuzzer: Adjust threshold for VMIX
- avcodec/av1dec: Fix resolving zero divisor
- avformat/mov: Ignore duplicate ftyp
- avformat/mov: Fix integer overflow in mov_read_packet().
- lavc/qsvdec: return 0 if more data is required
- avcodec/jpegxl_parser: check ANS cluster alphabet size vs bundle size
- libavformat/vvc: Make probe more conservative
- hwcontext_vulkan: guard unistd.h include
- lavc/Makefile: build vulkan decode code if vulkan_av1 has been enabled
- lavc/dvdsubenc: only check canvas size when it is actually set
- avcodec/decode: validate hw_frames_ctx when AVHWAccel.free_frame_priv is used
- avcoded/fft: Fix memory leak if ctx2 is used
- avcodec/fft: Use av_mallocz to avoid invalid free/uninit
version 6.1:
version <next>:
- libaribcaption decoder
- Playdate video decoder and demuxer
- Extend VAAPI support for libva-win32 on Windows
+5 -7
View File
@@ -34,8 +34,8 @@ Miscellaneous Areas
===================
documentation Stefano Sabatini, Mike Melanson, Timothy Gu, Gyan Doshi
project server day to day operations Árpád Gereöffy, Michael Niedermayer, Reimar Doeffinger, Alexander Strasser, Nikolay Aleksandrov, Timo Rothenpieler
project server emergencies Árpád Gereöffy, Reimar Doeffinger, Alexander Strasser, Nikolay Aleksandrov, Timo Rothenpieler
project server day to day operations Árpád Gereöffy, Michael Niedermayer, Reimar Doeffinger, Alexander Strasser, Nikolay Aleksandrov
project server emergencies Árpád Gereöffy, Reimar Doeffinger, Alexander Strasser, Nikolay Aleksandrov
presets Robert Swain
metadata subsystem Aurelien Jacobs
release management Michael Niedermayer
@@ -588,12 +588,10 @@ wm4
Releases
========
7.0 Michael Niedermayer
6.1 Michael Niedermayer
5.1 Michael Niedermayer
4.4 Michael Niedermayer
3.4 Michael Niedermayer
2.8 Michael Niedermayer
2.7 Michael Niedermayer
2.6 Michael Niedermayer
2.5 Michael Niedermayer
If you want to maintain an older release, please contact us
+1 -1
View File
@@ -1 +1 @@
6.1.2
5.1.git
-15
View File
@@ -1,15 +0,0 @@
┌──────────────────────────────────────────┐
│ RELEASE NOTES for FFmpeg 6.1 "Heaviside" │
└──────────────────────────────────────────┘
The FFmpeg Project proudly presents FFmpeg 6.1 "Heaviside", about 8
months after the release of FFmpeg 6.0.
A complete Changelog is available at the root of the project, and the
complete Git history on https://git.ffmpeg.org/gitweb/ffmpeg.git
We hope you will like this release as much as we enjoyed working on it, and
as usual, if you have any questions about it, or any FFmpeg related topic,
feel free to join us on the #ffmpeg IRC channel (on irc.libera.chat) or ask
on the mailing-lists.
Vendored
+3 -15
View File
@@ -2227,7 +2227,6 @@ HEADERS_LIST="
opencv2_core_core_c_h
OpenGL_gl3_h
poll_h
pthread_np_h
sys_param_h
sys_resource_h
sys_select_h
@@ -2330,8 +2329,6 @@ SYSTEM_FUNCS="
posix_memalign
prctl
pthread_cancel
pthread_set_name_np
pthread_setname_np
sched_getaffinity
SecItemImport
SetConsoleTextAttribute
@@ -5588,7 +5585,6 @@ case $target_os in
;;
netbsd)
disable symver
enable section_data_rel_ro
oss_indev_extralibs="-lossaudio"
oss_outdev_extralibs="-lossaudio"
enabled gcc || check_ldflags -Wl,-zmuldefs
@@ -5607,7 +5603,6 @@ case $target_os in
disable symver
;;
freebsd)
enable section_data_rel_ro
;;
bsd/os)
add_extralibs -lpoll -lgnugetopt
@@ -6463,7 +6458,6 @@ check_headers malloc.h
check_headers mftransform.h
check_headers net/udplite.h
check_headers poll.h
check_headers pthread_np.h
check_headers sys/param.h
check_headers sys/resource.h
check_headers sys/select.h
@@ -6629,12 +6623,6 @@ if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
if enabled pthreads; then
check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs
check_func pthread_cancel $pthreads_extralibs
hdrs=pthread.h
if enabled pthread_np_h; then
hdrs="$hdrs pthread_np.h"
fi
check_lib pthread_set_name_np "$hdrs" pthread_set_name_np -lpthread
check_lib pthread_setname_np "$hdrs" pthread_setname_np -lpthread
fi
fi
@@ -6689,7 +6677,7 @@ enabled libaom && require_pkg_config libaom "aom >= 1.0.0" aom/aom_co
enabled libaribb24 && { check_pkg_config libaribb24 "aribb24 > 1.0.3" "aribb24/aribb24.h" arib_instance_new ||
{ enabled gpl && require_pkg_config libaribb24 aribb24 "aribb24/aribb24.h" arib_instance_new; } ||
die "ERROR: libaribb24 requires version higher than 1.0.3 or --enable-gpl."; }
enabled libaribcaption && require_pkg_config libaribcaption "libaribcaption >= 1.1.1" "aribcaption/aribcaption.h" aribcc_context_alloc
enabled libaribcaption && require_pkg_config libaribcaption "libaribcaption >= 0.1.0" "aribcaption/aribcaption.h" aribcc_context_alloc
enabled lv2 && require_pkg_config lv2 lilv-0 "lilv/lilv.h" lilv_world_new
enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
enabled libass && require_pkg_config libass "libass >= 0.11.0" ass/ass.h ass_library_init
@@ -7170,7 +7158,7 @@ fi
if enabled x86; then
case $target_os in
freebsd|mingw32*|mingw64*|win32|win64|linux|cygwin*)
mingw32*|mingw64*|win32|win64|linux|cygwin*)
;;
*)
disable ffnvcodec cuvid nvdec nvenc
@@ -7996,7 +7984,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 2024
#define CONFIG_THIS_YEAR 2023
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
+45 -45
View File
@@ -4,174 +4,174 @@ API changes, most recent first:
-------- 8< --------- FFmpeg 6.1 was cut here -------- 8< ---------
2023-10-27 - 52a97642604 - lavu 58.28.100 - channel_layout.h
2023-10-27 - xxxxxxxxxx - lavu 58.28.100 - channel_layout.h
Add AV_CH_LAYOUT_3POINT1POINT2 and AV_CHANNEL_LAYOUT_3POINT1POINT2.
Add AV_CH_LAYOUT_5POINT1POINT2_BACK and AV_CHANNEL_LAYOUT_5POINT1POINT2_BACK.
Add AV_CH_LAYOUT_5POINT1POINT4_BACK and AV_CHANNEL_LAYOUT_5POINT1POINT4_BACK.
Add AV_CH_LAYOUT_7POINT1POINT2 and AV_CHANNEL_LAYOUT_7POINT1POINT2.
Add AV_CH_LAYOUT_7POINT1POINT4_BACK and AV_CHANNEL_LAYOUT_7POINT1POINT4_BACK.
2023-10-06 - 804be7f9e3c - lavc 60.30.101 - avcodec.h
2023-10-06 - xxxxxxxxxx - lavc 60.30.101 - avcodec.h
AVCodecContext.coded_side_data may now be used during decoding, to be set
by user before calling avcodec_open2() for initialization.
2023-10-06 - 5432d2aacad - lavc 60.15.100 - avformat.h
2023-10-06 - xxxxxxxxxx - lavc 60.15.100 - avformat.h
Deprecate AVFormatContext.{nb_,}side_data, av_stream_add_side_data(),
av_stream_new_side_data(), and av_stream_get_side_data(). Side data fields
from AVFormatContext.codecpar should be used from now on.
2023-10-06 - 21d7cc6fa9a - lavc 60.30.100 - codec_par.h
2023-10-06 - xxxxxxxxxx - lavc 60.30.100 - codec_par.h
Added {nb_,}coded_side_data to AVCodecParameters.
The AVCodecParameters helpers will copy it to and from its AVCodecContext
namesake.
2023-10-06 - 74279227dd2 - lavc 60.29.100 - packet.h
2023-10-06 - xxxxxxxxxx - lavc 60.29.100 - packet.h
Added av_packet_side_data_new(), av_packet_side_data_add(),
av_packet_side_data_get(), av_packet_side_data_remove, and
av_packet_side_data_free().
2023-10-03 - ea14e8bc302 - lavc 60.28.100 - codec_par.h defs.h
2023-10-03 - xxxxxxxxxx - lavc 60.28.100 - codec_par.h defs.h
Move the definition of enum AVFieldOrder from codec_par.h to defs.h.
2023-10-03 - dd48e49d547 - lavf 60.14.100 - avformat.h
2023-10-03 - xxxxxxxxxx - lavf 60.14.100 - avformat.h
Deprecate AVFMT_ALLOW_FLUSH without replacement. Users can always
flush any muxer by sending a NULL packet.
2023-09-28 - 8e1ef7c38f6 - lavu 58.27.100 - pixfmt.h
2023-09-28 - xxxxxxxxxx - lavu 58.27.100 - pixfmt.h
Add AV_PIX_FMT_GBRAP14BE, AV_PIX_FMT_GBRAP14LE pixel formats.
2023-09-28 - 05f8b2ca0f7 - lavu 58.26.100 - hwcontext_cuda.h
2023-09-28 - xxxxxxxxxx - lavu 58.26.100 - hwcontext_cuda.h
Add AV_CUDA_USE_CURRENT_CONTEXT.
2023-09-19 - ba9cd06c763 - lavu 58.25.100 - avutil.h
2023-09-19 - xxxxxxxxxx - lavu 58.25.100 - avutil.h
Make AV_TIME_BASE_Q compatible with C++.
2023-09-18 - 85e075587dc - lavf 60 - avformat.h
2023-09-xx - xxxxxxxxxx - lavf 60 - avformat.h
Deprecate AVFMT_FLAG_SHORTEST without replacement.
2023-09-07 - 423b6a7e493 - lavu 58.24.100 - imgutils.h
2023-09-07 - xxxxxxxxxx - lavu 58.24.100 - imgutils.h
Add av_image_copy2(), a wrapper around the av_image_copy()
to overcome limitations of automatic conversions.
2023-09-07 - 5094d1f429e - lavu 58.23.100 - fifo.h
2023-09-07 - xxxxxxxxxx - lavu 58.23.100 - fifo.h
Constify the AVFifo pointees in av_fifo_peek() and av_fifo_peek_to_cb().
2023-09-07 - fa4bf5793a0 - lavu 58.22.100 - audio_fifo.h
2023-09-07 - xxxxxxxxxx - lavu 58.22.100 - audio_fifo.h
Constify some pointees in av_audio_fifo_write(), av_audio_fifo_read(),
av_audio_fifo_peek() and av_audio_fifo_peek_at().
2023-09-07 - 9bf31f60960 - lavu 58.21.100 - samplefmt.h
2023-09-07 - xxxxxxxxxx - lavu 58.21.100 - samplefmt.h
Constify some pointees in av_samples_copy() and av_samples_set_silence().
2023-09-07 - 41285890e03 - lavu 58.20.100 - imgutils.h
2023-09-07 - xxxxxxxxxx - lavu 58.20.100 - imgutils.h
Constify some pointees in av_image_copy(), av_image_copy_uc_from() and
av_image_fill_black().
2023-09-07 - 2a68d945cd7 - lavf 60.12.100 - avio.h
2023-09-07 - xxxxxxxxxx - lavf 60.12.100 - avio.h
Constify the buffer pointees in the write_packet and write_data_type
callbacks of AVIOContext on the next major bump.
2023-09-07 - 8238bc0b5e3 - lavc 60.26.100 - defs.h
2023-09-07 - xxxxxxxxxx - lavc 60.26.100 - defs.h
Add AV_PROFILE_* and AV_LEVEL_* replacements in defs.h for the
defines from avcodec.h. The latter are deprecated.
2023-09-06 - b6627a57f41 - lavc 60.25.101 - avcodec.h
2023-09-06 - xxxxxxxxxx - lavc 60.25.101 - avcodec.h
AVCodecContext.rc_buffer_size may now be set by decoders.
2023-09-02 - 25ecc94d58f - lavu 58.19.100 - executor.h
2023-09-02 - xxxxxxxxxx - lavu 58.19.100 - executor.h
Add AVExecutor API
2023-09-01 - 139e54911c8 - lavc 60.25.100 - avfft.h
2023-09-xx - xxxxxxxxxx - lavc 60.25.100 - avfft.h
The entire header will be deprecated and removed in two major bumps.
For a replacement to av_dct, av_rdft, av_fft and av_mdct, use
the new API from libavutil/tx.h.
2023-09-01 - 11e22730e1e - lavu 58.18.100 - tx.h
2023-07-xx - xxxxxxxxxx - lavu 58.18.100 - tx.h
Add AV_TX_REAL_TO_REAL and AV_TX_REAL_TO_IMAGINARY
2023-08-18 - ff094f5ebbd - lavu 58.17.100 - channel_layout.h
2023-08-18 - xxxxxxxxxx - lavu 58.17.100 - channel_layout.h
All AV_CHANNEL_LAYOUT_* macros are now compatible with C++ 17 and older.
2023-08-08 - 5012b4ab4ca - lavu 58.15.100 - video_hint.h
2023-08-08 - xxxxxxxxxx - lavu 58.15.100 - video_hint.h
Add AVVideoHint API.
2023-08-08 - 5012b4ab4ca - lavc 60 - avcodec.h
2023-07-xx - xxxxxxxxxx - lavc 60 - avcodec.h
Deprecate AV_CODEC_FLAG_DROPCHANGED without replacement.
2023-07-05 - d694c25b44c - lavu 58.14.100 - random_seed.h
2023-07-05 - xxxxxxxxxx - lavu 58.14.100 - random_seed.h
Add av_random_bytes()
2023-05-29 - 637afea88ed - lavc 60.16.100 - avcodec.h codec_id.h
2023-05-29 - xxxxxxxxxx - lavc 60.16.100 - avcodec.h codec_id.h
Add AV_CODEC_ID_EVC, FF_PROFILE_EVC_BASELINE, and FF_PROFILE_EVC_MAIN.
2023-05-29 - 75918016ab1 - lavu 58.12.100 - mathematics.h
2023-05-29 - xxxxxxxxxx - lavu 58.12.100 - mathematics.h
Add av_bessel_i0()
2023-05-29 - f3795e18574 - lavc 60.15.100 - avcodec.h
2023-05-xx - xxxxxxxxxx - lavc 60.15.100 - avcodec.h
Add AVHWAccel.update_thread_context, AVHWAccel.free_frame_priv,
AVHWAccel.flush.
2023-05-29 - db1d0227812 - lavu 58.11.100 - hwcontext_vulkan.h
2023-05-xx - xxxxxxxxxx - lavu 58.11.100 - hwcontext_vulkan.h
Add AVVulkanDeviceContext.lock_queue, AVVulkanDeviceContext.unlock_queue,
AVVulkanFramesContext.format, AVVulkanFramesContext.lock_frame,
AVVulkanFramesContext.unlock_frame, AVVkFrame.queue_family.
Deprecate AV_VK_FRAME_FLAG_CONTIGUOUS_MEMORY (use multiplane images instead).
2023-05-29 - bef86ba86cc - lavu 58.10.100 - pixfmt.h
2023-05-xx - xxxxxxxxxx - lavu 58.10.100 - pixfmt.h
Add AV_PIX_FMT_P212BE, AV_PIX_FMT_P212LE, AV_PIX_FMT_P412BE,
AV_PIX_FMT_P412LE.
2023-05-18 - 01d444c077e - lavu 58.8.100 - frame.h
2023-05-xx - xxxxxxxxxx - lavu 58.8.100 - frame.h
Add av_frame_replace().
2023-05-18 - 63767b79a57 - lavu 58 - frame.h
2023-05-xx - xxxxxxxxxx - lavu 58 - frame.h
Deprecate AVFrame.palette_has_changed without replacement.
2023-05-15 - 7d1d61cc5f5 - lavc 60 - avcodec.h
2023-05-xx - xxxxxxxxxx - lavc 60 - avcodec.h
Depreate AVCodecContext.ticks_per_frame in favor of
AVCodecContext.framerate (encoding) and
AV_CODEC_PROP_FIELDS (decoding).
2023-05-15 - 70433abf7fb - lavc 60.12.100 - codec_desc.h
2023-05-xx - xxxxxxxxxx - lavc 60.12.100 - codec_desc.h
Add AV_CODEC_PROP_FIELDS.
2023-05-15 - 8b20d0dcb5c - lavc 60 - codec.h
2023-05-xx - xxxxxxxxxx - lavc 60 - codec.h
Depreate AV_CODEC_CAP_SUBFRAMES without replacement.
2023-05-07 - c2ae8e30b7f - lavc 60.11.100 - codec_par.h
2023-05-xx - xxxxxxxxxx - lavc 60.11.100 - codec_par.h
Add AVCodecParameters.framerate.
2023-05-04 - 0fc9c1f6828 - lavu 58.7.100 - frame.h
2023-05-04 - xxxxxxxxxx - lavu 58.7.100 - frame.h
Deprecate AVFrame.interlaced_frame, AVFrame.top_field_first, and
AVFrame.key_frame.
Add AV_FRAME_FLAG_INTERLACED, AV_FRAME_FLAG_TOP_FIELD_FIRST, and
AV_FRAME_FLAG_KEY flags as replacement.
2023-04-10 - 4eaaa38d3df - lavu 58.6.100 - frame.h
2023-04-10 - xxxxxxxxxx - lavu 58.6.100 - frame.h
av_frame_get_plane_buffer() now accepts const AVFrame*.
2023-04-04 - 61b27b15fc9 - lavu 58.6.100 - hdr_dynamic_metadata.h
2023-04-04 - xxxxxxxxxx - lavu 58.6.100 - hdr_dynamic_metadata.h
Add AV_HDR_PLUS_MAX_PAYLOAD_SIZE.
av_dynamic_hdr_plus_create_side_data() now accepts a user provided
buffer.
2023-03-24 - 632c3499319 - lavfi 9.5.100 - avfilter.h
2023-03-xx - xxxxxxxxxx - lavfi 9.5.100 - avfilter.h
Add AVFILTER_FLAG_HWDEVICE.
2023-03-21 - 0a3ce5f7384 - lavu 58.5.100 - hdr_dynamic_metadata.h
2023-03-21 - xxxxxxxxxx - lavu 58.5.100 - hdr_dynamic_metadata.h
Add av_dynamic_hdr_plus_from_t35() and av_dynamic_hdr_plus_to_t35()
functions to convert between raw T.35 payloads containing dynamic
HDR10+ metadata and their parsed representations as AVDynamicHDRPlus.
2023-03-17 - 3be46ee7672 - lavu 58.4.100 - hdr_dynamic_vivid_metadata.h
2023-03-17 - xxxxxxxxxx - lavu 58.4.100 - hdr_dynamic_vivid_metadata.h
Add two group of three spline params.
Deprecate previous define which only supports one group of params.
2023-03-02 - 373ef1c4fae - lavc 60.6.100 - avcodec.h
2023-03-02 - xxxxxxxxxx - lavc 60.6.100 - avcodec.h
Add FF_PROFILE_EAC3_DDP_ATMOS, FF_PROFILE_TRUEHD_ATMOS,
FF_PROFILE_DTS_HD_MA_X and FF_PROFILE_DTS_HD_MA_X_IMAX.
2023-02-25 - f4593775436 - lavc 60.5.100 - avcodec.h
2023-02-25 - xxxxxxxxxx - lavc 60.5.100 - avcodec.h
Add FF_PROFILE_HEVC_SCC.
-------- 8< --------- FFmpeg 6.0 was cut here -------- 8< ---------
+1 -1
View File
@@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 6.1.2
PROJECT_NUMBER =
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
+1 -1
View File
File diff suppressed because one or more lines are too long
+10 -23
View File
@@ -391,7 +391,7 @@ Specifies the encoding scheme of input subtitle text.
@table @samp
@item auto
Automatically detect text encoding (default).
Automatically detect text encoding.
@item jis
8bit-char JIS encoding defined in ARIB STD B24.
This encoding used in Japan for ISDB captions.
@@ -403,6 +403,9 @@ Latin character encoding defined in ABNT NBR 15606-1.
This encoding is used in South America for SBTVD / ISDB-Tb captions.
@end table
The default is @dfn{ass} as same as @dfn{libaribb24} decoder.
Some present players (e.g., @dfn{mpv}) expect ASS format for ARIB caption.
@item -font @var{font_name[,font_name2,...]}
Specify comma-separated list of font family names to be used for @dfn{bitmap}
or @dfn{ass} type subtitle rendering.
@@ -424,6 +427,12 @@ If your player cannot handle AVSubtitles with multiple ASS rectangles properly,
set this option to @var{true} or define @env{ASS_SINGLE_RECT=1} to change
default behavior at compilation.
@item -replace_fullwidth_ascii @var{boolean}
Specify whether to replace MSZ (Middle Size, half width) fullwidth
alphanumerics with halfwidth alphanumerics.
The default is @var{true}.
@item -force_outline_text @var{boolean}
Specify whether always render outline text for all characters regardless of
the indication by charactor style.
@@ -450,28 +459,6 @@ Specify whether to render replaced DRCS characters as Unicode characters.
The default is @var{true}.
@item -replace_msz_ascii @var{boolean}
Specify whether to replace MSZ (Middle Size; half width) fullwidth
alphanumerics with halfwidth alphanumerics.
The default is @var{true}.
@item -replace_msz_japanese @var{boolean}
Specify whether to replace some MSZ (Middle Size; half width) fullwidth
japanese special characters with halfwidth ones.
The default is @var{true}.
@item -replace_msz_glyph @var{boolean}
Specify whether to replace MSZ (Middle Size; half width) characters
with halfwidth glyphs if the fonts supports it.
This option works under FreeType or DirectWrite renderer
with Adobe-Japan1 compliant fonts.
e.g., IBM Plex Sans JP, Morisawa BIZ UDGothic, Morisawa BIZ UDMincho,
Yu Gothic, Yu Mincho, and Meiryo.
The default is @var{true}.
@item -canvas_size @var{image_size}
Specify the resolution of the canvas to render subtitles to; usually, this
should be frame size of input video.
-9
View File
@@ -396,10 +396,6 @@ If you apply a patch, send an
answer to ffmpeg-devel (or wherever you got the patch from) saying that
you applied the patch.
@subheading Credit any researchers
If a commit/patch fixes an issues found by some researcher, always credit the
researcher in the commit message for finding/reporting the issue.
@subheading Always wait long enough before pushing changes
Do NOT commit to code actively maintained by others without permission.
Send a patch to ffmpeg-devel. If no one answers within a reasonable
@@ -644,11 +640,6 @@ patch is inline or attached per mail.
You can check @url{https://patchwork.ffmpeg.org}, if your patch does not show up, its mime type
likely was wrong.
@subheading How to setup git send-email?
Please see @url{https://git-send-email.io/}.
For gmail additionally see @url{https://shallowsky.com/blog/tech/email/gmail-app-passwds.html}.
@subheading Sending patches from email clients
Using @code{git send-email} might not be desirable for everyone. The
following trick allows to send patches via email clients in a safe
+3 -1
View File
@@ -138,9 +138,11 @@ static int decode_packet(AVCodecContext *dec, const AVPacket *pkt)
ret = output_audio_frame(frame);
av_frame_unref(frame);
if (ret < 0)
return ret;
}
return ret;
return 0;
}
static int open_codec_context(int *stream_idx,
+2 -1
View File
@@ -347,7 +347,8 @@ static int write_audio_frame(AVFormatContext *oc, OutputStream *ost)
if (frame) {
/* convert samples from native format to destination codec format, using the resampler */
/* compute destination number of samples */
dst_nb_samples = swr_get_delay(ost->swr_ctx, c->sample_rate) + frame->nb_samples;
dst_nb_samples = av_rescale_rnd(swr_get_delay(ost->swr_ctx, c->sample_rate) + frame->nb_samples,
c->sample_rate, c->sample_rate, AV_ROUND_UP);
av_assert0(dst_nb_samples == frame->nb_samples);
/* when we pass a frame to the encoder, it may keep a reference to it
+6 -3
View File
@@ -75,7 +75,8 @@ static int str_to_dict(char* optstr, AVDictionary **opt)
if (value == NULL)
return AVERROR(ENAVAIL);
av_dict_set(opt, key, value, 0);
} while(1);
} while(key != NULL);
return 0;
}
static int dynamic_set_parameter(AVCodecContext *avctx)
@@ -333,15 +334,17 @@ static int dec_enc(AVPacket *pkt, const AVCodec *enc_codec, char *optstr)
fail:
av_frame_free(&frame);
if (ret < 0)
return ret;
}
return ret;
return 0;
}
int main(int argc, char **argv)
{
const AVCodec *enc_codec;
int ret = 0;
AVPacket *dec_pkt = NULL;
AVPacket *dec_pkt;
if (argc < 5 || (argc - 5) % 2) {
av_log(NULL, AV_LOG_ERROR, "Usage: %s <input file> <encoder> <output file>"
-4
View File
@@ -88,10 +88,6 @@ static int encode_write(AVCodecContext *avctx, AVFrame *frame, FILE *fout)
enc_pkt->stream_index = 0;
ret = fwrite(enc_pkt->data, enc_pkt->size, 1, fout);
av_packet_unref(enc_pkt);
if (ret != enc_pkt->size) {
ret = AVERROR(errno);
break;
}
}
end:
+3 -1
View File
@@ -215,8 +215,10 @@ static int dec_enc(AVPacket *pkt, const AVCodec *enc_codec)
fail:
av_frame_free(&frame);
if (ret < 0)
return ret;
}
return ret;
return 0;
}
int main(int argc, char **argv)
+21 -85
View File
@@ -20,45 +20,8 @@
# License along with FFmpeg; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# Texinfo 7.0 changed the syntax of various functions.
# Provide a shim for older versions.
sub ff_set_from_init_file($$) {
my $key = shift;
my $value = shift;
if (exists &{'texinfo_set_from_init_file'}) {
texinfo_set_from_init_file($key, $value);
} else {
set_from_init_file($key, $value);
}
}
sub ff_get_conf($) {
my $key = shift;
if (exists &{'texinfo_get_conf'}) {
texinfo_get_conf($key);
} else {
get_conf($key);
}
}
sub get_formatting_function($$) {
my $obj = shift;
my $func = shift;
my $sub = $obj->can('formatting_function');
if ($sub) {
return $obj->formatting_function($func);
} else {
return $obj->{$func};
}
}
# determine texinfo version
my $program_version_num = version->declare(ff_get_conf('PACKAGE_VERSION'))->numify;
my $program_version_6_8 = $program_version_num >= 6.008000;
# no navigation elements
ff_set_from_init_file('HEADERS', 0);
set_from_init_file('HEADERS', 0);
sub ffmpeg_heading_command($$$$$)
{
@@ -92,7 +55,7 @@ sub ffmpeg_heading_command($$$$$)
$element = $command->{'parent'};
}
if ($element) {
$result .= &{get_formatting_function($self, 'format_element_header')}($self, $cmdname,
$result .= &{$self->{'format_element_header'}}($self, $cmdname,
$command, $element);
}
@@ -149,11 +112,7 @@ sub ffmpeg_heading_command($$$$$)
$cmdname
= $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level];
}
# format_heading_text expects an array of headings for texinfo >= 7.0
if ($program_version_num >= 7.000000) {
$heading = [$heading];
}
$result .= &{get_formatting_function($self,'format_heading_text')}(
$result .= &{$self->{'format_heading_text'}}(
$self, $cmdname, $heading,
$heading_level +
$self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command);
@@ -167,19 +126,23 @@ foreach my $command (keys(%Texinfo::Common::sectioning_commands), 'node') {
texinfo_register_command_formatting($command, \&ffmpeg_heading_command);
}
# determine if texinfo is at least version 6.8
my $program_version_num = version->declare(get_conf('PACKAGE_VERSION'))->numify;
my $program_version_6_8 = $program_version_num >= 6.008000;
# print the TOC where @contents is used
if ($program_version_6_8) {
ff_set_from_init_file('CONTENTS_OUTPUT_LOCATION', 'inline');
set_from_init_file('CONTENTS_OUTPUT_LOCATION', 'inline');
} else {
ff_set_from_init_file('INLINE_CONTENTS', 1);
set_from_init_file('INLINE_CONTENTS', 1);
}
# make chapters <h2>
ff_set_from_init_file('CHAPTER_HEADER_LEVEL', 2);
set_from_init_file('CHAPTER_HEADER_LEVEL', 2);
# Do not add <hr>
ff_set_from_init_file('DEFAULT_RULE', '');
ff_set_from_init_file('BIG_RULE', '');
set_from_init_file('DEFAULT_RULE', '');
set_from_init_file('BIG_RULE', '');
# Customized file beginning
sub ffmpeg_begin_file($$$)
@@ -196,18 +159,7 @@ sub ffmpeg_begin_file($$$)
my ($title, $description, $encoding, $date, $css_lines,
$doctype, $bodytext, $copying_comment, $after_body_open,
$extra_head, $program_and_version, $program_homepage,
$program, $generator);
if ($program_version_num >= 7.000000) {
($title, $description, $encoding, $date, $css_lines,
$doctype, $bodytext, $copying_comment, $after_body_open,
$extra_head, $program_and_version, $program_homepage,
$program, $generator) = $self->_file_header_information($command);
} else {
($title, $description, $encoding, $date, $css_lines,
$doctype, $bodytext, $copying_comment, $after_body_open,
$extra_head, $program_and_version, $program_homepage,
$program, $generator) = $self->_file_header_informations($command);
}
$program, $generator) = $self->_file_header_informations($command);
my $links = $self->_get_links ($filename, $element);
@@ -271,7 +223,7 @@ if ($program_version_6_8) {
sub ffmpeg_end_file($)
{
my $self = shift;
my $program_string = &{get_formatting_function($self,'format_program_string')}($self);
my $program_string = &{$self->{'format_program_string'}}($self);
my $program_text = <<EOT;
<p style="font-size: small;">
$program_string
@@ -292,7 +244,7 @@ if ($program_version_6_8) {
# Dummy title command
# Ignore title. Title is handled through ffmpeg_begin_file().
ff_set_from_init_file('USE_TITLEPAGE_FOR_TITLE', 1);
set_from_init_file('USE_TITLEPAGE_FOR_TITLE', 1);
sub ffmpeg_title($$$$)
{
return '';
@@ -310,14 +262,8 @@ sub ffmpeg_float($$$$$)
my $args = shift;
my $content = shift;
my ($caption, $prepended);
if ($program_version_num >= 7.000000) {
($caption, $prepended) = Texinfo::Convert::Converter::float_name_caption($self,
$command);
} else {
($caption, $prepended) = Texinfo::Common::float_name_caption($self,
$command);
}
my ($caption, $prepended) = Texinfo::Common::float_name_caption($self,
$command);
my $caption_text = '';
my $prepended_text;
my $prepended_save = '';
@@ -389,13 +335,8 @@ sub ffmpeg_float($$$$$)
$caption->{'args'}->[0], 'float caption');
}
if ($prepended_text.$caption_text ne '') {
if ($program_version_num >= 7.000000) {
$prepended_text = $self->html_attribute_class('div',['float-caption']). '>'
. $prepended_text;
} else {
$prepended_text = $self->_attribute_class('div','float-caption'). '>'
. $prepended_text;
}
$prepended_text = $self->_attribute_class('div','float-caption'). '>'
. $prepended_text;
$caption_text .= '</div>';
}
my $html_class = '';
@@ -408,13 +349,8 @@ sub ffmpeg_float($$$$$)
$prepended_text = '';
$caption_text = '';
}
if ($program_version_num >= 7.000000) {
return $self->html_attribute_class('div', [$html_class]). '>' . "\n" .
$prepended_text . $caption_text . $content . '</div>';
} else {
return $self->_attribute_class('div', $html_class). '>' . "\n" .
$prepended_text . $caption_text . $content . '</div>';
}
return $self->_attribute_class('div', $html_class). '>' . "\n" .
$prepended_text . $caption_text . $content . '</div>';
}
texinfo_register_command_formatting('float',
+1 -1
View File
@@ -512,7 +512,7 @@ static const AVOption *opt_find(void *obj, const char *name, const char *unit,
return o;
}
#define FLAGS ((o->type == AV_OPT_TYPE_FLAGS && (arg[0]=='-' || arg[0]=='+')) ? AV_DICT_APPEND : 0)
#define FLAGS (o->type == AV_OPT_TYPE_FLAGS && (arg[0]=='-' || arg[0]=='+')) ? AV_DICT_APPEND : 0
int opt_default(void *optctx, const char *opt, const char *arg)
{
const AVOption *o;
+2 -3
View File
@@ -325,9 +325,8 @@ static int read_key(void)
}
//Read it
if(nchars != 0) {
if (read(0, &ch, 1) == 1)
return ch;
return 0;
read(0, &ch, 1);
return ch;
}else{
return -1;
}
+2 -3
View File
@@ -883,12 +883,11 @@ void update_benchmark(const char *fmt, ...);
/**
* Merge two return codes - return one of the error codes if at least one of
* them was negative, 0 otherwise.
* Currently just picks the first one, eventually we might want to do something
* more sophisticated, like sorting them by priority.
*/
static inline int err_merge(int err0, int err1)
{
// prefer "real" errors over EOF
if ((err0 >= 0 || err0 == AVERROR_EOF) && err1 < 0)
return err1;
return (err0 < 0) ? err0 : FFMIN(err1, 0);
}
+2 -2
View File
@@ -490,9 +490,9 @@ void enc_stats_write(OutputStream *ost, EncStats *es,
AVRational tbi = (AVRational){ 0, 1};
int64_t ptsi = INT64_MAX;
const FrameData *fd = NULL;
const FrameData *fd;
if (frame ? frame->opaque_ref : pkt->opaque_ref) {
if ((frame && frame->opaque_ref) || (pkt && pkt->opaque_ref)) {
fd = (const FrameData*)(frame ? frame->opaque_ref->data : pkt->opaque_ref->data);
tbi = fd->dec.tb;
ptsi = fd->dec.pts;
+3 -3
View File
@@ -2182,11 +2182,11 @@ static int copy_metadata(Muxer *mux, AVFormatContext *ic,
if (ret < 0)
return ret;
if (type_in == 'g' || type_out == 'g' || (!*outspec && !ic))
if (type_in == 'g' || type_out == 'g' || !*outspec)
*metadata_global_manual = 1;
if (type_in == 's' || type_out == 's' || (!*outspec && !ic))
if (type_in == 's' || type_out == 's' || !*outspec)
*metadata_streams_manual = 1;
if (type_in == 'c' || type_out == 'c' || (!*outspec && !ic))
if (type_in == 'c' || type_out == 'c' || !*outspec)
*metadata_chapters_manual = 1;
/* ic is NULL when just disabling automatic mappings */
+2 -5
View File
@@ -1999,8 +1999,6 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for
goto end;
if (force_output_format) {
av_bprint_clear(&bp);
av_channel_layout_describe_bprint(&is->audio_tgt.ch_layout, &bp);
sample_rates [0] = is->audio_tgt.freq;
if ((ret = av_opt_set_int(filt_asink, "all_channel_counts", 0, AV_OPT_SEARCH_CHILDREN)) < 0)
goto end;
@@ -2353,13 +2351,12 @@ static int audio_decode_frame(VideoState *is)
av_channel_layout_compare(&af->frame->ch_layout, &is->audio_src.ch_layout) ||
af->frame->sample_rate != is->audio_src.freq ||
(wanted_nb_samples != af->frame->nb_samples && !is->swr_ctx)) {
int ret;
swr_free(&is->swr_ctx);
ret = swr_alloc_set_opts2(&is->swr_ctx,
swr_alloc_set_opts2(&is->swr_ctx,
&is->audio_tgt.ch_layout, is->audio_tgt.fmt, is->audio_tgt.freq,
&af->frame->ch_layout, af->frame->format, af->frame->sample_rate,
0, NULL);
if (ret < 0 || swr_init(is->swr_ctx) < 0) {
if (!is->swr_ctx || swr_init(is->swr_ctx) < 0) {
av_log(NULL, AV_LOG_ERROR,
"Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n",
af->frame->sample_rate, av_get_sample_fmt_name(af->frame->format), af->frame->ch_layout.nb_channels,
+6 -8
View File
@@ -724,13 +724,10 @@ int show_codecs(void *optctx, const char *opt, const char *arg)
return 0;
}
static int print_codecs(int encoder)
static void print_codecs(int encoder)
{
const AVCodecDescriptor **codecs;
int i, nb_codecs = get_codecs_sorted(&codecs);
if (nb_codecs < 0)
return nb_codecs;
unsigned i, nb_codecs = get_codecs_sorted(&codecs);
printf("%s:\n"
" V..... = Video\n"
@@ -765,17 +762,18 @@ static int print_codecs(int encoder)
}
}
av_free(codecs);
return 0;
}
int show_decoders(void *optctx, const char *opt, const char *arg)
{
return print_codecs(0);
print_codecs(0);
return 0;
}
int show_encoders(void *optctx, const char *opt, const char *arg)
{
return print_codecs(1);
print_codecs(1);
return 0;
}
int show_bsfs(void *optctx, const char *opt, const char *arg)
-2
View File
@@ -887,8 +887,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
}
if (i >= CFRAME_BUFFER_COUNT) {
if (free_index < 0)
return AVERROR_INVALIDDATA;
i = free_index;
f->cfrm[i].id = id;
}
+1 -1
View File
@@ -61,7 +61,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
unsigned int planes = c->planes;
int ret;
if (buf_size < planes * height * (2 + 2*((avctx->width+128)/129)))
if (buf_size < planes * height * 2)
return AVERROR_INVALIDDATA;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
+3 -3
View File
@@ -993,7 +993,7 @@ OBJS-$(CONFIG_AV1_DXVA2_HWACCEL) += dxva2_av1.o
OBJS-$(CONFIG_AV1_NVDEC_HWACCEL) += nvdec_av1.o
OBJS-$(CONFIG_AV1_VAAPI_HWACCEL) += vaapi_av1.o
OBJS-$(CONFIG_AV1_VDPAU_HWACCEL) += vdpau_av1.o
OBJS-$(CONFIG_AV1_VULKAN_HWACCEL) += vulkan_decode.o vulkan_av1.o
OBJS-$(CONFIG_AV1_VULKAN_HWACCEL) += vulkan_av1.o
OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o
OBJS-$(CONFIG_H263_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o
OBJS-$(CONFIG_H264_D3D11VA_HWACCEL) += dxva2_h264.o
@@ -1284,7 +1284,7 @@ SKIPHEADERS += %_tablegen.h \
aacenc_quantization.h \
aacenc_quantization_misc.h \
bitstream_template.h \
vulkan_video_codec_av1std_mesa.h \
vulkan_video_codec_av1std.h \
$(ARCH)/vpx_arith.h \
SKIPHEADERS-$(CONFIG_AMF) += amfenc.h
@@ -1306,7 +1306,7 @@ SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h
SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_decode.h vaapi_hevc.h vaapi_encode.h
SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h vdpau_internal.h
SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vt_internal.h
SKIPHEADERS-$(CONFIG_VULKAN) += vulkan.h vulkan_video.h vulkan_decode.h vulkan_video_codec_av1std_decode_mesa.h
SKIPHEADERS-$(CONFIG_VULKAN) += vulkan.h vulkan_video.h vulkan_decode.h vulkan_video_codec_av1std_decode.h
SKIPHEADERS-$(CONFIG_V4L2_M2M) += v4l2_buffers.h v4l2_context.h v4l2_m2m.h
SKIPHEADERS-$(CONFIG_ZLIB) += zlib_wrapper.h
+1 -3
View File
@@ -204,9 +204,7 @@ int av_ac3_parse_header(const uint8_t *buf, size_t size,
AC3HeaderInfo hdr;
int err;
err = init_get_bits8(&gb, buf, size);
if (err < 0)
return AVERROR_INVALIDDATA;
init_get_bits8(&gb, buf, size);
err = ff_ac3_parse_header(&gb, &hdr);
if (err < 0)
return AVERROR_INVALIDDATA;
+2 -2
View File
@@ -2110,8 +2110,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
if (sconf->floating) {
ctx->acf = av_malloc_array(channels, sizeof(*ctx->acf));
ctx->shift_value = av_calloc(channels, sizeof(*ctx->shift_value));
ctx->last_shift_value = av_calloc(channels, sizeof(*ctx->last_shift_value));
ctx->shift_value = av_malloc_array(channels, sizeof(*ctx->shift_value));
ctx->last_shift_value = av_malloc_array(channels, sizeof(*ctx->last_shift_value));
ctx->last_acf_mantissa = av_malloc_array(channels, sizeof(*ctx->last_acf_mantissa));
ctx->raw_mantissa = av_calloc(channels, sizeof(*ctx->raw_mantissa));
-3
View File
@@ -26,7 +26,6 @@
#include "config.h"
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "libavutil/lfg.h"
@@ -555,8 +554,6 @@ static void decode_fixed_vector(float *fixed_vector, const uint16_t *pulse_hi,
decode_6p_track(sig_pos[i], (int) pulse_lo[i] +
((int) pulse_hi[i] << 11), 4, 1);
break;
default:
av_assert2(0);
}
memset(fixed_vector, 0, sizeof(float) * AMRWB_SFR_SIZE);
+2 -2
View File
@@ -1284,9 +1284,9 @@ static void predictor_decode_stereo_3950(APEContext *ctx, int count)
*decoded1++ = a1;
if (num_passes > 1) {
int32_t left = a1 - (unsigned)(a0 / 2);
int32_t right = left + (unsigned)a0;
int32_t right = left + a0;
if (FFMIN(FFNABS(left), FFNABS(right)) < -(1<<23)) {
if (FFMAX(FFABS(left), FFABS(right)) > (1<<23)) {
ctx->interim_mode = !interim_mode;
av_log(ctx->avctx, AV_LOG_VERBOSE, "Interim mode: %d\n", ctx->interim_mode);
break;
+2 -6
View File
@@ -801,9 +801,7 @@ static int atrac9_decode_frame(AVCodecContext *avctx, AVFrame *frame,
if (ret < 0)
return ret;
ret = init_get_bits8(&gb, avpkt->data, avpkt->size);
if (ret < 0)
return ret;
init_get_bits8(&gb, avpkt->data, avpkt->size);
for (int i = 0; i < frames; i++) {
for (int j = 0; j < s->block_config->count; j++) {
@@ -925,9 +923,7 @@ static av_cold int atrac9_decode_init(AVCodecContext *avctx)
return AVERROR_INVALIDDATA;
}
err = init_get_bits8(&gb, avctx->extradata + 4, avctx->extradata_size);
if (err < 0)
return err;
init_get_bits8(&gb, avctx->extradata + 4, avctx->extradata_size);
if (get_bits(&gb, 8) != 0xFE) {
av_log(avctx, AV_LOG_ERROR, "Incorrect magic byte!\n");
+7 -7
View File
@@ -177,7 +177,7 @@ static uint8_t get_shear_params_valid(AV1DecContext *s, int idx)
int16_t alpha, beta, gamma, delta, divf, divs;
int64_t v, w;
int32_t *param = &s->cur_frame.gm_params[idx][0];
if (param[2] <= 0)
if (param[2] < 0)
return 0;
alpha = av_clip_int16(param[2] - (1 << AV1_WARPEDMODEL_PREC_BITS));
@@ -443,7 +443,7 @@ static int get_tiles_info(AVCodecContext *avctx, const AV1RawTileGroup *tile_gro
static enum AVPixelFormat get_sw_pixel_format(void *logctx,
const AV1RawSequenceHeader *seq)
{
int bit_depth;
uint8_t bit_depth;
enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
if (seq->seq_profile == 2 && seq->color_config.high_bitdepth)
@@ -467,7 +467,7 @@ static enum AVPixelFormat get_sw_pixel_format(void *logctx,
else if (bit_depth == 12)
pix_fmt = AV_PIX_FMT_YUV444P12;
else
av_assert0(0);
av_log(logctx, AV_LOG_WARNING, "Unknown AV1 pixel format.\n");
} else if (seq->color_config.subsampling_x == 1 &&
seq->color_config.subsampling_y == 0) {
if (bit_depth == 8)
@@ -477,7 +477,7 @@ static enum AVPixelFormat get_sw_pixel_format(void *logctx,
else if (bit_depth == 12)
pix_fmt = AV_PIX_FMT_YUV422P12;
else
av_assert0(0);
av_log(logctx, AV_LOG_WARNING, "Unknown AV1 pixel format.\n");
} else if (seq->color_config.subsampling_x == 1 &&
seq->color_config.subsampling_y == 1) {
if (bit_depth == 8)
@@ -487,7 +487,7 @@ static enum AVPixelFormat get_sw_pixel_format(void *logctx,
else if (bit_depth == 12)
pix_fmt = AV_PIX_FMT_YUV420P12;
else
av_assert0(0);
av_log(logctx, AV_LOG_WARNING, "Unknown AV1 pixel format.\n");
}
} else {
if (bit_depth == 8)
@@ -497,7 +497,7 @@ static enum AVPixelFormat get_sw_pixel_format(void *logctx,
else if (bit_depth == 12)
pix_fmt = AV_PIX_FMT_GRAY12;
else
av_assert0(0);
av_log(logctx, AV_LOG_WARNING, "Unknown AV1 pixel format.\n");
}
return pix_fmt;
@@ -736,7 +736,7 @@ static int set_context_with_sequence(AVCodecContext *avctx,
avctx->color_range =
seq->color_config.color_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
avctx->color_primaries = seq->color_config.color_primaries;
avctx->colorspace = seq->color_config.matrix_coefficients;
avctx->colorspace = seq->color_config.color_primaries;
avctx->color_trc = seq->color_config.transfer_characteristics;
switch (seq->color_config.chroma_sample_position) {
+10 -30
View File
@@ -46,7 +46,7 @@ FFTContext *av_fft_init(int nbits, int inverse)
{
int ret;
float scale = 1.0f;
AVTXWrapper *s = av_mallocz(sizeof(*s));
AVTXWrapper *s = av_malloc(sizeof(*s));
if (!s)
return NULL;
@@ -85,7 +85,7 @@ FFTContext *av_mdct_init(int nbits, int inverse, double scale)
{
int ret;
float scale_f = scale;
AVTXWrapper *s = av_mallocz(sizeof(*s));
AVTXWrapper *s = av_malloc(sizeof(*s));
if (!s)
return NULL;
@@ -130,7 +130,6 @@ av_cold void av_mdct_end(FFTContext *s)
{
if (s) {
AVTXWrapper *w = (AVTXWrapper *)s;
av_tx_uninit(&w->ctx2);
av_tx_uninit(&w->ctx);
av_free(w);
}
@@ -147,12 +146,12 @@ RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans)
if (trans != IDFT_C2R && trans != DFT_R2C)
return NULL;
s = av_mallocz(sizeof(*s));
s = av_malloc(sizeof(*s));
if (!s)
return NULL;
ret = av_tx_init(&s->ctx, &s->fn, AV_TX_FLOAT_RDFT, trans == IDFT_C2R,
1 << nbits, &scale, 0x0);
1 << nbits, &scale, AV_TX_INPLACE);
if (ret < 0) {
av_free(s);
return NULL;
@@ -162,35 +161,17 @@ RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans)
s->len = 1 << nbits;
s->inv = trans == IDFT_C2R;
s->tmp = av_malloc((s->len + 2)*sizeof(float));
if (!s->tmp) {
av_tx_uninit(&s->ctx);
av_free(s);
return NULL;
}
return (RDFTContext *)s;
}
void av_rdft_calc(RDFTContext *s, FFTSample *data)
{
AVTXWrapper *w = (AVTXWrapper *)s;
float *src = w->inv ? w->tmp : (float *)data;
float *dst = w->inv ? (float *)data : w->tmp;
if (w->inv) {
memcpy(src, data, w->len*sizeof(float));
src[w->len] = src[1];
src[1] = 0.0f;
}
w->fn(w->ctx, dst, (void *)src, w->stride);
if (!w->inv) {
dst[1] = dst[w->len];
memcpy(data, dst, w->len*sizeof(float));
}
if (w->inv)
FFSWAP(float, data[1], data[w->len]);
w->fn(w->ctx, data, (void *)data, w->stride);
if (!w->inv)
FFSWAP(float, data[1], data[w->len]);
}
av_cold void av_rdft_end(RDFTContext *s)
@@ -198,7 +179,6 @@ av_cold void av_rdft_end(RDFTContext *s)
if (s) {
AVTXWrapper *w = (AVTXWrapper *)s;
av_tx_uninit(&w->ctx);
av_free(w->tmp);
av_free(w);
}
}
@@ -219,7 +199,7 @@ DCTContext *av_dct_init(int nbits, enum DCTTransformType inverse)
[DST_I] = AV_TX_FLOAT_DST_I,
};
AVTXWrapper *s = av_mallocz(sizeof(*s));
AVTXWrapper *s = av_malloc(sizeof(*s));
if (!s)
return NULL;
+1 -3
View File
@@ -72,15 +72,13 @@ static void parse_avs2_seq_header(AVCodecParserContext *s, const uint8_t *buf,
unsigned aspect_ratio;
unsigned frame_rate_code;
int low_delay;
av_unused int ret;
// update buf_size_min if parse more deeper
const int buf_size_min = 15;
if (buf_size < buf_size_min)
return;
ret = init_get_bits8(&gb, buf, buf_size_min);
av_assert1(ret >= 0);
init_get_bits8(&gb, buf, buf_size_min);
s->key_frame = 1;
s->pict_type = AV_PICTURE_TYPE_I;
+1 -2
View File
@@ -73,8 +73,7 @@ static void parse_avs3_nal_units(AVCodecParserContext *s, const uint8_t *buf,
GetBitContext gb;
int profile, ratecode, low_delay;
av_unused int ret = init_get_bits(&gb, buf + 4, 100);
av_assert1(ret >= 0);
init_get_bits8(&gb, buf + 4, buf_size - 4);
s->key_frame = 1;
s->pict_type = AV_PICTURE_TYPE_I;
+6 -14
View File
@@ -36,7 +36,7 @@ static int cbs_av1_read_uvlc(CodedBitstreamContext *ctx, GetBitContext *gbc,
CBS_TRACE_READ_START();
zeroes = 0;
while (zeroes < 32) {
while (1) {
if (get_bits_left(gbc) < 1) {
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid uvlc code at "
"%s: bitstream ended.\n", name);
@@ -49,18 +49,10 @@ static int cbs_av1_read_uvlc(CodedBitstreamContext *ctx, GetBitContext *gbc,
}
if (zeroes >= 32) {
// The spec allows at least thirty-two zero bits followed by a
// one to mean 2^32-1, with no constraint on the number of
// zeroes. The libaom reference decoder does not match this,
// instead reading thirty-two zeroes but not the following one
// to mean 2^32-1. These two interpretations are incompatible
// and other implementations may follow one or the other.
// Therefore we reject thirty-two zeroes because the intended
// behaviour is not clear.
av_log(ctx->log_ctx, AV_LOG_ERROR, "Thirty-two zero bits in "
"%s uvlc code: considered invalid due to conflicting "
"standard and reference decoder behaviour.\n", name);
return AVERROR_INVALIDDATA;
// Note that the spec allows an arbitrarily large number of
// zero bits followed by a one bit in this case, but the
// libaom implementation does not support it.
value = MAX_UINT_BITS(32);
} else {
if (get_bits_left(gbc) < zeroes) {
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid uvlc code at "
@@ -309,7 +301,7 @@ static int cbs_av1_write_increment(CodedBitstreamContext *ctx, PutBitContext *pb
return AVERROR(ENOSPC);
if (len > 0)
put_bits(pbc, len, (1U << len) - 1 - (value != range_max));
put_bits(pbc, len, (1 << len) - 1 - (value != range_max));
CBS_TRACE_WRITE_END_NO_SUBSCRIPTS();
+1 -30
View File
@@ -235,16 +235,6 @@ static int cbs_h265_payload_extension_present(GetBitContext *gbc, uint32_t paylo
#define FUNC_H266(name) FUNC_NAME1(READWRITE, h266, name)
#define FUNC_SEI(name) FUNC_NAME1(READWRITE, sei, name)
#define SEI_FUNC(name, args) \
static int FUNC(name) args; \
static int FUNC(name ## _internal)(CodedBitstreamContext *ctx, \
RWContext *rw, void *cur, \
SEIMessageState *state) \
{ \
return FUNC(name)(ctx, rw, cur, state); \
} \
static int FUNC(name) args
#define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL)
#define u(width, name, range_min, range_max) \
@@ -708,11 +698,7 @@ static int cbs_h2645_split_fragment(CodedBitstreamContext *ctx,
start = bytestream2_tell(&gbc);
for(i = 0; i < num_nalus; i++) {
if (bytestream2_get_bytes_left(&gbc) < 2)
return AVERROR_INVALIDDATA;
size = bytestream2_get_be16(&gbc);
if (bytestream2_get_bytes_left(&gbc) < size)
return AVERROR_INVALIDDATA;
bytestream2_skip(&gbc, size);
}
end = bytestream2_tell(&gbc);
@@ -2003,17 +1989,7 @@ static const CodedBitstreamUnitTypeDescriptor cbs_h266_unit_types[] = {
CBS_UNIT_TYPE_INTERNAL_REF(VVC_DCI_NUT, H266RawDCI, extension_data.data),
CBS_UNIT_TYPE_INTERNAL_REF(VVC_OPI_NUT, H266RawOPI, extension_data.data),
CBS_UNIT_TYPE_INTERNAL_REF(VVC_VPS_NUT, H266RawVPS, extension_data.data),
{
.nb_unit_types = 1,
.unit_type.list[0] = VVC_SPS_NUT,
.content_type = CBS_CONTENT_TYPE_INTERNAL_REFS,
.content_size = sizeof(H266RawSPS),
.type.ref = {
.nb_offsets = 2,
.offsets = { offsetof(H266RawSPS, extension_data.data),
offsetof(H266RawSPS, vui.extension_data.data) }
},
},
CBS_UNIT_TYPE_INTERNAL_REF(VVC_SPS_NUT, H266RawSPS, extension_data.data),
CBS_UNIT_TYPE_INTERNAL_REF(VVC_PPS_NUT, H266RawPPS, extension_data.data),
CBS_UNIT_TYPE_INTERNAL_REF(VVC_PREFIX_APS_NUT, H266RawAPS, extension_data.data),
CBS_UNIT_TYPE_INTERNAL_REF(VVC_SUFFIX_APS_NUT, H266RawAPS, extension_data.data),
@@ -2083,11 +2059,6 @@ const CodedBitstreamType ff_cbs_type_h266 = {
.close = &cbs_h266_close,
};
// Macro for the read/write pair.
#define SEI_MESSAGE_RW(codec, name) \
.read = cbs_ ## codec ## _read_ ## name ## _internal, \
.write = cbs_ ## codec ## _write_ ## name ## _internal
static const SEIMessageTypeDescriptor cbs_sei_common_types[] = {
{
SEI_TYPE_FILLER_PAYLOAD,
+18 -17
View File
@@ -510,9 +510,9 @@ static int FUNC(pps)(CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(sei_buffering_period, (CodedBitstreamContext *ctx, RWContext *rw,
H264RawSEIBufferingPeriod *current,
SEIMessageState *sei))
static int FUNC(sei_buffering_period)(CodedBitstreamContext *ctx, RWContext *rw,
H264RawSEIBufferingPeriod *current,
SEIMessageState *sei)
{
CodedBitstreamH264Context *h264 = ctx->priv_data;
const H264RawSPS *sps;
@@ -604,8 +604,9 @@ static int FUNC(sei_pic_timestamp)(CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(sei_pic_timing, (CodedBitstreamContext *ctx, RWContext *rw,
H264RawSEIPicTiming *current, SEIMessageState *sei))
static int FUNC(sei_pic_timing)(CodedBitstreamContext *ctx, RWContext *rw,
H264RawSEIPicTiming *current,
SEIMessageState *sei)
{
CodedBitstreamH264Context *h264 = ctx->priv_data;
const H264RawSPS *sps;
@@ -675,9 +676,9 @@ SEI_FUNC(sei_pic_timing, (CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(sei_pan_scan_rect, (CodedBitstreamContext *ctx, RWContext *rw,
H264RawSEIPanScanRect *current,
SEIMessageState *sei))
static int FUNC(sei_pan_scan_rect)(CodedBitstreamContext *ctx, RWContext *rw,
H264RawSEIPanScanRect *current,
SEIMessageState *sei)
{
int err, i;
@@ -702,9 +703,9 @@ SEI_FUNC(sei_pan_scan_rect, (CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(sei_recovery_point, (CodedBitstreamContext *ctx, RWContext *rw,
H264RawSEIRecoveryPoint *current,
SEIMessageState *sei))
static int FUNC(sei_recovery_point)(CodedBitstreamContext *ctx, RWContext *rw,
H264RawSEIRecoveryPoint *current,
SEIMessageState *sei)
{
int err;
@@ -718,9 +719,9 @@ SEI_FUNC(sei_recovery_point, (CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(film_grain_characteristics, (CodedBitstreamContext *ctx, RWContext *rw,
H264RawFilmGrainCharacteristics *current,
SEIMessageState *state))
static int FUNC(film_grain_characteristics)(CodedBitstreamContext *ctx, RWContext *rw,
H264RawFilmGrainCharacteristics *current,
SEIMessageState *state)
{
CodedBitstreamH264Context *h264 = ctx->priv_data;
const H264RawSPS *sps;
@@ -801,9 +802,9 @@ SEI_FUNC(film_grain_characteristics, (CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(sei_display_orientation, (CodedBitstreamContext *ctx, RWContext *rw,
H264RawSEIDisplayOrientation *current,
SEIMessageState *sei))
static int FUNC(sei_display_orientation)(CodedBitstreamContext *ctx, RWContext *rw,
H264RawSEIDisplayOrientation *current,
SEIMessageState *sei)
{
int err;
+30 -28
View File
@@ -1618,9 +1618,9 @@ static int FUNC(slice_segment_header)(CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(sei_buffering_period, (CodedBitstreamContext *ctx, RWContext *rw,
H265RawSEIBufferingPeriod *current,
SEIMessageState *sei))
static int FUNC(sei_buffering_period)
(CodedBitstreamContext *ctx, RWContext *rw,
H265RawSEIBufferingPeriod *current, SEIMessageState *sei)
{
CodedBitstreamH265Context *h265 = ctx->priv_data;
const H265RawSPS *sps;
@@ -1728,8 +1728,9 @@ SEI_FUNC(sei_buffering_period, (CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(sei_pic_timing, (CodedBitstreamContext *ctx, RWContext *rw,
H265RawSEIPicTiming *current, SEIMessageState *sei))
static int FUNC(sei_pic_timing)
(CodedBitstreamContext *ctx, RWContext *rw,
H265RawSEIPicTiming *current, SEIMessageState *sei)
{
CodedBitstreamH265Context *h265 = ctx->priv_data;
const H265RawSPS *sps;
@@ -1803,9 +1804,9 @@ SEI_FUNC(sei_pic_timing, (CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(sei_pan_scan_rect, (CodedBitstreamContext *ctx, RWContext *rw,
H265RawSEIPanScanRect *current,
SEIMessageState *sei))
static int FUNC(sei_pan_scan_rect)
(CodedBitstreamContext *ctx, RWContext *rw,
H265RawSEIPanScanRect *current, SEIMessageState *sei)
{
int err, i;
@@ -1830,9 +1831,9 @@ SEI_FUNC(sei_pan_scan_rect, (CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(sei_recovery_point, (CodedBitstreamContext *ctx, RWContext *rw,
H265RawSEIRecoveryPoint *current,
SEIMessageState *sei))
static int FUNC(sei_recovery_point)
(CodedBitstreamContext *ctx, RWContext *rw,
H265RawSEIRecoveryPoint *current, SEIMessageState *sei)
{
int err;
@@ -1846,9 +1847,9 @@ SEI_FUNC(sei_recovery_point, (CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(film_grain_characteristics, (CodedBitstreamContext *ctx, RWContext *rw,
H265RawFilmGrainCharacteristics *current,
SEIMessageState *state))
static int FUNC(film_grain_characteristics)(CodedBitstreamContext *ctx, RWContext *rw,
H265RawFilmGrainCharacteristics *current,
SEIMessageState *state)
{
CodedBitstreamH265Context *h265 = ctx->priv_data;
const H265RawSPS *sps = h265->active_sps;
@@ -1911,9 +1912,9 @@ SEI_FUNC(film_grain_characteristics, (CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(sei_display_orientation, (CodedBitstreamContext *ctx, RWContext *rw,
H265RawSEIDisplayOrientation *current,
SEIMessageState *sei))
static int FUNC(sei_display_orientation)
(CodedBitstreamContext *ctx, RWContext *rw,
H265RawSEIDisplayOrientation *current, SEIMessageState *sei)
{
int err;
@@ -1930,9 +1931,9 @@ SEI_FUNC(sei_display_orientation, (CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(sei_active_parameter_sets, (CodedBitstreamContext *ctx, RWContext *rw,
H265RawSEIActiveParameterSets *current,
SEIMessageState *sei))
static int FUNC(sei_active_parameter_sets)
(CodedBitstreamContext *ctx, RWContext *rw,
H265RawSEIActiveParameterSets *current, SEIMessageState *sei)
{
CodedBitstreamH265Context *h265 = ctx->priv_data;
const H265RawVPS *vps;
@@ -1967,9 +1968,9 @@ SEI_FUNC(sei_active_parameter_sets, (CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(sei_decoded_picture_hash, (CodedBitstreamContext *ctx, RWContext *rw,
H265RawSEIDecodedPictureHash *current,
SEIMessageState *sei))
static int FUNC(sei_decoded_picture_hash)
(CodedBitstreamContext *ctx, RWContext *rw,
H265RawSEIDecodedPictureHash *current, SEIMessageState *sei)
{
CodedBitstreamH265Context *h265 = ctx->priv_data;
const H265RawSPS *sps = h265->active_sps;
@@ -1999,8 +2000,9 @@ SEI_FUNC(sei_decoded_picture_hash, (CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(sei_time_code, (CodedBitstreamContext *ctx, RWContext *rw,
H265RawSEITimeCode *current, SEIMessageState *sei))
static int FUNC(sei_time_code)
(CodedBitstreamContext *ctx, RWContext *rw,
H265RawSEITimeCode *current, SEIMessageState *sei)
{
int err, i;
@@ -2049,9 +2051,9 @@ SEI_FUNC(sei_time_code, (CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(sei_alpha_channel_info, (CodedBitstreamContext *ctx, RWContext *rw,
H265RawSEIAlphaChannelInfo *current,
SEIMessageState *sei))
static int FUNC(sei_alpha_channel_info)
(CodedBitstreamContext *ctx, RWContext *rw,
H265RawSEIAlphaChannelInfo *current, SEIMessageState *sei)
{
int err, length;
+29 -41
View File
@@ -902,17 +902,16 @@ static int FUNC(vps) (CodedBitstreamContext *ctx, RWContext *rw,
current->vps_ols_mode_idc == 1) {
num_layers_in_ols = i + 1;
} else if (current->vps_ols_mode_idc == 2) {
for (k = 0, j = 0; k <= current->vps_max_layers_minus1; k++)
for (k = 0, j = 0; k <= current->vps_max_layers_minus1; k++) {
if (layer_included_in_ols_flag[i][k])
j++;
num_layers_in_ols = j;
num_layers_in_ols = j;
}
}
if (num_layers_in_ols > 1) {
num_multi_layer_olss++;
}
}
if (!current->vps_each_layer_is_an_ols_flag && num_multi_layer_olss == 0)
return AVERROR_INVALIDDATA;
}
for (i = 0; i <= current->vps_num_ptls_minus1; i++) {
@@ -1130,7 +1129,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
flag(sps_subpic_info_present_flag);
if (current->sps_subpic_info_present_flag) {
ue(sps_num_subpics_minus1, 0, VVC_MAX_SLICES - 1);
ue(sps_num_subpics_minus1, 1, VVC_MAX_SLICES - 1);
if (current->sps_num_subpics_minus1 > 0) {
flag(sps_independent_subpics_flag);
flag(sps_subpic_same_size_flag);
@@ -1213,30 +1212,30 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
infer(sps_loop_filter_across_subpic_enabled_flag[i], 0);
}
}
ue(sps_subpic_id_len_minus1, 0, 15);
if ((1 << (current->sps_subpic_id_len_minus1 + 1)) <
current->sps_num_subpics_minus1 + 1) {
av_log(ctx->log_ctx, AV_LOG_ERROR,
"sps_subpic_id_len_minus1(%d) is too small\n",
current->sps_subpic_id_len_minus1);
return AVERROR_INVALIDDATA;
}
flag(sps_subpic_id_mapping_explicitly_signalled_flag);
if (current->sps_subpic_id_mapping_explicitly_signalled_flag) {
flag(sps_subpic_id_mapping_present_flag);
if (current->sps_subpic_id_mapping_present_flag) {
for (i = 0; i <= current->sps_num_subpics_minus1; i++) {
ubs(current->sps_subpic_id_len_minus1 + 1,
sps_subpic_id[i], 1, i);
}
}
}
} else {
infer(sps_subpic_ctu_top_left_x[0], 0);
infer(sps_subpic_ctu_top_left_y[0], 0);
infer(sps_subpic_width_minus1[0], tmp_width_val - 1);
infer(sps_subpic_height_minus1[0], tmp_height_val - 1);
}
ue(sps_subpic_id_len_minus1, 0, 15);
if ((1 << (current->sps_subpic_id_len_minus1 + 1)) <
current->sps_num_subpics_minus1 + 1) {
av_log(ctx->log_ctx, AV_LOG_ERROR,
"sps_subpic_id_len_minus1(%d) is too small\n",
current->sps_subpic_id_len_minus1);
return AVERROR_INVALIDDATA;
}
flag(sps_subpic_id_mapping_explicitly_signalled_flag);
if (current->sps_subpic_id_mapping_explicitly_signalled_flag) {
flag(sps_subpic_id_mapping_present_flag);
if (current->sps_subpic_id_mapping_present_flag) {
for (i = 0; i <= current->sps_num_subpics_minus1; i++) {
ubs(current->sps_subpic_id_len_minus1 + 1,
sps_subpic_id[i], 1, i);
}
}
}
} else {
infer(sps_num_subpics_minus1, 0);
infer(sps_independent_subpics_flag, 1);
@@ -2044,12 +2043,9 @@ static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw,
}
if (i < current->pps_num_slices_in_pic_minus1) {
if (current->pps_tile_idx_delta_present_flag) {
// Two conditions must be met:
// 1. NumTilesInPic + 1 <= pps_tile_idx_delta_val[i] <= NumTilesInPic 1
// 2. 0 <= tile_idx + pps_tile_idx_delta_val[i] <= NumTilesInPic 1
// Combining these conditions yields: -tile_idx <= pps_tile_idx_delta_val[i] <= NumTilesInPic - 1 - tile_idx
ses(pps_tile_idx_delta_val[i],
-tile_idx, current->num_tiles_in_pic - 1 - tile_idx, 1, i);
-current->num_tiles_in_pic + 1,
current->num_tiles_in_pic - 1, 1, i);
if (current->pps_tile_idx_delta_val[i] == 0) {
av_log(ctx->log_ctx, AV_LOG_ERROR,
"pps_tile_idx_delta_val[i] shall not be equal to 0.\n");
@@ -2072,8 +2068,6 @@ static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw,
tile_x = tile_idx % current->num_tile_columns;
tile_y = tile_idx / current->num_tile_columns;
if (tile_y >= current->num_tile_rows)
return AVERROR_INVALIDDATA;
ctu_x = 0, ctu_y = 0;
for (j = 0; j < tile_x; j++) {
@@ -2458,7 +2452,6 @@ static int FUNC(scaling_list_data)(CodedBitstreamContext *ctx, RWContext *rw,
static int FUNC(aps)(CodedBitstreamContext *ctx, RWContext *rw,
H266RawAPS *current, int prefix)
{
int aps_id_max = MAX_UINT_BITS(5);
int err;
if (prefix)
@@ -2471,12 +2464,7 @@ static int FUNC(aps)(CodedBitstreamContext *ctx, RWContext *rw,
: VVC_SUFFIX_APS_NUT));
ub(3, aps_params_type);
if (current->aps_params_type == VVC_ASP_TYPE_ALF ||
current->aps_params_type == VVC_ASP_TYPE_SCALING)
aps_id_max = 7;
else if (current->aps_params_type == VVC_ASP_TYPE_LMCS)
aps_id_max = 3;
u(5, aps_adaptation_parameter_set_id, 0, aps_id_max);
ub(5, aps_adaptation_parameter_set_id);
flag(aps_chroma_present_flag);
if (current->aps_params_type == VVC_ASP_TYPE_ALF)
CHECK(FUNC(alf_data)(ctx, rw, current));
@@ -3430,10 +3418,10 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(sei_decoded_picture_hash, (CodedBitstreamContext *ctx,
RWContext *rw,
H266RawSEIDecodedPictureHash *current,
SEIMessageState *unused))
static int FUNC(sei_decoded_picture_hash) (CodedBitstreamContext *ctx,
RWContext *rw,
H266RawSEIDecodedPictureHash *
current)
{
int err, c_idx, i;
+2 -2
View File
@@ -145,13 +145,13 @@ static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx,
}
} else {
i = start;
if (i > frag->data_size - 2) {
if (i + 2 > frag->data_size) {
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid JPEG image: "
"truncated at %02x marker.\n", marker);
return AVERROR_INVALIDDATA;
}
length = AV_RB16(frag->data + i);
if (length > frag->data_size - i) {
if (i + length > frag->data_size) {
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid JPEG image: "
"truncated at %02x marker segment.\n", marker);
return AVERROR_INVALIDDATA;
+7
View File
@@ -126,6 +126,13 @@ typedef struct SEIMessageTypeDescriptor {
SEIMessageWriteFunction write;
} SEIMessageTypeDescriptor;
// Macro for the read/write pair. The clumsy cast is needed because the
// current pointer is typed in all of the read/write functions but has to
// be void here to fit all cases.
#define SEI_MESSAGE_RW(codec, name) \
.read = (SEIMessageReadFunction) cbs_ ## codec ## _read_ ## name, \
.write = (SEIMessageWriteFunction)cbs_ ## codec ## _write_ ## name
// End-of-list sentinel element.
#define SEI_MESSAGE_TYPE_END { .type = -1 }
+23 -24
View File
@@ -16,9 +16,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
SEI_FUNC(filler_payload, (CodedBitstreamContext *ctx, RWContext *rw,
SEIRawFillerPayload *current,
SEIMessageState *state))
static int FUNC(filler_payload)
(CodedBitstreamContext *ctx, RWContext *rw,
SEIRawFillerPayload *current, SEIMessageState *state)
{
int err, i;
@@ -34,9 +34,9 @@ SEI_FUNC(filler_payload, (CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(user_data_registered, (CodedBitstreamContext *ctx, RWContext *rw,
SEIRawUserDataRegistered *current,
SEIMessageState *state))
static int FUNC(user_data_registered)
(CodedBitstreamContext *ctx, RWContext *rw,
SEIRawUserDataRegistered *current, SEIMessageState *state)
{
int err, i, j;
@@ -66,9 +66,9 @@ SEI_FUNC(user_data_registered, (CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(user_data_unregistered, (CodedBitstreamContext *ctx, RWContext *rw,
SEIRawUserDataUnregistered *current,
SEIMessageState *state))
static int FUNC(user_data_unregistered)
(CodedBitstreamContext *ctx, RWContext *rw,
SEIRawUserDataUnregistered *current, SEIMessageState *state)
{
int err, i;
@@ -94,10 +94,9 @@ SEI_FUNC(user_data_unregistered, (CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(mastering_display_colour_volume,
(CodedBitstreamContext *ctx, RWContext *rw,
SEIRawMasteringDisplayColourVolume *current,
SEIMessageState *state))
static int FUNC(mastering_display_colour_volume)
(CodedBitstreamContext *ctx, RWContext *rw,
SEIRawMasteringDisplayColourVolume *current, SEIMessageState *state)
{
int err, c;
@@ -117,9 +116,9 @@ SEI_FUNC(mastering_display_colour_volume,
return 0;
}
SEI_FUNC(content_light_level_info, (CodedBitstreamContext *ctx, RWContext *rw,
SEIRawContentLightLevelInfo *current,
SEIMessageState *state))
static int FUNC(content_light_level_info)
(CodedBitstreamContext *ctx, RWContext *rw,
SEIRawContentLightLevelInfo *current, SEIMessageState *state)
{
int err;
@@ -131,10 +130,10 @@ SEI_FUNC(content_light_level_info, (CodedBitstreamContext *ctx, RWContext *rw,
return 0;
}
SEI_FUNC(alternative_transfer_characteristics,
(CodedBitstreamContext *ctx, RWContext *rw,
SEIRawAlternativeTransferCharacteristics *current,
SEIMessageState *state))
static int FUNC(alternative_transfer_characteristics)
(CodedBitstreamContext *ctx, RWContext *rw,
SEIRawAlternativeTransferCharacteristics *current,
SEIMessageState *state)
{
int err;
@@ -145,10 +144,10 @@ SEI_FUNC(alternative_transfer_characteristics,
return 0;
}
SEI_FUNC(ambient_viewing_environment,
(CodedBitstreamContext *ctx, RWContext *rw,
SEIRawAmbientViewingEnvironment *current,
SEIMessageState *state))
static int FUNC(ambient_viewing_environment)
(CodedBitstreamContext *ctx, RWContext *rw,
SEIRawAmbientViewingEnvironment *current,
SEIMessageState *state)
{
static const uint16_t max_ambient_light_value = 50000;
int err;
+4 -3
View File
@@ -258,8 +258,8 @@ static av_cold int cfhd_encode_init(AVCodecContext *avctx)
if (ret < 0)
return ret;
if (avctx->height < 32) {
av_log(avctx, AV_LOG_ERROR, "Height must be >= 32.\n");
if (avctx->height < 4) {
av_log(avctx, AV_LOG_ERROR, "Height must be >= 4.\n");
return AVERROR_INVALIDDATA;
}
@@ -553,7 +553,7 @@ static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
width, height * 2);
}
ret = ff_alloc_packet(avctx, pkt, 256LL + s->planes * (4LL * avctx->width * (avctx->height + 15) + 2048LL));
ret = ff_alloc_packet(avctx, pkt, 256LL + s->planes * (2LL * avctx->width * (avctx->height + 15) + 2048LL));
if (ret < 0)
return ret;
@@ -761,6 +761,7 @@ static int cfhd_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
} else if (count > 0) {
count = put_runcode(pb, count, rb);
}
put_bits(pb, cb[index].size, cb[index].bits);
}
-4
View File
@@ -235,14 +235,10 @@ static int cri_decode_frame(AVCodecContext *avctx, AVFrame *p,
s->data_size = length;
goto skip;
case 105:
if (length <= 0)
return AVERROR_INVALIDDATA;
hflip = bytestream2_get_byte(gb) != 0;
length--;
goto skip;
case 106:
if (length <= 0)
return AVERROR_INVALIDDATA;
vflip = bytestream2_get_byte(gb) != 0;
length--;
goto skip;
+6 -16
View File
@@ -449,8 +449,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
} else if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) {
ret = !got_frame ? AVERROR(EAGAIN)
: discard_samples(avctx, frame, discarded_samples);
} else
av_assert0(0);
}
if (ret == AVERROR(EAGAIN))
av_frame_unref(frame);
@@ -1839,26 +1838,17 @@ int ff_copy_palette(void *dst, const AVPacket *src, void *logctx)
int ff_hwaccel_frame_priv_alloc(AVCodecContext *avctx, void **hwaccel_picture_private)
{
const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel);
AVHWFramesContext *frames_ctx;
if (!hwaccel || !hwaccel->frame_priv_data_size)
return 0;
av_assert0(!*hwaccel_picture_private);
if (hwaccel->free_frame_priv) {
AVHWFramesContext *frames_ctx;
if (!avctx->hw_frames_ctx)
return AVERROR(EINVAL);
frames_ctx = (AVHWFramesContext *) avctx->hw_frames_ctx->data;
*hwaccel_picture_private = ff_refstruct_alloc_ext(hwaccel->frame_priv_data_size, 0,
frames_ctx->device_ctx,
hwaccel->free_frame_priv);
} else {
*hwaccel_picture_private = ff_refstruct_allocz(hwaccel->frame_priv_data_size);
}
frames_ctx = (AVHWFramesContext *)avctx->hw_frames_ctx->data;
*hwaccel_picture_private = ff_refstruct_alloc_ext(hwaccel->frame_priv_data_size, 0,
frames_ctx->device_ctx,
hwaccel->free_frame_priv);
if (!*hwaccel_picture_private)
return AVERROR(ENOMEM);
+2 -2
View File
@@ -149,7 +149,7 @@ static inline uint64_t get_ue_coef(GetBitContext *gb, const AVDOVIRpuDataHeader
case RPU_COEFF_FLOAT:
fpart.u32 = get_bits_long(gb, 32);
return fpart.f32 * (1LL << hdr->coef_log2_denom);
return fpart.f32 * (1 << hdr->coef_log2_denom);
}
return 0; /* unreachable */
@@ -168,7 +168,7 @@ static inline int64_t get_se_coef(GetBitContext *gb, const AVDOVIRpuDataHeader *
case RPU_COEFF_FLOAT:
fpart.u32 = get_bits_long(gb, 32);
return fpart.f32 * (1LL << hdr->coef_log2_denom);
return fpart.f32 * (1 << hdr->coef_log2_denom);
}
return 0; /* unreachable */
+1 -2
View File
@@ -376,8 +376,7 @@ static int encode_dvd_subtitles(AVCodecContext *avctx,
x2 = vrect.x + vrect.w - 1;
y2 = vrect.y + vrect.h - 1;
if ((avctx->width > 0 && x2 > avctx->width) ||
(avctx->height > 0 && y2 > avctx->height)) {
if (x2 > avctx->width || y2 > avctx->height) {
av_log(avctx, AV_LOG_ERROR, "canvas_size(%d:%d) is too small(%d:%d) for render\n",
avctx->width, avctx->height, x2, y2);
ret = AVERROR(EINVAL);
+1 -1
View File
@@ -440,7 +440,7 @@ static int get_opcodes(GetByteContext *gb, uint32_t *table, uint8_t *dst, int op
size_in_bits = bytestream2_get_le32(gb);
endoffset = ((size_in_bits + 7) >> 3) - 4;
if ((int)endoffset <= 0 || bytestream2_get_bytes_left(gb) < endoffset)
if (endoffset <= 0 || bytestream2_get_bytes_left(gb) < endoffset)
return AVERROR_INVALIDDATA;
offset = endoffset;
+6 -15
View File
@@ -58,12 +58,8 @@ int ff_evc_parse_slice_header(GetBitContext *gb, EVCParserSliceHeader *sh,
if (!sh->arbitrary_slice_flag)
sh->last_tile_id = get_bits(gb, pps->tile_id_len_minus1 + 1);
else {
unsigned num_remaining_tiles_in_slice_minus1 = get_ue_golomb_long(gb);
if (num_remaining_tiles_in_slice_minus1 > EVC_MAX_TILE_ROWS * EVC_MAX_TILE_COLUMNS - 2)
return AVERROR_INVALIDDATA;
num_tiles_in_slice = num_remaining_tiles_in_slice_minus1 + 2;
sh->num_remaining_tiles_in_slice_minus1 = num_remaining_tiles_in_slice_minus1;
sh->num_remaining_tiles_in_slice_minus1 = get_ue_golomb_long(gb);
num_tiles_in_slice = sh->num_remaining_tiles_in_slice_minus1 + 2;
for (int i = 0; i < num_tiles_in_slice - 1; ++i)
sh->delta_tile_id_minus1[i] = get_ue_golomb_long(gb);
}
@@ -176,11 +172,7 @@ int ff_evc_derive_poc(const EVCParamSets *ps, const EVCParserSliceHeader *sh,
poc->PicOrderCntVal = 0;
poc->DocOffset = -1;
} else {
int SubGopLength = 1 << sps->log2_sub_gop_length;
if (tid > (SubGopLength > 1 ? 1 + av_log2(SubGopLength - 1) : 0))
return AVERROR_INVALIDDATA;
int SubGopLength = (int)pow(2.0, sps->log2_sub_gop_length);
if (tid == 0) {
poc->PicOrderCntVal = poc->prevPicOrderCntVal + SubGopLength;
poc->DocOffset = 0;
@@ -195,16 +187,15 @@ int ff_evc_derive_poc(const EVCParamSets *ps, const EVCParserSliceHeader *sh,
poc->prevPicOrderCntVal += SubGopLength;
ExpectedTemporalId = 0;
} else
ExpectedTemporalId = 1 + av_log2(poc->DocOffset);
ExpectedTemporalId = 1 + (int)log2(poc->DocOffset);
while (tid != ExpectedTemporalId) {
poc->DocOffset = (poc->DocOffset + 1) % SubGopLength;
if (poc->DocOffset == 0)
ExpectedTemporalId = 0;
else
ExpectedTemporalId = 1 + av_log2(poc->DocOffset);
ExpectedTemporalId = 1 + (int)log2(poc->DocOffset);
}
PocOffset = (int)(SubGopLength * ((2.0 * poc->DocOffset + 1) / (1 << tid) - 2));
PocOffset = (int)(SubGopLength * ((2.0 * poc->DocOffset + 1) / (int)pow(2.0, tid) - 2));
poc->PicOrderCntVal = poc->prevPicOrderCntVal + PocOffset;
}
}
+2 -5
View File
@@ -334,10 +334,7 @@ static int huf_unpack_enc_table(GetByteContext *gb,
return ret;
for (; im <= iM; im++) {
int l;
if (get_bits_left(&gbit) < 6)
return AVERROR_INVALIDDATA;
l = freq[im] = get_bits(&gbit, 6);
uint64_t l = freq[im] = get_bits(&gbit, 6);
if (l == LONG_ZEROCODE_RUN) {
int zerun = get_bits(&gbit, 8) + SHORTEST_LONG_RUN;
@@ -1942,7 +1939,7 @@ static int decode_header(EXRContext *s, AVFrame *frame)
"preview", 16)) >= 0) {
uint32_t pw = bytestream2_get_le32(gb);
uint32_t ph = bytestream2_get_le32(gb);
uint64_t psize = pw * (uint64_t)ph;
uint64_t psize = pw * ph;
if (psize > INT64_MAX / 4) {
ret = AVERROR_INVALIDDATA;
goto fail;
-2
View File
@@ -519,8 +519,6 @@ static int check_header_mismatch(FLACParseContext *fpc,
for (i = 0; i < FLAC_MAX_SEQUENTIAL_HEADERS && curr != child; i++)
curr = curr->next;
av_assert0(i < FLAC_MAX_SEQUENTIAL_HEADERS);
if (header->link_penalty[i] < FLAC_HEADER_CRC_FAIL_PENALTY ||
header->link_penalty[i] == FLAC_HEADER_NOT_PENALIZED_YET) {
FLACHeaderMarker *start, *end;
+3 -3
View File
@@ -642,7 +642,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
"has incorrect size, skipping chunk\n", chunk_size - 6);
bytestream2_skip(&g2, chunk_size - 6);
} else {
for (y_ptr = 0; check_pixel_ptr(y_ptr, s->avctx->width, pixel_limit, direction) == 0;
for (y_ptr = 0; check_pixel_ptr(y_ptr, 0, pixel_limit, direction) == 0;
y_ptr += s->frame->linesize[0]) {
bytestream2_get_buffer(&g2, &pixels[y_ptr],
s->avctx->width);
@@ -949,7 +949,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
if (bytestream2_get_bytes_left(&g2) < 2 * s->avctx->width * s->avctx->height )
return AVERROR_INVALIDDATA;
for (y_ptr = 0; check_pixel_ptr(y_ptr, 2*s->avctx->width, pixel_limit, direction) == 0;
for (y_ptr = 0; check_pixel_ptr(y_ptr, 0, pixel_limit, direction) == 0;
y_ptr += s->frame->linesize[0]) {
pixel_countdown = s->avctx->width;
@@ -1235,7 +1235,7 @@ static int flic_decode_frame_24BPP(AVCodecContext *avctx,
"bigger than image, skipping chunk\n", chunk_size - 6);
bytestream2_skip(&g2, chunk_size - 6);
} else {
for (y_ptr = 0; check_pixel_ptr(y_ptr, 3*s->avctx->width, pixel_limit, direction) == 0;
for (y_ptr = 0; check_pixel_ptr(y_ptr, 0, pixel_limit, direction) == 0;
y_ptr += s->frame->linesize[0]) {
bytestream2_get_buffer(&g2, pixels + y_ptr, 3*s->avctx->width);
+1
View File
@@ -100,6 +100,7 @@ static int decode_type2(GetByteContext *gb, PutByteContext *pb)
continue;
}
}
repeat = 0;
}
repeat = 1;
}
-5
View File
@@ -402,7 +402,6 @@ static inline int get_ur_golomb(GetBitContext *gb, int k, int limit,
log = av_log2(buf);
if (log > 31 - limit) {
av_assert2(log >= k);
buf >>= log - k;
buf += (30U - log) << k;
LAST_SKIP_BITS(re, gb, 32 + k - log);
@@ -425,8 +424,6 @@ static inline int get_ur_golomb(GetBitContext *gb, int k, int limit,
/**
* read unsigned golomb rice code (jpegls).
*
* @returns -1 on error
*/
static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit,
int esc_len)
@@ -538,8 +535,6 @@ static inline int get_sr_golomb(GetBitContext *gb, int k, int limit,
/**
* read signed golomb rice code (flac).
*
* @returns INT_MIN on error
*/
static inline int get_sr_golomb_flac(GetBitContext *gb, int k, int limit,
int esc_len)
+4 -2
View File
@@ -599,7 +599,8 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei,
if (!sd)
av_buffer_unref(&a53->buf_ref);
a53->buf_ref = NULL;
avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
if (avctx)
avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
}
for (unsigned i = 0; i < sei->unregistered.nb_buf_ref; i++) {
@@ -685,7 +686,8 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei,
else
fgc->present = fgc->persistence_flag;
avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;
if (avctx)
avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;
}
if (sei->ambient_viewing_environment.present) {
+1 -1
View File
@@ -1398,7 +1398,7 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl,
sps = h->ps.sps;
if (sps->bitstream_restriction_flag &&
if (sps && sps->bitstream_restriction_flag &&
h->avctx->has_b_frames < sps->num_reorder_frames) {
h->avctx->has_b_frames = sps->num_reorder_frames;
}
+3 -7
View File
@@ -212,7 +212,6 @@ static int init_hca(AVCodecContext *avctx, const uint8_t *extradata,
int8_t r[16] = { 0 };
unsigned b, chunk;
int version, ret;
unsigned hfr_group_count;
init_flush(avctx);
@@ -337,12 +336,11 @@ static int init_hca(AVCodecContext *avctx, const uint8_t *extradata,
if (c->total_band_count < c->base_band_count)
return AVERROR_INVALIDDATA;
hfr_group_count = ceil2(c->total_band_count - (c->base_band_count + c->stereo_band_count),
c->hfr_group_count = ceil2(c->total_band_count - (c->base_band_count + c->stereo_band_count),
c->bands_per_hfr_group);
if (c->base_band_count + c->stereo_band_count + (uint64_t)hfr_group_count > 128ULL)
if (c->base_band_count + c->stereo_band_count + (unsigned long)c->hfr_group_count > 128ULL)
return AVERROR_INVALIDDATA;
c->hfr_group_count = hfr_group_count;
for (int i = 0; i < avctx->ch_layout.nb_channels; i++) {
c->ch[i].chan_type = r[i];
@@ -538,10 +536,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
return AVERROR_INVALIDDATA;
} else if (AV_RB16(avpkt->data + 6) <= avpkt->size) {
ret = init_hca(avctx, avpkt->data, AV_RB16(avpkt->data + 6));
if (ret < 0) {
c->crc_table = NULL; // signal that init has not finished
if (ret < 0)
return ret;
}
offset = AV_RB16(avpkt->data + 6);
if (offset == avpkt->size)
return avpkt->size;
+1 -1
View File
@@ -124,7 +124,7 @@ static int hdr_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
uint8_t *buf;
int ret;
packet_size = avctx->height * 4LL + avctx->width * avctx->height * 8LL + 1024LL;
packet_size = avctx->width * avctx->height * 4LL + 1024LL;
if ((ret = ff_get_encode_buffer(avctx, pkt, packet_size, 0)) < 0)
return ret;
+6 -10
View File
@@ -651,10 +651,6 @@ static int hls_slice_header(HEVCContext *s)
if (s->ps.pps->dependent_slice_segments_enabled_flag)
sh->dependent_slice_segment_flag = get_bits1(gb);
if (sh->dependent_slice_segment_flag && !s->slice_initialized) {
av_log(s->avctx, AV_LOG_ERROR, "Independent slice segment missing.\n");
return AVERROR_INVALIDDATA;
}
slice_address_length = av_ceil_log2(s->ps.sps->ctb_width *
s->ps.sps->ctb_height);
@@ -943,6 +939,9 @@ static int hls_slice_header(HEVCContext *s)
} else {
sh->slice_loop_filter_across_slices_enabled_flag = s->ps.pps->seq_loop_filter_across_slices_enabled_flag;
}
} else if (!s->slice_initialized) {
av_log(s->avctx, AV_LOG_ERROR, "Independent slice segment missing.\n");
return AVERROR_INVALIDDATA;
}
sh->num_entry_point_offsets = 0;
@@ -1962,13 +1961,13 @@ static void hls_prediction_unit(HEVCLocalContext *lc, int x0, int y0,
if (current_mv.pred_flag & PF_L0) {
ref0 = refPicList[0].ref[current_mv.ref_idx[0]];
if (!ref0 || !ref0->frame)
if (!ref0 || !ref0->frame->data[0])
return;
hevc_await_progress(s, ref0, &current_mv.mv[0], y0, nPbH);
}
if (current_mv.pred_flag & PF_L1) {
ref1 = refPicList[1].ref[current_mv.ref_idx[1]];
if (!ref1 || !ref1->frame)
if (!ref1 || !ref1->frame->data[0])
return;
hevc_await_progress(s, ref1, &current_mv.mv[1], y0, nPbH);
}
@@ -3016,11 +3015,8 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
case HEVC_NAL_RASL_N:
case HEVC_NAL_RASL_R:
ret = hls_slice_header(s);
if (ret < 0) {
// hls_slice_header() does not cleanup on failure thus the state now is inconsistant so we cannot use it on depandant slices
s->slice_initialized = 0;
if (ret < 0)
return ret;
}
if (ret == 1) {
ret = AVERROR_INVALIDDATA;
goto fail;
+2 -2
View File
@@ -522,7 +522,7 @@ static int decode_byterun2(uint8_t *dst, int height, int line_size,
GetByteContext *gb)
{
GetByteContext cmds;
int count;
unsigned count;
int i, y_pos = 0, x_pos = 0;
if (bytestream2_get_be32(gb) != MKBETAG('V', 'D', 'A', 'T'))
@@ -530,7 +530,7 @@ static int decode_byterun2(uint8_t *dst, int height, int line_size,
bytestream2_skip(gb, 4);
count = bytestream2_get_be16(gb) - 2;
if (count < 0 || bytestream2_get_bytes_left(gb) < count)
if (bytestream2_get_bytes_left(gb) < count)
return 0;
bytestream2_init(&cmds, gb->buffer, count);
+6
View File
@@ -1095,6 +1095,12 @@ static void do_plc(int16_t *plc_residual, /* (o) concealed residual */
if (s->consPLICount * s->block_samples > 320) {
use_gain = 29491; /* 0.9 in Q15 */
} else if (s->consPLICount * s->block_samples > 640) {
use_gain = 22938; /* 0.7 in Q15 */
} else if (s->consPLICount * s->block_samples > 960) {
use_gain = 16384; /* 0.5 in Q15 */
} else if (s->consPLICount * s->block_samples > 1280) {
use_gain = 0; /* 0.0 in Q15 */
}
/* Compute mixing factor of picth repeatition and noise:
+2 -9
View File
@@ -219,15 +219,12 @@ static int decode_intra(AVCodecContext *avctx, GetBitContext *gb, AVFrame *frame
for (y = 0; y < avctx->height; y += 16) {
for (x = 0; x < avctx->width; x += 16) {
unsigned flag, cbplo;
int cbphi;
unsigned flag, cbphi, cbplo;
cbplo = get_vlc2(gb, cbplo_tab.table, CBPLO_VLC_BITS, 1);
flag = get_bits1(gb);
cbphi = get_cbphi(gb, 1);
if (cbphi < 0)
return cbphi;
ret = decode_blocks(avctx, gb, cbplo | (cbphi << 2), 0, offset, flag);
if (ret < 0)
@@ -275,8 +272,7 @@ static int decode_inter(AVCodecContext *avctx, GetBitContext *gb,
for (y = 0; y < avctx->height; y += 16) {
for (x = 0; x < avctx->width; x += 16) {
int reverse, intra_block, value;
unsigned cbplo, flag2 = 0;
int cbphi;
unsigned cbphi, cbplo, flag2 = 0;
if (get_bits1(gb)) {
copy_block16(frame->data[0] + y * frame->linesize[0] + x,
@@ -302,9 +298,6 @@ static int decode_inter(AVCodecContext *avctx, GetBitContext *gb,
cbplo = value >> 4;
cbphi = get_cbphi(gb, reverse);
if (cbphi < 0)
return cbphi;
if (intra_block) {
ret = decode_blocks(avctx, gb, cbplo | (cbphi << 2), 0, offset, flag2);
if (ret < 0)
-3
View File
@@ -171,9 +171,6 @@ static av_cold int allocate_frame_buffers(Indeo3DecodeContext *ctx,
int luma_size, chroma_size;
ptrdiff_t luma_pitch, chroma_pitch;
luma_width = FFALIGN(luma_width , 2);
luma_height = FFALIGN(luma_height, 2);
if (luma_width < 16 || luma_width > 640 ||
luma_height < 16 || luma_height > 480 ||
luma_width & 1 || luma_height & 1) {
+4 -5
View File
@@ -1348,7 +1348,7 @@ static void makelayers(Jpeg2000EncoderContext *s, Jpeg2000Tile *tile)
}
}
static int getcut(Jpeg2000Cblk *cblk, uint64_t lambda)
static int getcut(Jpeg2000Cblk *cblk, uint64_t lambda, int dwt_norm)
{
int passno, res = 0;
for (passno = 0; passno < cblk->npasses; passno++){
@@ -1360,7 +1360,7 @@ static int getcut(Jpeg2000Cblk *cblk, uint64_t lambda)
dd = cblk->passes[passno].disto
- (res ? cblk->passes[res-1].disto : 0);
if (dd >= dr * lambda)
if (((dd * dwt_norm) >> WMSEDEC_SHIFT) * dwt_norm >= dr * lambda)
res = passno+1;
}
return res;
@@ -1383,12 +1383,11 @@ static void truncpasses(Jpeg2000EncoderContext *s, Jpeg2000Tile *tile)
Jpeg2000Band *band = reslevel->band + bandno;
Jpeg2000Prec *prec = band->prec + precno;
int64_t dwt_norm = dwt_norms[codsty->transform == FF_DWT53][bandpos][lev] * (int64_t)band->i_stepsize >> 15;
int64_t lambda_prime = av_rescale(s->lambda, 1 << WMSEDEC_SHIFT, dwt_norm * dwt_norm);
for (cblkno = 0; cblkno < prec->nb_codeblocks_height * prec->nb_codeblocks_width; cblkno++){
Jpeg2000Cblk *cblk = prec->cblk + cblkno;
cblk->ninclpasses = getcut(cblk, lambda_prime);
cblk->ninclpasses = getcut(cblk, s->lambda,
(int64_t)dwt_norms[codsty->transform == FF_DWT53][bandpos][lev] * (int64_t)band->i_stepsize >> 15);
cblk->layers[0].data_start = cblk->data;
cblk->layers[0].cum_passes = cblk->ninclpasses;
cblk->layers[0].npasses = cblk->ninclpasses;
+3 -3
View File
@@ -69,7 +69,7 @@
#define GLOBAL(x) x
#define RIGHT_SHIFT(x, n) ((x) >> (n))
#define MULTIPLY16C16(var,const) ((var)*(const))
#define DESCALE(x,n) RIGHT_SHIFT((int)(x) + (1 << ((n) - 1)), n)
#define DESCALE(x,n) RIGHT_SHIFT((x) + (1 << ((n) - 1)), n)
/*
@@ -175,7 +175,7 @@
#if BITS_IN_JSAMPLE == 8 && CONST_BITS<=13 && PASS1_BITS<=2
#define MULTIPLY(var,const) MULTIPLY16C16(var,const)
#else
#define MULTIPLY(var,const) (int)((var) * (unsigned)(const))
#define MULTIPLY(var,const) ((var) * (const))
#endif
@@ -261,7 +261,7 @@ FUNC(ff_jpeg_fdct_islow)(int16_t *data)
{
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int tmp10, tmp11, tmp12, tmp13;
unsigned z1, z2, z3, z4, z5;
int z1, z2, z3, z4, z5;
int16_t *dataptr;
int ctr;
+7 -12
View File
@@ -834,6 +834,9 @@ static int get_tlm(Jpeg2000DecoderContext *s, int n)
case 2:
bytestream2_get_be16(&s->g);
break;
case 3:
bytestream2_get_be32(&s->g);
break;
}
if (SP == 0) {
bytestream2_get_be16(&s->g);
@@ -1884,7 +1887,7 @@ static inline void roi_scale_cblk(Jpeg2000Cblk *cblk,
}
}
static inline int tile_codeblocks(const Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)
static inline void tile_codeblocks(const Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)
{
Jpeg2000T1Context t1;
@@ -1909,8 +1912,6 @@ static inline int tile_codeblocks(const Jpeg2000DecoderContext *s, Jpeg2000Tile
int nb_precincts, precno;
Jpeg2000Band *band = rlevel->band + bandno;
int cblkno = 0, bandpos;
/* See Rec. ITU-T T.800, Equation E-2 */
int magp = quantsty->expn[subbandno] + quantsty->nguardbits - 1;
bandpos = bandno + (reslevelno > 0);
@@ -1918,11 +1919,6 @@ static inline int tile_codeblocks(const Jpeg2000DecoderContext *s, Jpeg2000Tile
band->coord[1][0] == band->coord[1][1])
continue;
if ((codsty->cblk_style & JPEG2000_CTSY_HTJ2K_F) && magp >= 31) {
avpriv_request_sample(s->avctx, "JPEG2000_CTSY_HTJ2K_F and magp >= 31");
return AVERROR_PATCHWELCOME;
}
nb_precincts = rlevel->num_precincts_x * rlevel->num_precincts_y;
/* Loop on precincts */
for (precno = 0; precno < nb_precincts; precno++) {
@@ -1933,6 +1929,8 @@ static inline int tile_codeblocks(const Jpeg2000DecoderContext *s, Jpeg2000Tile
cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height;
cblkno++) {
int x, y, ret;
/* See Rec. ITU-T T.800, Equation E-2 */
int magp = quantsty->expn[subbandno] + quantsty->nguardbits - 1;
Jpeg2000Cblk *cblk = prec->cblk + cblkno;
@@ -1972,7 +1970,6 @@ static inline int tile_codeblocks(const Jpeg2000DecoderContext *s, Jpeg2000Tile
ff_dwt_decode(&comp->dwt, codsty->transform == FF_DWT97 ? (void*)comp->f_data : (void*)comp->i_data);
} /*end comp */
return 0;
}
#define WRITE_FRAME(D, PIXEL) \
@@ -2049,9 +2046,7 @@ static int jpeg2000_decode_tile(AVCodecContext *avctx, void *td,
AVFrame *picture = td;
Jpeg2000Tile *tile = s->tile + jobnr;
int ret = tile_codeblocks(s, tile);
if (ret < 0)
return ret;
tile_codeblocks(s, tile);
/* inverse MCT transformation */
if (tile->codsty[0].mct)
+6 -39
View File
@@ -567,19 +567,11 @@ static int jpeg2000_decode_ht_cleanup_segment(const Jpeg2000DecoderContext *s,
uint64_t c;
uint8_t *sigma, *sigma_n, *E;
uint32_t *mu, *mu_n;
uint8_t *sigma;
uint32_t *mu;
const uint8_t *vlc_buf = Dcup + Pcup;
/*
* Bound on the precision needed to process the codeblock. The number of
* decoded bit planes is equal to at most cblk->zbp + 2 since S_blk = P if
* there are no placeholder passes or HT Sets and P = cblk->zbp. See Rec.
* ITU-T T.814, 7.6.
*/
int maxbp = cblk->zbp + 2;
/* convert to raster-scan */
const uint16_t is_border_x = width % 2;
const uint16_t is_border_y = height % 2;
@@ -589,13 +581,9 @@ static int jpeg2000_decode_ht_cleanup_segment(const Jpeg2000DecoderContext *s,
size_t buf_size = 4 * quad_width * quad_height;
/* do we have enough precision, assuming a 32-bit decoding path */
if (maxbp >= 32)
return AVERROR_INVALIDDATA;
sigma_n = av_calloc(buf_size, sizeof(uint8_t));
E = av_calloc(buf_size, sizeof(uint8_t));
mu_n = av_calloc(buf_size, sizeof(uint32_t));
uint8_t *sigma_n = av_calloc(buf_size, sizeof(uint8_t));
uint8_t *E = av_calloc(buf_size, sizeof(uint8_t));
uint32_t *mu_n = av_calloc(buf_size, sizeof(uint32_t));
if (!sigma_n || !E || !mu_n) {
ret = AVERROR(ENOMEM);
@@ -688,10 +676,6 @@ static int jpeg2000_decode_ht_cleanup_segment(const Jpeg2000DecoderContext *s,
}
U[J2K_Q1] = kappa[J2K_Q1] + u[J2K_Q1];
U[J2K_Q2] = kappa[J2K_Q2] + u[J2K_Q2];
if (U[J2K_Q1] > maxbp || U[J2K_Q2] > maxbp) {
ret = AVERROR_INVALIDDATA;
goto free;
}
for (int i = 0; i < 4; i++) {
m[J2K_Q1][i] = sigma_n[4 * q1 + i] * U[J2K_Q1] - ((emb_pat_k[J2K_Q1] >> i) & 1);
@@ -729,10 +713,6 @@ static int jpeg2000_decode_ht_cleanup_segment(const Jpeg2000DecoderContext *s,
}
U[J2K_Q1] = kappa[J2K_Q1] + u[J2K_Q1];
if (U[J2K_Q1] > maxbp) {
ret = AVERROR_INVALIDDATA;
goto free;
}
for (int i = 0; i < 4; i++)
m[J2K_Q1][i] = sigma_n[4 * q1 + i] * U[J2K_Q1] - ((emb_pat_k[J2K_Q1] >> i) & 1);
@@ -862,10 +842,6 @@ static int jpeg2000_decode_ht_cleanup_segment(const Jpeg2000DecoderContext *s,
U[J2K_Q1] = kappa[J2K_Q1] + u[J2K_Q1];
U[J2K_Q2] = kappa[J2K_Q2] + u[J2K_Q2];
if (U[J2K_Q1] > maxbp || U[J2K_Q2] > maxbp) {
ret = AVERROR_INVALIDDATA;
goto free;
}
for (int i = 0; i < 4; i++) {
m[J2K_Q1][i] = sigma_n[4 * q1 + i] * U[J2K_Q1] - ((emb_pat_k[J2K_Q1] >> i) & 1);
@@ -934,10 +910,6 @@ static int jpeg2000_decode_ht_cleanup_segment(const Jpeg2000DecoderContext *s,
kappa[J2K_Q1] = FFMAX(1, gamma[J2K_Q1] * (max_e[J2K_Q1] - 1));
U[J2K_Q1] = kappa[J2K_Q1] + u[J2K_Q1];
if (U[J2K_Q1] > maxbp) {
ret = AVERROR_INVALIDDATA;
goto free;
}
for (int i = 0; i < 4; i++)
m[J2K_Q1][i] = sigma_n[4 * q1 + i] * U[J2K_Q1] - ((emb_pat_k[J2K_Q1] >> i) & 1);
@@ -1198,9 +1170,6 @@ ff_jpeg2000_decode_htj2k(const Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c
av_assert0(width * height <= 4096);
av_assert0(width * height > 0);
if (roi_shift)
avpriv_report_missing_feature(s->avctx, "ROI shift");
memset(t1->data, 0, t1->stride * height * sizeof(*t1->data));
memset(t1->flags, 0, t1->stride * (height + 2) * sizeof(*t1->flags));
@@ -1269,10 +1238,8 @@ ff_jpeg2000_decode_htj2k(const Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c
}
if ((ret = jpeg2000_decode_ht_cleanup_segment(s, cblk, t1, &mel_state, &mel, &vlc,
&mag_sgn, Dcup, Lcup, Pcup, pLSB, width,
height, sample_buf, block_states)) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "Bad HT cleanup segment\n");
height, sample_buf, block_states)) < 0)
goto free;
}
if (cblk->npasses > 1)
jpeg2000_decode_sigprop_segment(cblk, width, height, Dref, Lref,
-13
View File
@@ -382,19 +382,6 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near,
state->T3 = s->t3;
state->reset = s->reset;
ff_jpegls_reset_coding_parameters(state, 0);
/* Testing parameters here, we cannot test in LSE or SOF because
* these interdepend and are allowed in either order
*/
if (state->maxval >= (1<<state->bpp) ||
state->T1 > state->T2 ||
state->T2 > state->T3 ||
state->T3 > state->maxval ||
state->reset > FFMAX(255, state->maxval)) {
ret = AVERROR_INVALIDDATA;
goto end;
}
ff_jpegls_init_state(state);
if (s->bits <= 8)
+4 -22
View File
@@ -162,7 +162,7 @@ typedef struct JXLParseContext {
int skipped_icc;
int next;
uint8_t cs_buffer[4096 + AV_INPUT_BUFFER_PADDING_SIZE];
uint8_t cs_buffer[4096];
} JXLParseContext;
/* used for reading brotli prefixes */
@@ -384,11 +384,11 @@ static int populate_distribution(GetBitContext *gb, JXLSymbolDistribution *dist,
uint32_t total_count = 0;
uint8_t logcounts[258] = { 0 };
uint8_t same[258] = { 0 };
const int table_size = 1 << log_alphabet_size;
dist->uniq_pos = -1;
if (get_bits1(gb)) {
/* simple code */
dist->alphabet_size = 256;
if (get_bits1(gb)) {
uint8_t v1 = jxl_u8(gb);
uint8_t v2 = jxl_u8(gb);
@@ -398,24 +398,17 @@ static int populate_distribution(GetBitContext *gb, JXLSymbolDistribution *dist,
dist->freq[v2] = (1 << 12) - dist->freq[v1];
if (!dist->freq[v1])
dist->uniq_pos = v2;
dist->alphabet_size = 1 + FFMAX(v1, v2);
} else {
uint8_t x = jxl_u8(gb);
dist->freq[x] = 1 << 12;
dist->uniq_pos = x;
dist->alphabet_size = 1 + x;
}
if (dist->alphabet_size > table_size)
return AVERROR_INVALIDDATA;
return 0;
}
if (get_bits1(gb)) {
/* flat code */
dist->alphabet_size = jxl_u8(gb) + 1;
if (dist->alphabet_size > table_size)
return AVERROR_INVALIDDATA;
for (int i = 0; i < dist->alphabet_size; i++)
dist->freq[i] = (1 << 12) / dist->alphabet_size;
for (int i = 0; i < (1 << 12) % dist->alphabet_size; i++)
@@ -433,9 +426,6 @@ static int populate_distribution(GetBitContext *gb, JXLSymbolDistribution *dist,
return AVERROR_INVALIDDATA;
dist->alphabet_size = jxl_u8(gb) + 3;
if (dist->alphabet_size > table_size)
return AVERROR_INVALIDDATA;
for (int i = 0; i < dist->alphabet_size; i++) {
logcounts[i] = get_vlc2(gb, dist_prefix_table, 7, 1);
if (logcounts[i] == 13) {
@@ -708,10 +698,6 @@ static int read_vlc_prefix(GetBitContext *gb, JXLEntropyDecoder *dec, JXLSymbolD
level1_codecounts[0] = hskip;
for (int i = hskip; i < 18; i++) {
len = level1_lens[prefix_codelen_map[i]] = get_vlc2(gb, level0_table, 4, 1);
if (len < 0) {
ret = AVERROR_INVALIDDATA;
goto end;
}
level1_codecounts[len]++;
if (len) {
total_code += (32 >> len);
@@ -757,10 +743,6 @@ static int read_vlc_prefix(GetBitContext *gb, JXLEntropyDecoder *dec, JXLSymbolD
total_code = 0;
for (int i = 0; i < dist->alphabet_size; i++) {
len = get_vlc2(gb, level1_vlc.table, 5, 1);
if (len < 0) {
ret = AVERROR_INVALIDDATA;
goto end;
}
if (get_bits_left(gb) < 0) {
ret = AVERROR_BUFFER_TOO_SMALL;
goto end;
@@ -1408,7 +1390,7 @@ static int try_parse(AVCodecParserContext *s, AVCodecContext *avctx, JXLParseCon
if (ctx->container || AV_RL64(buf) == FF_JPEGXL_CONTAINER_SIGNATURE_LE) {
ctx->container = 1;
ret = ff_jpegxl_collect_codestream_header(buf, buf_size, ctx->cs_buffer,
sizeof(ctx->cs_buffer) - AV_INPUT_BUFFER_PADDING_SIZE, &ctx->copied);
sizeof(ctx->cs_buffer), &ctx->copied);
if (ret < 0)
return ret;
ctx->collected_size = ret;
@@ -1417,7 +1399,7 @@ static int try_parse(AVCodecParserContext *s, AVCodecContext *avctx, JXLParseCon
return AVERROR_BUFFER_TOO_SMALL;
}
cs_buffer = ctx->cs_buffer;
cs_buflen = FFMIN(sizeof(ctx->cs_buffer) - AV_INPUT_BUFFER_PADDING_SIZE, ctx->copied);
cs_buflen = FFMIN(sizeof(ctx->cs_buffer), ctx->copied);
} else {
cs_buffer = buf;
cs_buflen = buf_size;
+9 -19
View File
@@ -68,16 +68,14 @@ typedef struct ARIBCaptionContext {
int subtitle_type;
int encoding_scheme;
int ass_single_rect;
bool ass_single_rect;
char *font;
int force_stroke_text;
int ignore_background;
int ignore_ruby;
bool replace_fullwidth_ascii;
bool force_stroke_text;
bool ignore_background;
bool ignore_ruby;
float stroke_width;
int replace_drcs;
int replace_msz_ascii;
int replace_msz_japanese;
int replace_msz_glyph;
bool replace_drcs;
int64_t pts;
AVRational time_base;
@@ -1006,9 +1004,7 @@ static int aribcaption_init(AVCodecContext *avctx)
return AVERROR_EXTERNAL;
}
aribcc_decoder_set_replace_msz_fullwidth_ascii(ctx->decoder,
ctx->replace_msz_ascii);
aribcc_decoder_set_replace_msz_fullwidth_japanese(ctx->decoder,
ctx->replace_msz_japanese);
ctx->replace_fullwidth_ascii);
/* Similar behavior as ffmpeg tool to set canvas size */
if (ctx->canvas_width > 0 && ctx->canvas_height > 0 &&
@@ -1061,8 +1057,6 @@ static int aribcaption_init(AVCodecContext *avctx)
aribcc_renderer_set_force_no_background(ctx->renderer, ctx->ignore_background);
aribcc_renderer_set_force_no_ruby(ctx->renderer, ctx->ignore_ruby);
aribcc_renderer_set_stroke_width(ctx->renderer, ctx->stroke_width);
aribcc_renderer_set_replace_msz_halfwidth_glyph(ctx->renderer,
ctx->replace_msz_glyph);
if (ctx->font) {
int is_nomem = 0;
size_t count = 0;
@@ -1138,6 +1132,8 @@ static const AVOption options[] = {
OFFSET(ass_single_rect), AV_OPT_TYPE_BOOL, { .i64 = ASS_SINGLE_RECT }, 0, 1, SD },
{ "font", "comma-separated font family [ass, bitmap]",
OFFSET(font), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, SD },
{ "replace_fullwidth_ascii", "replace MSZ fullwidth alphanumerics with halfwidth alphanumerics [ass, bitmap]",
OFFSET(replace_fullwidth_ascii), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD },
{ "force_outline_text", "always render characters with outline [(ass), bitmap]",
OFFSET(force_stroke_text), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, SD },
{ "ignore_background", "ignore rendering caption background [(ass), bitmap]",
@@ -1148,12 +1144,6 @@ static const AVOption options[] = {
OFFSET(stroke_width), AV_OPT_TYPE_FLOAT, { .dbl = 1.5 }, 0.0, 3.0, SD },
{ "replace_drcs", "replace known DRCS [bitmap]",
OFFSET(replace_drcs), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD },
{ "replace_msz_ascii", "replace MSZ fullwidth alphanumerics with halfwidth alphanumerics [ass, bitmap]",
OFFSET(replace_msz_ascii), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD },
{ "replace_msz_japanese", "replace MSZ fullwidth Japanese with halfwidth [ass, bitmap]",
OFFSET(replace_msz_japanese), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD },
{ "replace_msz_glyph", "replace MSZ characters with halfwidth glyphs [bitmap]",
OFFSET(replace_msz_glyph), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD },
{"canvas_size", "set input video size (WxH or abbreviation) [bitmap]",
OFFSET(canvas_width), AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, INT_MAX, SD },
{ NULL }
-12
View File
@@ -250,7 +250,6 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
if (avctx->gop_size > 1)
param->intra_period_length = avctx->gop_size - 1;
#if SVT_AV1_CHECK_VERSION(1, 1, 0)
// In order for SVT-AV1 to force keyframes by setting pic_type to
// EB_AV1_KEY_PICTURE on any frame, force_key_frames has to be set. Note
// that this does not force all frames to be keyframes (it only forces a
@@ -261,7 +260,6 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
// to be updated to set force_key_frames accordingly.
if (avctx->gop_size == 1)
param->force_key_frames = 1;
#endif
if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
param->frame_rate_numerator = avctx->framerate.num;
@@ -539,14 +537,6 @@ static int eb_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
if (svt_ret == EB_NoErrorEmptyQueue)
return AVERROR(EAGAIN);
#if SVT_AV1_CHECK_VERSION(2, 0, 0)
if (headerPtr->flags & EB_BUFFERFLAG_EOS) {
svt_enc->eos_flag = EOS_RECEIVED;
svt_av1_enc_release_out_buffer(&headerPtr);
return AVERROR_EOF;
}
#endif
ref = get_output_ref(avctx, svt_enc, headerPtr->n_filled_len);
if (!ref) {
av_log(avctx, AV_LOG_ERROR, "Failed to allocate output packet.\n");
@@ -581,10 +571,8 @@ static int eb_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
if (headerPtr->pic_type == EB_AV1_NON_REF_PICTURE)
pkt->flags |= AV_PKT_FLAG_DISPOSABLE;
#if !(SVT_AV1_CHECK_VERSION(2, 0, 0))
if (headerPtr->flags & EB_BUFFERFLAG_EOS)
svt_enc->eos_flag = EOS_RECEIVED;
#endif
ff_side_data_set_encoder_stats(pkt, headerPtr->qp * FF_QP2LAMBDA, NULL, 0, pict_type);
-2
View File
@@ -2041,7 +2041,6 @@ const FFCodec ff_libvpx_vp8_encoder = {
FF_CODEC_ENCODE_CB(vpx_encode),
.close = vpx_free,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP |
FF_CODEC_CAP_AUTO_THREADS,
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE },
.p.priv_class = &class_vp8,
@@ -2118,7 +2117,6 @@ FFCodec ff_libvpx_vp9_encoder = {
FF_CODEC_ENCODE_CB(vpx_encode),
.close = vpx_free,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP |
FF_CODEC_CAP_AUTO_THREADS,
.defaults = defaults,
.init_static_data = vp9_init_static,
+1 -8
View File
@@ -92,15 +92,10 @@ static inline int loco_get_rice(RICEContext *r)
if (get_bits_left(&r->gb) < 1)
return INT_MIN;
v = get_ur_golomb_jpegls(&r->gb, loco_get_rice_param(r), INT_MAX, 0);
if (v == -1)
return INT_MIN;
loco_update_rice_param(r, (v + 1) >> 1);
if (!v) {
if (r->save >= 0) {
int run = get_ur_golomb_jpegls(&r->gb, 2, INT_MAX, 0);
if (run == -1)
return INT_MIN;
r->run = run;
r->run = get_ur_golomb_jpegls(&r->gb, 2, INT_MAX, 0);
if (r->run > 1)
r->save += r->run + 1;
else
@@ -157,8 +152,6 @@ static int loco_decode_plane(LOCOContext *l, uint8_t *data, int width, int heigh
/* restore top left pixel */
val = loco_get_rice(&rc);
if (val == INT_MIN)
return AVERROR_INVALIDDATA;
data[0] = 128 + val;
/* restore top line */
for (i = 1; i < width; i++) {
+2 -4
View File
@@ -250,10 +250,8 @@ int ff_lpc_calc_coefs(LPCContext *s,
double av_uninit(weight);
memset(var, 0, FFALIGN(MAX_LPC_ORDER+1,4)*sizeof(*var));
/* Avoids initializing with an unused value when lpc_passes == 1 */
if (lpc_passes > 1)
for(j=0; j<max_order; j++)
m[0].coeff[max_order-1][j] = -lpc[max_order-1][j];
for(j=0; j<max_order; j++)
m[0].coeff[max_order-1][j] = -lpc[max_order-1][j];
for(; pass<lpc_passes; pass++){
avpriv_init_lls(&m[pass&1], max_order);
-2
View File
@@ -804,8 +804,6 @@ int ff_mediacodec_dec_receive(AVCodecContext *avctx, MediaCodecDecContext *s,
return AVERROR_EXTERNAL;
}
if (s->draining && s->eos)
return AVERROR_EOF;
return AVERROR(EAGAIN);
}
+1 -4
View File
@@ -268,11 +268,8 @@ static av_cold int mediacodec_init(AVCodecContext *avctx)
if (avctx->bit_rate)
ff_AMediaFormat_setInt32(format, "bitrate", avctx->bit_rate);
if (s->bitrate_mode >= 0) {
if (s->bitrate_mode >= 0)
ff_AMediaFormat_setInt32(format, "bitrate-mode", s->bitrate_mode);
if (s->bitrate_mode == BITRATE_MODE_CQ && avctx->global_quality > 0)
ff_AMediaFormat_setInt32(format, "quality", avctx->global_quality);
}
// frame-rate and i-frame-interval are required to configure codec
if (avctx->framerate.num >= avctx->framerate.den && avctx->framerate.den > 0) {
s->fps = avctx->framerate.num / avctx->framerate.den;
+1 -1
View File
@@ -248,7 +248,7 @@ static int mf_sample_to_avpacket(AVCodecContext *avctx, IMFSample *sample, AVPac
if ((ret = ff_get_encode_buffer(avctx, avpkt, len, 0)) < 0)
return ret;
hr = IMFSample_ConvertToContiguousBuffer(sample, &buffer);
IMFSample_ConvertToContiguousBuffer(sample, &buffer);
if (FAILED(hr))
return AVERROR_EXTERNAL;
+3 -4
View File
@@ -1414,8 +1414,7 @@ static int estimate_coeff(MLPEncodeContext *ctx, MLPSubstream *s,
int32_t maxl = INT32_MIN, maxr = INT32_MIN, minl = INT32_MAX, minr = INT32_MAX;
int64_t summ = 0, sums = 0, suml = 0, sumr = 0, enl = 0, enr = 0;
const int shift = 14 - ctx->rematrix_precision;
int32_t cf0, cf1, e[4], d[4];
int64_t ml, mr;
int32_t cf0, cf1, e[4], d[4], ml, mr;
int i, count = 0;
for (int j = 0; j <= ctx->cur_restart_interval; j++) {
@@ -1448,8 +1447,8 @@ static int estimate_coeff(MLPEncodeContext *ctx, MLPSubstream *s,
summ -= FFABS(suml + sumr);
sums -= FFABS(suml - sumr);
ml = maxl - (int64_t)minl;
mr = maxr - (int64_t)minr;
ml = maxl - minl;
mr = maxr - minr;
if (!summ && !sums)
return 0;
+1 -1
View File
@@ -1446,7 +1446,7 @@ static inline int direct_search(MpegEncContext * s, int mb_x, int mb_y)
s->b_direct_mv_table[mot_xy][0]= 0;
s->b_direct_mv_table[mot_xy][1]= 0;
return 256*256*256*64-1;
return 256*256*256*64;
}
c->xmin= xmin;
+1 -1
View File
@@ -2934,7 +2934,7 @@ static int ipu_decode_frame(AVCodecContext *avctx, AVFrame *frame,
int ret;
// Check for minimal intra MB size (considering mb header, luma & chroma dc VLC, ac EOB VLC)
if (avpkt->size*8LL < (avctx->width+15)/16 * ((avctx->height+15)/16) * (2LL + 3*4 + 2*2 + 2*6))
if (avpkt->size*8LL < (avctx->width+15)/16 * ((avctx->height+15)/16) * (2 + 3*4 + 2*2 + 2*6))
return AVERROR_INVALIDDATA;
ret = ff_get_buffer(avctx, frame, 0);
+1 -1
View File
@@ -333,7 +333,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
else
/* VBV calculation: Scaled so that a VCD has the proper
* VBV size of 40 kilobytes */
vbv_buffer_size = av_rescale_rnd(s->bit_rate, 20, 1151929 / 2, AV_ROUND_ZERO) * 8 * 1024;
vbv_buffer_size = ((20 * s->bit_rate) / (1151929 / 2)) * 8 * 1024;
vbv_buffer_size = (vbv_buffer_size + 16383) / 16384;
put_sbits(&s->pb, 18, v);
-2
View File
@@ -597,8 +597,6 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
ctx->sprite_shift[0] = alpha + beta + rho - min_ab;
ctx->sprite_shift[1] = alpha + beta + rho - min_ab + 2;
break;
default:
av_assert0(0);
}
/* try to simplify the situation */
if (sprite_delta[0][0] == a << ctx->sprite_shift[0] &&
+7 -9
View File
@@ -1194,12 +1194,12 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
}
for (int i = 0; i < 3; i++) {
ptrdiff_t src_stride = pic_arg->linesize[i];
ptrdiff_t dst_stride = i ? s->uvlinesize : s->linesize;
int src_stride = pic_arg->linesize[i];
int dst_stride = i ? s->uvlinesize : s->linesize;
int h_shift = i ? s->chroma_x_shift : 0;
int v_shift = i ? s->chroma_y_shift : 0;
int w = AV_CEIL_RSHIFT(s->width , h_shift);
int h = AV_CEIL_RSHIFT(s->height, v_shift);
int w = s->width >> h_shift;
int h = s->height >> v_shift;
const uint8_t *src = pic_arg->data[i];
uint8_t *dst = pic->f->data[i];
int vpad = 16;
@@ -1213,7 +1213,7 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
dst += INPLACE_OFFSET;
if (src_stride == dst_stride)
memcpy(dst, src, src_stride * h - src_stride + w);
memcpy(dst, src, src_stride * h);
else {
int h2 = h;
uint8_t *dst2 = dst;
@@ -1252,8 +1252,6 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
/* shift buffer entries */
for (int i = flush_offset; i <= MAX_B_FRAMES; i++)
s->input_picture[i - flush_offset] = s->input_picture[i];
for (int i = MAX_B_FRAMES + 1 - flush_offset; i <= MAX_B_FRAMES; i++)
s->input_picture[i] = NULL;
s->input_picture[encoding_delay] = pic;
@@ -1435,7 +1433,7 @@ static int estimate_best_b_count(MpegEncContext *s)
goto fail;
}
rd += (out_size * (uint64_t)lambda2) >> (FF_LAMBDA_SHIFT - 3);
rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3);
}
/* get the delayed frames */
@@ -1444,7 +1442,7 @@ static int estimate_best_b_count(MpegEncContext *s)
ret = out_size;
goto fail;
}
rd += (out_size * (uint64_t)lambda2) >> (FF_LAMBDA_SHIFT - 3);
rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3);
rd += c->error[0] + c->error[1] + c->error[2];
-6
View File
@@ -53,9 +53,6 @@ static int rle_uncompress(AVCodecContext *avctx, GetByteContext *gb, PutByteCont
unsigned run = bytestream2_get_byte(gb);
if (run) {
if (bytestream2_get_bytes_left_p(pb) < run * s->bpp)
return AVERROR_INVALIDDATA;
switch (avctx->bits_per_coded_sample) {
case 8:
fill = bytestream2_get_byte(gb);
@@ -104,9 +101,6 @@ static int rle_uncompress(AVCodecContext *avctx, GetByteContext *gb, PutByteCont
bytestream2_seek_p(pb, y * avctx->width * s->bpp + x * s->bpp, SEEK_SET);
} else {
if (bytestream2_get_bytes_left_p(pb) < copy * s->bpp)
return AVERROR_INVALIDDATA;
for (j = 0; j < copy; j++) {
switch (avctx->bits_per_coded_sample) {
case 8:
-11
View File
@@ -50,10 +50,6 @@ static int rle_uncompress(GetByteContext *gb, PutByteContext *pb, GetByteContext
if (run == 0) {
run = bytestream2_get_le32(gb);
if (bytestream2_tell_p(pb) + width - w < run)
return AVERROR_INVALIDDATA;
for (int j = 0; j < run; j++, w++) {
if (w == width) {
w = 0;
@@ -65,10 +61,6 @@ static int rle_uncompress(GetByteContext *gb, PutByteContext *pb, GetByteContext
int pos = bytestream2_tell_p(pb);
bytestream2_seek(gbp, pos, SEEK_SET);
if (pos + width - w < fill)
return AVERROR_INVALIDDATA;
for (int j = 0; j < fill; j++, w++) {
if (w == width) {
w = 0;
@@ -80,9 +72,6 @@ static int rle_uncompress(GetByteContext *gb, PutByteContext *pb, GetByteContext
intra = 0;
} else {
if (bytestream2_tell_p(pb) + width - w < run)
return AVERROR_INVALIDDATA;
for (int j = 0; j < run; j++, w++) {
if (w == width) {
w = 0;
+1 -3
View File
@@ -242,9 +242,7 @@ static int decode_blocks(AVCodecContext *avctx, AVFrame *p,
bytestream2_seek(&dgb, s->y_data_offset + row_offset, SEEK_SET);
ret = init_get_bits8(&bit, dgb.buffer, bytestream2_get_bytes_left(&dgb));
if (ret < 0)
return ret;
init_get_bits8(&bit, dgb.buffer, bytestream2_get_bytes_left(&dgb));
for (int x = 0; x < avctx->width; x += 4) {
unsigned item = bytestream2_get_le32(gb);
unsigned y_min = item & 4095;
+1 -3
View File
@@ -258,8 +258,8 @@ int ff_nvdec_decode_uninit(AVCodecContext *avctx)
{
NVDECContext *ctx = avctx->internal->hwaccel_priv_data;
av_freep(&ctx->bitstream);
av_freep(&ctx->bitstream_internal);
ctx->bitstream = NULL;
ctx->bitstream_len = 0;
ctx->bitstream_allocated = 0;
@@ -665,8 +665,6 @@ int ff_nvdec_simple_end_frame(AVCodecContext *avctx)
NVDECContext *ctx = avctx->internal->hwaccel_priv_data;
int ret = ff_nvdec_end_frame(avctx);
ctx->bitstream = NULL;
ctx->bitstream_len = 0;
ctx->nb_slices = 0;
return ret;
}
+2 -2
View File
@@ -138,11 +138,11 @@ static int nvdec_h264_decode_slice(AVCodecContext *avctx, const uint8_t *buffer,
const H264SliceContext *sl = &h->slice_ctx[0];
void *tmp;
tmp = av_fast_realloc(ctx->bitstream_internal, &ctx->bitstream_allocated,
tmp = av_fast_realloc(ctx->bitstream, &ctx->bitstream_allocated,
ctx->bitstream_len + size + 3);
if (!tmp)
return AVERROR(ENOMEM);
ctx->bitstream = ctx->bitstream_internal = tmp;
ctx->bitstream = tmp;
tmp = av_fast_realloc(ctx->slice_offsets, &ctx->slice_offsets_allocated,
(ctx->nb_slices + 1) * sizeof(*ctx->slice_offsets));
+2 -2
View File
@@ -274,11 +274,11 @@ static int nvdec_hevc_decode_slice(AVCodecContext *avctx, const uint8_t *buffer,
NVDECContext *ctx = avctx->internal->hwaccel_priv_data;
void *tmp;
tmp = av_fast_realloc(ctx->bitstream_internal, &ctx->bitstream_allocated,
tmp = av_fast_realloc(ctx->bitstream, &ctx->bitstream_allocated,
ctx->bitstream_len + size + 3);
if (!tmp)
return AVERROR(ENOMEM);
ctx->bitstream = ctx->bitstream_internal = tmp;
ctx->bitstream = tmp;
tmp = av_fast_realloc(ctx->slice_offsets, &ctx->slice_offsets_allocated,
(ctx->nb_slices + 1) * sizeof(*ctx->slice_offsets));
+5 -20
View File
@@ -982,7 +982,7 @@ static av_cold int nvenc_recalc_surfaces(AVCodecContext *avctx)
// Output in the worst case will only start when the surface buffer is completely full.
// Hence we need to keep at least the max amount of surfaces plus the max reorder delay around.
ctx->frame_data_array_nb = FFMAX(ctx->nb_surfaces, ctx->nb_surfaces + ctx->encode_config.frameIntervalP - 1);
ctx->frame_data_array_nb = ctx->nb_surfaces + ctx->encode_config.frameIntervalP - 1;
return 0;
}
@@ -1255,11 +1255,6 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx)
h264->level = ctx->level;
#ifdef NVENC_HAVE_NEW_BIT_DEPTH_API
h264->inputBitDepth = h264->outputBitDepth =
IS_10BIT(ctx->data_pix_fmt) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8;
#endif
if (ctx->coder >= 0)
h264->entropyCodingMode = ctx->coder;
@@ -1375,12 +1370,7 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx)
hevc->chromaFormatIDC = IS_YUV444(ctx->data_pix_fmt) ? 3 : 1;
#ifdef NVENC_HAVE_NEW_BIT_DEPTH_API
hevc->inputBitDepth = hevc->outputBitDepth =
IS_10BIT(ctx->data_pix_fmt) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8;
#else
hevc->pixelBitDepthMinus8 = IS_10BIT(ctx->data_pix_fmt) ? 2 : 0;
#endif
hevc->level = ctx->level;
@@ -1465,13 +1455,8 @@ static av_cold int nvenc_setup_av1_config(AVCodecContext *avctx)
av1->chromaFormatIDC = IS_YUV444(ctx->data_pix_fmt) ? 3 : 1;
#ifdef NVENC_HAVE_NEW_BIT_DEPTH_API
av1->inputBitDepth = IS_10BIT(ctx->data_pix_fmt) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8;
av1->outputBitDepth = (IS_10BIT(ctx->data_pix_fmt) || ctx->highbitdepth) ? NV_ENC_BIT_DEPTH_10 : NV_ENC_BIT_DEPTH_8;
#else
av1->inputPixelBitDepthMinus8 = IS_10BIT(ctx->data_pix_fmt) ? 2 : 0;
av1->pixelBitDepthMinus8 = (IS_10BIT(ctx->data_pix_fmt) || ctx->highbitdepth) ? 2 : 0;
#endif
if (ctx->b_ref_mode >= 0)
av1->useBFramesAsRef = ctx->b_ref_mode;
@@ -1704,15 +1689,15 @@ static NV_ENC_BUFFER_FORMAT nvenc_map_buffer_format(enum AVPixelFormat pix_fmt)
{
switch (pix_fmt) {
case AV_PIX_FMT_YUV420P:
return NV_ENC_BUFFER_FORMAT_YV12;
return NV_ENC_BUFFER_FORMAT_YV12_PL;
case AV_PIX_FMT_NV12:
return NV_ENC_BUFFER_FORMAT_NV12;
return NV_ENC_BUFFER_FORMAT_NV12_PL;
case AV_PIX_FMT_P010:
case AV_PIX_FMT_P016:
return NV_ENC_BUFFER_FORMAT_YUV420_10BIT;
case AV_PIX_FMT_GBRP:
case AV_PIX_FMT_YUV444P:
return NV_ENC_BUFFER_FORMAT_YUV444;
return NV_ENC_BUFFER_FORMAT_YUV444_PL;
case AV_PIX_FMT_GBRP16:
case AV_PIX_FMT_YUV444P16:
return NV_ENC_BUFFER_FORMAT_YUV444_10BIT;
@@ -1891,7 +1876,7 @@ av_cold int ff_nvenc_encode_close(AVCodecContext *avctx)
av_fifo_freep2(&ctx->unused_surface_queue);
if (ctx->frame_data_array) {
for (i = 0; i < ctx->frame_data_array_nb; i++)
for (i = 0; i < ctx->nb_surfaces; i++)
av_buffer_unref(&ctx->frame_data_array[i].frame_opaque_ref);
av_freep(&ctx->frame_data_array);
}
-5
View File
@@ -83,11 +83,6 @@ typedef void ID3D11Device;
#define NVENC_NO_DEPRECATED_RC
#endif
// SDK 12.2 compile time feature checks
#if NVENCAPI_CHECK_VERSION(12, 2)
#define NVENC_HAVE_NEW_BIT_DEPTH_API
#endif
typedef struct NvencSurface
{
NV_ENC_INPUT_PTR input_surface;
+17 -30
View File
@@ -61,14 +61,6 @@ typedef struct OSQContext {
int pkt_offset;
} OSQContext;
static void osq_flush(AVCodecContext *avctx)
{
OSQContext *s = avctx->priv_data;
s->bitstream_size = 0;
s->pkt_offset = 0;
}
static av_cold int osq_close(AVCodecContext *avctx)
{
OSQContext *s = avctx->priv_data;
@@ -160,15 +152,11 @@ static int update_residue_parameter(OSQChannel *cb)
sum = cb->sum;
x = sum / cb->count;
rice_k = ceil(log2(x));
rice_k = av_ceil_log2(x);
if (rice_k >= 30) {
double f = floor(sum / 1.4426952 + 0.5);
if (f <= 1) {
rice_k = floor(sum / 1.4426952 + 0.5);
if (rice_k < 1)
rice_k = 1;
} else if (f >= 31) {
rice_k = 31;
} else
rice_k = f;
}
return rice_k;
@@ -225,8 +213,8 @@ static int osq_channel_parameters(AVCodecContext *avctx, int ch)
#define C (-3)
#define D (-4)
#define E (-5)
#define P2 (((unsigned)dst[A] + dst[A]) - dst[B])
#define P3 (((unsigned)dst[A] - dst[B]) * 3 + dst[C])
#define P2 ((dst[A] + dst[A]) - dst[B])
#define P3 ((dst[A] - dst[B]) * 3 + dst[C])
static int do_decode(AVCodecContext *avctx, AVFrame *frame, int decorrelate, int downsample)
{
@@ -276,10 +264,10 @@ static int do_decode(AVCodecContext *avctx, AVFrame *frame, int decorrelate, int
case 0:
break;
case 1:
dst[n] += (unsigned)dst[A];
dst[n] += dst[A];
break;
case 2:
dst[n] += (unsigned)dst[A] + p;
dst[n] += dst[A] + p;
break;
case 3:
dst[n] += P2;
@@ -294,28 +282,28 @@ static int do_decode(AVCodecContext *avctx, AVFrame *frame, int decorrelate, int
dst[n] += P3 + p;
break;
case 7:
dst[n] += (int)(P2 + P3) / 2 + (unsigned)p;
dst[n] += (P2 + P3) / 2 + p;
break;
case 8:
dst[n] += (int)(P2 + P3) / 2;
dst[n] += (P2 + P3) / 2;
break;
case 9:
dst[n] += (int)(P2 * 2 + P3) / 3 + (unsigned)p;
dst[n] += (P2 * 2 + P3) / 3 + p;
break;
case 10:
dst[n] += (int)(P2 + P3 * 2) / 3 + (unsigned)p;
dst[n] += (P2 + P3 * 2) / 3 + p;
break;
case 11:
dst[n] += (int)((unsigned)dst[A] + dst[B]) / 2;
dst[n] += (dst[A] + dst[B]) / 2;
break;
case 12:
dst[n] += (unsigned)dst[B];
dst[n] += dst[B];
break;
case 13:
dst[n] += (int)(unsigned)(dst[D] + dst[B]) / 2;
dst[n] += (dst[D] + dst[B]) / 2;
break;
case 14:
dst[n] += (int)((unsigned)P2 + dst[A]) / 2 + (unsigned)p;
dst[n] += (P2 + dst[A]) / 2 + p;
break;
default:
return AVERROR_INVALIDDATA;
@@ -324,7 +312,7 @@ static int do_decode(AVCodecContext *avctx, AVFrame *frame, int decorrelate, int
cb->prev = prev;
if (downsample)
dst[n] *= 256U;
dst[n] *= 256;
dst[E] = dst[D];
dst[D] = dst[C];
@@ -355,7 +343,7 @@ static int osq_decode_block(AVCodecContext *avctx, AVFrame *frame)
const int nb_channels = avctx->ch_layout.nb_channels;
const int nb_samples = frame->nb_samples;
OSQContext *s = avctx->priv_data;
const unsigned factor = s->factor;
const int factor = s->factor;
int ret, decorrelate, downsample;
GetBitContext *gb = &s->gb;
@@ -490,5 +478,4 @@ const FFCodec ff_osq_decoder = {
AV_SAMPLE_FMT_S16P,
AV_SAMPLE_FMT_S32P,
AV_SAMPLE_FMT_NONE },
.flush = osq_flush,
};
+1 -1
View File
@@ -116,7 +116,7 @@ static int pcm_dvd_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
{
PCMDVDContext *s = avctx->priv_data;
int samples = frame->nb_samples * avctx->ch_layout.nb_channels;
int64_t pkt_size = (int64_t)(frame->nb_samples / s->samples_per_block) * s->block_size + 3;
int64_t pkt_size = (frame->nb_samples / s->samples_per_block) * s->block_size + 3;
int blocks = (pkt_size - 3) / s->block_size;
const int16_t *src16;
const int32_t *src32;
+2 -2
View File
@@ -230,8 +230,8 @@ static int read_high_coeffs(AVCodecContext *avctx, const uint8_t *src, int16_t *
if (cnt1 >= length) {
cnt1 = get_bits(bc, nbits);
} else {
pfx = FFMIN(value, 14);
if (pfx < 1)
pfx = 14 + ((((uint64_t)(value - 14)) >> 32) & (value - 14));
if (pfx < 1 || pfx > 25)
return AVERROR_INVALIDDATA;
cnt1 *= (1 << pfx) - 1;
shbits = show_bits(bc, pfx);
+4 -7
View File
@@ -1023,20 +1023,17 @@ static int decode_sbit_chunk(AVCodecContext *avctx, PNGDecContext *s,
return AVERROR_INVALIDDATA;
}
channels = s->color_type & PNG_COLOR_MASK_PALETTE ? 3 : ff_png_get_nb_channels(s->color_type);
channels = ff_png_get_nb_channels(s->color_type);
if (bytestream2_get_bytes_left(gb) != channels) {
av_log(avctx, AV_LOG_ERROR, "Invalid sBIT size: %d, expected: %d\n",
bytestream2_get_bytes_left(gb), channels);
if (bytestream2_get_bytes_left(gb) != channels)
return AVERROR_INVALIDDATA;
}
for (int i = 0; i < channels; i++) {
int b = bytestream2_get_byteu(gb);
bits = FFMAX(b, bits);
}
if (bits <= 0 || bits > (s->color_type & PNG_COLOR_MASK_PALETTE ? 8 : s->bit_depth)) {
if (bits < 0 || bits > s->bit_depth) {
av_log(avctx, AV_LOG_ERROR, "Invalid significant bits: %d\n", bits);
return AVERROR_INVALIDDATA;
}
@@ -1161,7 +1158,7 @@ static int decode_fctl_chunk(AVCodecContext *avctx, PNGDecContext *s,
return AVERROR_INVALIDDATA;
}
if ((sequence_number == 0 || !s->last_picture.f) &&
if ((sequence_number == 0 || !s->last_picture.f->data[0]) &&
dispose_op == APNG_DISPOSE_OP_PREVIOUS) {
// No previous frame to revert to for the first frame
// Spec says to just treat it as a APNG_DISPOSE_OP_BACKGROUND
+2 -3
View File
@@ -442,9 +442,8 @@ static int encode_headers(AVCodecContext *avctx, const AVFrame *pict)
if (png_get_gama(pict->color_trc, s->buf))
png_write_chunk(&s->bytestream, MKTAG('g', 'A', 'M', 'A'), s->buf, 4);
if (avctx->bits_per_raw_sample > 0 &&
avctx->bits_per_raw_sample < (s->color_type & PNG_COLOR_MASK_PALETTE ? 8 : s->bit_depth)) {
int len = s->color_type & PNG_COLOR_MASK_PALETTE ? 3 : ff_png_get_nb_channels(s->color_type);
if (avctx->bits_per_raw_sample > 0 && avctx->bits_per_raw_sample < s->bit_depth) {
int len = ff_png_get_nb_channels(s->color_type);
memset(s->buf, avctx->bits_per_raw_sample, len);
png_write_chunk(&s->bytestream, MKTAG('s', 'B', 'I', 'T'), s->buf, len);
}
+1 -1
View File
@@ -264,7 +264,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, AVFrame *p,
break;
case AV_PIX_FMT_GBRPF32:
if (!s->half) {
if (avctx->width * avctx->height * 12LL > s->bytestream_end - s->bytestream)
if (avctx->width * avctx->height * 12 > s->bytestream_end - s->bytestream)
return AVERROR_INVALIDDATA;
scale = 1.f / s->scale;
if (s->endian) {
+1 -1
View File
@@ -510,7 +510,7 @@ static av_always_inline int decode_ac_coeffs(AVCodecContext *avctx, GetBitContex
for (pos = block_mask;;) {
bits_left = gb->size_in_bits - re_index;
if (bits_left <= 0 || (bits_left < 32 && !SHOW_UBITS(re, gb, bits_left)))
if (!bits_left || (bits_left < 32 && !SHOW_UBITS(re, gb, bits_left)))
break;
DECODE_CODEWORD(run, run_to_cb[FFMIN(run, 15)], LAST_SKIP_BITS);
+1 -2
View File
@@ -884,8 +884,7 @@ static av_cold int prores_encode_init(AVCodecContext *avctx)
avctx->profile = AV_PROFILE_PRORES_4444;
av_log(avctx, AV_LOG_INFO,
"encoding with ProRes 4444+ (ap4h) profile\n");
} else
av_assert0(0);
}
} else if (avctx->profile < AV_PROFILE_PRORES_PROXY
|| avctx->profile > AV_PROFILE_PRORES_XQ) {
av_log(

Some files were not shown because too many files have changed in this diff Show More