Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c1263a3dd9 |
@@ -3,7 +3,7 @@ name: Test
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- release/8.1
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
@@ -68,7 +68,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
image: ['ghcr.io/btbn/ffmpeg-builds/win64-gpl-8.1:latest']
|
||||
image: ['ghcr.io/btbn/ffmpeg-builds/win64-gpl:latest']
|
||||
target_exec: ['wine']
|
||||
runs-on: linux-amd64
|
||||
container: ${{ matrix.image }}
|
||||
|
||||
@@ -1,245 +1,8 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version <next>:
|
||||
|
||||
version 8.1.2:
|
||||
swscale/x86/rgb_2_rgb: fix uyvytoyuv422 overwrite on odd width
|
||||
swscale/aarch64: fix uyvy/yuyv to yuv420p/yuv422p on odd width
|
||||
avcodec/snowenc: fix SIGFPE in get_dc() when a block lies outside the plane
|
||||
avcodec/snowenc: fix out-of-bounds OBMC read in get_dc() for narrow planes
|
||||
(fforge/pr/23505) avformat/tls_gnutls:fix crash when connecting to peer
|
||||
libavcodec/jpeg2000htdec: remove trailing whitespace
|
||||
libavdevice/alsa.c: fix NULL pointer dereference
|
||||
avcodec/libjxlenc: check orientation tag metadata before reading
|
||||
avformat/icecast: reject CR/LF in metadata header values
|
||||
avfilter/avf_showspectrum: Fix allocation check
|
||||
avformat/sctp: add size check in sctp_read() matching sctp_write()
|
||||
avcodec/jpeg2000: Fix undefined behavior on ROI shift-up
|
||||
aacdec_usac_mps212: reject reserved freq_res value
|
||||
avcodec/aac/aacdec_usac_mps212: Off-by-one bounds check in ff_aac_ec_data_deci()
|
||||
Update for 8.1.2
|
||||
avcodec/snowenc: fix out-of-bounds memcpy in get_block_rd() for narrow planes
|
||||
avutil/eval: apply unary sign to print, squish, gauss and lerp
|
||||
avcodec/cbs_av1_syntax_template: reset seen_frame_header on sequence headers
|
||||
avfilter/convolution: compute user matrix products in unsigned
|
||||
avformat/mpegts: use av_fast_realloc() for prg
|
||||
avfilter/avf_showcwt: fix DIRECTION_DU EOF fill clearing the wrong rows
|
||||
avfilter/avf_showcwt: fix DIRECTION_RL EOF fill clearing the wrong columns
|
||||
avfilter/avf_showcwt: avoid undefined float to int conversion of nb_consumed_samples
|
||||
avfilter/avf_showcwt: fix out of array read in compute_kernel
|
||||
avfilter/v360: compute remap table offsets in 64bit
|
||||
avfilter/v360: reject out-of-range dimensions
|
||||
swresample/x86/resample: write only int16 in the int16 resampler
|
||||
avformat/rtpenc_amr: Check input size
|
||||
swscale/ppc: fix ASAN stack-buffer-overflow in yuv2planeX
|
||||
swscale/ppc: fix LOAD_FILTER overread in VSX path
|
||||
avcodec/sanm: reject codec37 frames taller than the allocated buffer
|
||||
avcodec/sanm: reject codec47 frames taller than the allocated buffer
|
||||
avfilter: use ff_slice_pos() for per-slice boundary computation
|
||||
avfilter: add ff_slice_pos() helper for slice boundaries
|
||||
(origin/release/8.1, fforge/release/8.1) avformat/iamf_writer: reject muxing PCM streams
|
||||
avfilter/estdif: avoid signed overflow in slice boundary calculation
|
||||
swscale: support sliced input with cascaded scaling contexts
|
||||
avformat/rtspdec: bound Content-Length in the ANNOUNCE handler to SDP_MAX_SIZE
|
||||
avcodec/cbs_h266_syntax_template: reject subpic info with res_change_in_clvs
|
||||
avcodec/misc4: Check nb channels
|
||||
avcodec/rv10, rv34: check init_get_bits8() before RealVideo bit access
|
||||
avformat/http: reject request-line tokens not terminated by whitespace
|
||||
avformat/mov: reject out of range ispe dimensions, avoid overflow summing HEIF tile dimensions
|
||||
avcodec/agm: validate actual src_y against prev plane in decode_inter_plane
|
||||
avformat/dhav: Fix second integer overflow in get_duration()
|
||||
fftools/ffmpeg_dec: deep-copy subtitle_header to fix use-after-free
|
||||
avcodec/hevc/ps: Check window parameters
|
||||
avcodec/hevc/ps: Factor window reading out
|
||||
avcodec/truespeech: reject iterations count whose * 240 product overflows 32-bit
|
||||
libavcodec/options_table: gamma22 and gamma28 aliases
|
||||
avcodec/on2avc: reject subframe count whose * SUBFRAME_SIZE product overflows 32-bit
|
||||
avfilter/zmq: initialize send_buf before shared cleanup on parse failure
|
||||
avcodec/adpcm: fix signed integer overflow in get_nb_samples()
|
||||
avformat/matroskadec: avoid signed overflow in DASH cue time differences
|
||||
avcodec/fastaudio: reject subframes count whose * 256 product overflows 32-bit
|
||||
avcodec/vc2enc_dwt: avoid signed overflow in the 9/7 DWT lifting
|
||||
avcodec/vc2enc_dwt: avoid signed overflow in the 5/3 and Haar DWT
|
||||
avformat/dashdec: Fail with any inner stream count being 0
|
||||
avcodec/mjpegdec: require progress in AVRn interlaced field loop
|
||||
avcodec/mwsc: do not dereference a missing reference frame
|
||||
avcodec/misc4: reject invalid sample rate
|
||||
swscale/output: avoid signed overflow in yuv2rgba64_1 alpha
|
||||
swscale/output: avoid signed overflow in yuv2rgba64_full_1 alpha
|
||||
tools/target_dem_fuzzer: do not exit on io_buffer allocation failure
|
||||
avformat/gxfenc: Check timecode and propagate error
|
||||
swscale/rgb2rgb_template: use unsigned for <<24
|
||||
avformat/iamf_parse: bound substream count by remaining OBU size
|
||||
avformat/matroskadec: bound TRACKENTRY parsing by max_streams
|
||||
avcodec/diracdec: fix heap buffer overflow in edge_emu_buffer
|
||||
avformat/rtmppkt: Check recursion depth
|
||||
avcodec/tdsc: propagate max_pixels to the JPEG tile decoder
|
||||
avcodec/imm5: propagate max_pixels to the H264/HEVC sub-decoders
|
||||
avcodec/cri: propagate max_pixels to the JPEG tile decoder
|
||||
avcodec/jpeglsdec: only apply color transform to decoded rows
|
||||
avcodec/adpcm: require block_align to be a multiple of channels in ADPCM_PSXC init
|
||||
avfilter/avf_showcwt: fix out-of-bounds read in du scroll
|
||||
avfilter/f_ebur128: avoid signed-int wrap when sizing per-channel cache
|
||||
avformat/mov: cap HEIF ICC profile copies via c*max_streams to bound CPU and memory
|
||||
avcodec/aac/aacdec_usac: reject explicit usacSamplingFrequency of 0
|
||||
avcodec/aac/aacdec_usac: avoid signed overflow in decode_tsd
|
||||
avcodec/aac/aacdec: reject decoded frame without a valid sample rate
|
||||
avformat/iff: check av_get_packet() result in ANIM branch
|
||||
avcodec/cbs_h266_syntax_template: Fix pps_exp_slice_height_in_ctus_minus1 range
|
||||
avfilter/vf_scale: split rational multiply
|
||||
avcodec/bsf/dts2pts: fix binary tree invariant violation on selective dec_poc
|
||||
avfilter/vf_drawtext: Avoid double free in glyph_enu_border_free()
|
||||
avfilter/vf_drawtext: plug error-path leaks in measure_text/draw_text
|
||||
avfilter/vf_drawtext: shape_text_hb() free allocated things on error
|
||||
avfilter/vf_drawtext: avoid double-free of aliased FT_Glyph in glyph_enu_free
|
||||
avfilter/vf_drawtext: don't double-free glyph that has been cached in tree
|
||||
avfilter/vf_drawtext: always check pixel_mode == FT_PIXEL_MODE_MONO
|
||||
avcodec/cook: bound subpacket channel sum against channel count
|
||||
avcodec/apv_decode: avoid using apv_cbc
|
||||
avformat/mxfdec: Remove unneeded check
|
||||
avformat/ftp: Check string used for RNTO
|
||||
avformat/ftp: Check for Telnet IAC characters and other non printable ASCII chars
|
||||
avformat/ftp: reject CR/LF in the URL path to prevent FTP command injection
|
||||
avcodec/jpeg2000dec: Clear header derived variables
|
||||
avcodec/bsf/smpte436m_to_eia608: properly frees stuff on errors in ff_smpte436m_to_eia608_filter()
|
||||
tests/checkasm/crc: retain offset values between calls
|
||||
avformat/avc: Adjust get_ue_golomb() to handle 32 bit
|
||||
avformat/whip: require remote DTLS fingerprint in SDP answer
|
||||
avcodec/x86/vorbisdsp: change cmpleps to cmpltps in inverse coupling
|
||||
avcodec/liboapvenc: derive and validate APV profile from pixel format
|
||||
avformat/dashdec: bound manifest reloads and fragment-open retries
|
||||
avfilter/af_join: fix wrong loop bound in buffer dedup (use-after-free)
|
||||
avcodec/nvenc: fix compatibility with Video Codec SDK 13.1
|
||||
avformat/mov: validate APV access unit length before passing to decoder
|
||||
avcodec/h264_slice: guard color_frame() against chroma-width underflow
|
||||
avcodec/magicyuv: reject slice_height misaligned with chroma vshift
|
||||
avcodec/magicyuv: Expand the s->interlaced slice-height sanity check
|
||||
avcodec/magicyuv: Fix 1 line MEDIAN slices
|
||||
avformat/mxfdec: zero-init Sony MPEG-4 extradata and add padding
|
||||
avformat/soxdec: Check sample_rate for nan
|
||||
tests/tiny_ssim: fixed mistake in ssim_c1 calculation
|
||||
avformat/hls: Check TIME-OFFSET value
|
||||
avformat/hls: Check url_offset and size
|
||||
avcodec/prores_raw: reject invalid tile alignment values
|
||||
avformat/ty: check rec_size
|
||||
avformat/ogg: Fix overflow and stale oggvorbis_private values
|
||||
avformat/rtpenc_xiph: bail out when the max payload size underflows
|
||||
avformat/rtpenc_aac: reject packets smaller than the ADTS header
|
||||
avcodec/jpeg2000dec: compute mask in decode_clnpass() like in decode_sigpass()
|
||||
avformat/flvdec: Check size at the top of the main loop
|
||||
avformat/vividas: fix misaligned access
|
||||
avformat/mccdec: dont pass NULL to bytestream2_put_buffer()
|
||||
avcodec/g2meet: The stack is EPIC_PIX_STACK_SIZE
|
||||
avcodec/h2645_sei: Initialize side data before deallocation
|
||||
avfilter/boxblur: Fix off by one errors
|
||||
avformat/assenc: Add the missing parentheses
|
||||
avcodec/diracdec: Enlarge `mctmp` to cover the worst-case `blheight·ybsep + yblen` rows, and break the MC loop when no output rows remain
|
||||
tools/zmqsend: free the AVBprint buffer after using it
|
||||
[Wave] Fix issues with unaligned metadata chunks.
|
||||
avformat/mpegts: Dont assume fc->priv_data is a MpegTSContext
|
||||
fftools/graph: Add missing include "libavutil/mem.h" for fftools/graph/graphprint.c
|
||||
avcodec/cbs_h266_syntax_template: tighten sh_num_tiles_in_slice_minus1 upper bound
|
||||
avcodec/hevc: limit missing-ref fill to coded planes
|
||||
avformat/mov: Fix negative index given to can_seek_to_key_sample()
|
||||
avcodec/hdrdec: fix pixel count decrement in RLE decompress loop
|
||||
(fforge/pr/23464) forgejo/workflows: update test workflow for 8.1 release
|
||||
(fforge/pr/23445) aarch64: vp9lpf: Fix GCS violations
|
||||
(fforge/pr/23303) avformat/mov: don't abort on unsupported or invalid chnl boxes
|
||||
avformat/mov_chan: keep the layout untouched on chan/chnl box failure
|
||||
(fforge/pr/23240) avformat/oggparsevorbis.c: Prevent integer overflow when summing header lengths; add bounds check.
|
||||
(fforge/pr/23187) avformat/oggparsecelt: bound extra_headers to avoid an effectively infinite loop
|
||||
(fforge/pr/23111) avformat/demux: use correct close function for custom io
|
||||
avformat/hlsenc: use correct close function for custom io
|
||||
avformat/hlsenc: respect io_open set in AVFormatContext
|
||||
avformat/dashenc: respect io_open set in AVFormatContext
|
||||
avformat/dashdec: respect io_open set in AVFormatContext
|
||||
vulkan: fix using encode caps before querying
|
||||
avformat/rtpdec_av1: fix buffer overflow due to variable confusion
|
||||
|
||||
|
||||
version 8.1.1:
|
||||
avcodec/aac/aacdec_usac_mps212: fix attach_lsb() OOB after huff_decode
|
||||
avcodec/dfpwmdec: Check nb_samples
|
||||
avcodec/alsdec: do not set nbits invalidly
|
||||
swscale/swscale_unscaled: adjust last line copy
|
||||
swscale/swscale: Check srcSliceY and srcSliceH
|
||||
avformat/avidec: check LIST size in avi_load_index()
|
||||
avformat/avidec: validate INFO list size before parsing
|
||||
avformat/matroskadec: Check audio.sub_packet_h * audio.frame_size
|
||||
libavformat/xwma: fix overflow in seek position
|
||||
avformat/pcm: Use 64bit for byte_rate
|
||||
avcodec/adpcm: signed integer overflow in ADPCM_N64
|
||||
avcodec/hevc/ps: validate rep_format dimensions in multi-layer SPS
|
||||
avfilter/vf_kerndeint: Check for minimum height
|
||||
avcodec/ralf: Add the missing return statement after the error log
|
||||
avfilter/vf_codecview: Clamp block to the visible frame region
|
||||
avcodec/zmbv: reject XOR data that overruns the decompression buffer
|
||||
avcodec/rasc: fix heap use-after-free in decode_move()
|
||||
avformat/rtpdec_mpeg4: reject zero-length AU header sections
|
||||
avcodec/hevc/refs: Check multiplication in alloc_frame()
|
||||
fftools/ffmpeg_opt: validate stream index in negative map handling
|
||||
avformat/rtmpproto: prevent integer overflow accumulating FLV buffer size
|
||||
avformat/rtmpproto: validate compressed SWF header length
|
||||
avformat/rtsp: Fix out-of-bounds read in SDP parser when control_url is empty
|
||||
avformat/rtpdec_latm: avoid integer overflow in LATM length parsing
|
||||
avcodec/h264: recompute per-slice direct mode state for every slice
|
||||
avcodec/h264_refs: Clear stale pointers from ref_list
|
||||
avcodec/pdvdec: Check input space before buffer allocation
|
||||
avformat/concat: guard total_size overflow
|
||||
avformat/iamf_parse.c: Fix potential integer overflow in opus_decoder_config()
|
||||
avcodec/wmaenc: Fix missing padding in extradata
|
||||
avformat: Fix various extradata padding issues
|
||||
avcodec/tdsc: remove double stride adjustment
|
||||
avformat/cafdec: fix negative index use in read_seek
|
||||
avcodec/notchlc: Check 255 loops
|
||||
avformat/rtpdec_jpeg: check qtable_len
|
||||
avformat/vividas: use-of-uninitialized-value in keybuffer
|
||||
avcodec/tdsc: Check jpeg size
|
||||
avcodec/tdsc: Better input size check
|
||||
avcodec/tdsc: Check tile_size
|
||||
avcodec/decode: Better documentation for ff_set_dimensions()
|
||||
avformat/mov: Limit maximum box size for mov_read_lhvc()
|
||||
avformat/mov: reject dimg references with zero entries
|
||||
avformat/mov: check extradata in mov_read_dops()
|
||||
avformat/mov: Check read size for opus extradata
|
||||
avformat/rtspdec: reject non-positive ANNOUNCE Content-Length
|
||||
avformat/wavdec: Fix use-of-uninitialized-value in find_guid()
|
||||
lavfi: vf_drawtext: check memory allocation
|
||||
avcodec/svq1dec: Check input space for minimum
|
||||
avcodec/vp9: Rollback dimensions when format is rejected
|
||||
avformat/rtpdec_qdm2: Check block_size
|
||||
avfilter/vf_ssim360: fix integer overflow in tape_length allocation
|
||||
avcodec/escape130: Initialize old_y_avg
|
||||
avutil/samplefmt: Dont claim that av_get_sample_fmt_string checks sample_fmt
|
||||
swscale: fix signed integer overflow in color conversion arithmetic
|
||||
avformat: check avio_read() return values in dss/dtshd/mlv
|
||||
avformat/whip: check RTP history packet size before RTX retransmission
|
||||
avcodec/aac/aacdec_usac: Implement missing bits of otts_bands_phase and residual_bands computation
|
||||
avcodec/alsdec: preserve full float value in zero-truncated samples
|
||||
avcodec/alsdec: propagate read_diff_float_data() errors in read_frame_data()
|
||||
avcodec/alsdec: fix mantissa unpacking in compressed Part A path
|
||||
avfilter/vf_drawtext: fix newline rendered as .notdef glyph
|
||||
avcodec/pngdec: fix dead overflow check in decode_text_to_exif()
|
||||
avcodec/vp9: fix cbs fragment leak on error
|
||||
libavfilter/vf_v360: fix operator precedence in stereo loop condition
|
||||
avcodec/alsdec: fix abs(INT_MIN) UB in read_diff_float_data()
|
||||
avformat/rsd: reject short ADPCM_THP extradata reads
|
||||
avformat/mov: Handle integer overflow in MOV parser
|
||||
avcodec/dvdsub_parser: Fix buf_size check
|
||||
avfilter/af_pan: fix sscanf() return value checks in parse_channel_name
|
||||
avutil/bswap: fix implicit conversion warning in av_bswap64
|
||||
avcodec/h2645_sei: don't use provider_code uninitialized
|
||||
(fforge/pr/22943) avformat/hls_sample_encryption: add missing padding for audio setup buffer
|
||||
(fforge/pr/22826) lavc/videotoolbox_vp9: fix vpcC flags offset
|
||||
lavc/videotoolboxenc: return SEI parse errors
|
||||
vulkan: fix encode feedback query handling
|
||||
avcodec/cbs_lcevc: fix writing process blocks with size 6
|
||||
avformat/mov: don't try to create an LCEVC group if there's a single track
|
||||
(fforge/pr/22563) aarch64: Add Armv9.3-A GCS (Guarded Control Stack) support
|
||||
aarch64: hevcdsp: Make returns match the call site
|
||||
(fforge/pr/22545) avcodec/lcevcdec: don't try to derive final dimensions from SAR
|
||||
avcodec/lcevc_parser: move the resolution type table to a header
|
||||
avcodec/cbs_lcevc: don't look for process blocks if the unit was not decomposed
|
||||
|
||||
version 8.1:
|
||||
- ffprobe -codec option
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
|
||||
┌──────────────────────────────────────┐
|
||||
│ RELEASE NOTES for FFmpeg 8.1 "Hoare" │
|
||||
└──────────────────────────────────────┘
|
||||
|
||||
The FFmpeg Project proudly presents FFmpeg 8.1 "Hoare", about 7
|
||||
months after the release of FFmpeg 8.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.
|
||||
@@ -2,10 +2,6 @@ The last version increases of all libraries were on 2025-03-28
|
||||
|
||||
API changes, most recent first:
|
||||
|
||||
2026-03-14 - xxxxxxxxxx - lavu 60.26.100 - hwcontext_vulkan.h
|
||||
Deprecate AVVulkanDeviceContext.lock_queue and
|
||||
AVVulkanDeviceContext.unlock_queue without replacement.
|
||||
|
||||
2026-03-07 - c23d56b173a - lavc 62.26.100 - codec_desc.h
|
||||
Add AV_CODEC_PROP_ENHANCEMENT.
|
||||
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 8.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
|
||||
|
||||
+2
-3
@@ -253,6 +253,7 @@ void term_init(void)
|
||||
/* read a key without blocking */
|
||||
static int read_key(void)
|
||||
{
|
||||
unsigned char ch = -1;
|
||||
#if HAVE_TERMIOS_H
|
||||
int n = 1;
|
||||
struct timeval tv;
|
||||
@@ -264,7 +265,6 @@ static int read_key(void)
|
||||
tv.tv_usec = 0;
|
||||
n = select(1, &rfds, NULL, NULL, &tv);
|
||||
if (n > 0) {
|
||||
unsigned char ch;
|
||||
n = read(0, &ch, 1);
|
||||
if (n == 1)
|
||||
return ch;
|
||||
@@ -289,7 +289,6 @@ static int read_key(void)
|
||||
}
|
||||
//Read it
|
||||
if(nchars != 0) {
|
||||
unsigned char ch;
|
||||
if (read(0, &ch, 1) == 1)
|
||||
return ch;
|
||||
return 0;
|
||||
@@ -301,7 +300,7 @@ static int read_key(void)
|
||||
if(kbhit())
|
||||
return(getch());
|
||||
#endif
|
||||
return -1;
|
||||
return ch;
|
||||
}
|
||||
|
||||
static int decode_interrupt_cb(void *ctx)
|
||||
|
||||
+1
-1
@@ -469,7 +469,7 @@ typedef struct Decoder {
|
||||
|
||||
enum AVMediaType type;
|
||||
|
||||
uint8_t *subtitle_header;
|
||||
const uint8_t *subtitle_header;
|
||||
int subtitle_header_size;
|
||||
|
||||
// number of frames/samples retrieved from the decoder
|
||||
|
||||
+2
-11
@@ -136,8 +136,6 @@ void dec_free(Decoder **pdec)
|
||||
av_frame_free(&dp->sub_prev[i]);
|
||||
av_frame_free(&dp->sub_heartbeat);
|
||||
|
||||
av_freep(&dp->dec.subtitle_header);
|
||||
|
||||
av_freep(&dp->parent_name);
|
||||
|
||||
av_freep(&dp->views_requested);
|
||||
@@ -1623,15 +1621,8 @@ static int dec_open(DecoderPriv *dp, AVDictionary **dec_opts,
|
||||
dp->dec_ctx->extra_hw_frames = extra_frames;
|
||||
}
|
||||
|
||||
if (dp->dec_ctx->subtitle_header) {
|
||||
/* ASS code assumes this buffer is null terminated so add extra byte. */
|
||||
dp->dec.subtitle_header = av_mallocz(dp->dec_ctx->subtitle_header_size + 1);
|
||||
if (!dp->dec.subtitle_header)
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(dp->dec.subtitle_header, dp->dec_ctx->subtitle_header,
|
||||
dp->dec_ctx->subtitle_header_size);
|
||||
dp->dec.subtitle_header_size = dp->dec_ctx->subtitle_header_size;
|
||||
}
|
||||
dp->dec.subtitle_header = dp->dec_ctx->subtitle_header;
|
||||
dp->dec.subtitle_header_size = dp->dec_ctx->subtitle_header_size;
|
||||
|
||||
if (param_out) {
|
||||
if (dp->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
|
||||
@@ -645,8 +645,6 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
|
||||
for (i = 0; i < o->nb_stream_maps; i++) {
|
||||
m = &o->stream_maps[i];
|
||||
if (file_idx == m->file_index &&
|
||||
m->stream_index >= 0 &&
|
||||
m->stream_index < input_files[m->file_index]->nb_streams &&
|
||||
stream_specifier_match(&ss,
|
||||
input_files[m->file_index]->ctx,
|
||||
input_files[m->file_index]->ctx->streams[m->stream_index],
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
|
||||
#include "libavutil/bprint.h"
|
||||
#include "libavutil/mem.h"
|
||||
#include "libavutil/internal.h"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -116,22 +115,14 @@ static void hwctx_lock_queue(void *priv, uint32_t qf, uint32_t qidx)
|
||||
{
|
||||
AVHWDeviceContext *avhwctx = priv;
|
||||
const AVVulkanDeviceContext *hwctx = avhwctx->hwctx;
|
||||
#if FF_API_VULKAN_SYNC_QUEUES
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
hwctx->lock_queue(avhwctx, qf, qidx);
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
}
|
||||
|
||||
static void hwctx_unlock_queue(void *priv, uint32_t qf, uint32_t qidx)
|
||||
{
|
||||
AVHWDeviceContext *avhwctx = priv;
|
||||
const AVVulkanDeviceContext *hwctx = avhwctx->hwctx;
|
||||
#if FF_API_VULKAN_SYNC_QUEUES
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
hwctx->unlock_queue(avhwctx, qf, qidx);
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
}
|
||||
|
||||
static int add_instance_extension(const char **ext, unsigned num_ext,
|
||||
@@ -292,11 +283,7 @@ static void placebo_lock_queue(struct AVHWDeviceContext *dev_ctx,
|
||||
{
|
||||
RendererContext *ctx = dev_ctx->user_opaque;
|
||||
pl_vulkan vk = ctx->placebo_vulkan;
|
||||
#if FF_API_VULKAN_SYNC_QUEUES
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
vk->lock_queue(vk, queue_family, index);
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
}
|
||||
|
||||
static void placebo_unlock_queue(struct AVHWDeviceContext *dev_ctx,
|
||||
@@ -305,11 +292,7 @@ static void placebo_unlock_queue(struct AVHWDeviceContext *dev_ctx,
|
||||
{
|
||||
RendererContext *ctx = dev_ctx->user_opaque;
|
||||
pl_vulkan vk = ctx->placebo_vulkan;
|
||||
#if FF_API_VULKAN_SYNC_QUEUES
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
vk->unlock_queue(vk, queue_family, index);
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
}
|
||||
|
||||
static int get_decode_queue(VkRenderer *renderer, int *index, int *count)
|
||||
@@ -403,12 +386,8 @@ static int create_vk_by_placebo(VkRenderer *renderer,
|
||||
device_ctx->user_opaque = ctx;
|
||||
|
||||
vk_dev_ctx = device_ctx->hwctx;
|
||||
#if FF_API_VULKAN_SYNC_QUEUES
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
vk_dev_ctx->lock_queue = placebo_lock_queue;
|
||||
vk_dev_ctx->unlock_queue = placebo_unlock_queue;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
vk_dev_ctx->get_proc_addr = ctx->placebo_instance->get_proc_addr;
|
||||
|
||||
|
||||
+1
-1
@@ -3238,7 +3238,7 @@ int main(int argc, char **argv)
|
||||
char *buf;
|
||||
char *f_name = NULL, *f_args = NULL;
|
||||
int ret, input_ret;
|
||||
AVTextFormatDataDump data_dump_format_id = AV_TEXTFORMAT_DATADUMP_XXD;
|
||||
AVTextFormatDataDump data_dump_format_id;
|
||||
|
||||
init_dynload();
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/mem.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
#include "libavutil/dict.h"
|
||||
#include "libavutil/common.h"
|
||||
|
||||
+1
-1
@@ -1277,7 +1277,7 @@ OBJS-$(CONFIG_IPU_PARSER) += ipu_parser.o
|
||||
OBJS-$(CONFIG_JPEG2000_PARSER) += jpeg2000_parser.o
|
||||
OBJS-$(CONFIG_JPEGXL_PARSER) += jpegxl_parser.o jpegxl_parse.o
|
||||
OBJS-$(CONFIG_JPEGXS_PARSER) += jpegxs_parser.o
|
||||
OBJS-$(CONFIG_LCEVC_PARSER) += lcevc_parser.o lcevctab.o
|
||||
OBJS-$(CONFIG_LCEVC_PARSER) += lcevc_parser.o
|
||||
OBJS-$(CONFIG_MISC4_PARSER) += misc4_parser.o
|
||||
OBJS-$(CONFIG_MJPEG_PARSER) += mjpeg_parser.o
|
||||
OBJS-$(CONFIG_MLP_PARSER) += mlp_parse.o mlp_parser.o mlp.o
|
||||
|
||||
@@ -2383,12 +2383,6 @@ static int decode_frame_ga(AVCodecContext *avctx, AACDecContext *ac,
|
||||
ac->oc[1].status = OC_LOCKED;
|
||||
}
|
||||
|
||||
if (samples && avctx->sample_rate <= 0) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Cannot output a frame without a valid sample rate\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (!ac->frame->data[0] && samples) {
|
||||
av_log(avctx, AV_LOG_ERROR, "no frame data found\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -215,11 +215,6 @@ static int decode_usac_element_pair(AACDecContext *ac,
|
||||
|
||||
if (e->stereo_config_index) {
|
||||
e->mps.freq_res = get_bits(gb, 3); /* bsFreqRes */
|
||||
if (!e->mps.freq_res)
|
||||
return AVERROR_INVALIDDATA; /* value 0 is reserved */
|
||||
|
||||
int numBands = ((int[]){0,28,20,14,10,7,5,4})[e->mps.freq_res]; // ISO/IEC 23003-1:2007, 5.2, Table 39
|
||||
|
||||
e->mps.fixed_gain = get_bits(gb, 3); /* bsFixedGainDMX */
|
||||
e->mps.temp_shape_config = get_bits(gb, 2); /* bsTempShapeConfig */
|
||||
e->mps.decorr_config = get_bits(gb, 2); /* bsDecorrConfig */
|
||||
@@ -227,21 +222,12 @@ static int decode_usac_element_pair(AACDecContext *ac,
|
||||
e->mps.phase_coding = get_bits1(gb); /* bsPhaseCoding */
|
||||
|
||||
e->mps.otts_bands_phase_present = get_bits1(gb);
|
||||
int otts_bands_phase = ((int[]){0,10,10,7,5,3,2,2})[e->mps.freq_res]; // Table 109 — Default value of bsOttBandsPhase
|
||||
if (e->mps.otts_bands_phase_present) { /* bsOttBandsPhasePresent */
|
||||
otts_bands_phase = get_bits(gb, 5); /* bsOttBandsPhase */
|
||||
if (otts_bands_phase > numBands)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
e->mps.otts_bands_phase = otts_bands_phase;
|
||||
if (e->mps.otts_bands_phase_present) /* bsOttBandsPhasePresent */
|
||||
e->mps.otts_bands_phase = get_bits(gb, 5); /* bsOttBandsPhase */
|
||||
|
||||
e->mps.residual_coding = e->stereo_config_index >= 2; /* bsResidualCoding */
|
||||
if (e->mps.residual_coding) {
|
||||
int residual_bands = get_bits(gb, 5); /* bsResidualBands */
|
||||
if (residual_bands > numBands)
|
||||
return AVERROR_INVALIDDATA;
|
||||
e->mps.residual_bands = residual_bands;
|
||||
|
||||
e->mps.residual_bands = get_bits(gb, 5); /* bsResidualBands */
|
||||
e->mps.otts_bands_phase = FFMAX(e->mps.otts_bands_phase,
|
||||
e->mps.residual_bands);
|
||||
e->mps.pseudo_lr = get_bits1(gb); /* bsPseudoLr */
|
||||
@@ -377,8 +363,6 @@ int ff_aac_usac_config_decode(AACDecContext *ac, AVCodecContext *avctx,
|
||||
freq_idx = get_bits(gb, 5); /* usacSamplingFrequencyIndex */
|
||||
if (freq_idx == 0x1f) {
|
||||
samplerate = get_bits(gb, 24); /* usacSamplingFrequency */
|
||||
if (samplerate == 0)
|
||||
return AVERROR(EINVAL);
|
||||
} else {
|
||||
samplerate = ff_aac_usac_samplerate[freq_idx];
|
||||
if (samplerate < 0)
|
||||
@@ -1309,8 +1293,7 @@ static void spectrum_decode(AACDecContext *ac, AACUSACConfig *usac,
|
||||
SingleChannelElement *sce = &cpe->ch[ch];
|
||||
AACUsacElemData *ue = &sce->ue;
|
||||
|
||||
if (!ue->core_mode)
|
||||
spectrum_scale(ac, sce, ue);
|
||||
spectrum_scale(ac, sce, ue);
|
||||
}
|
||||
|
||||
if (nb_channels > 1 && us->common_window) {
|
||||
@@ -1360,9 +1343,8 @@ static void spectrum_decode(AACDecContext *ac, AACUSACConfig *usac,
|
||||
if (sce->tns.present && ((nb_channels == 1) || (us->tns_on_lr)))
|
||||
ac->dsp.apply_tns(sce->coeffs, &sce->tns, &sce->ics, 1);
|
||||
|
||||
if (!sce->ue.core_mode)
|
||||
ac->oc[1].m4ac.frame_length_short ? ac->dsp.imdct_and_windowing_768(ac, sce) :
|
||||
ac->dsp.imdct_and_windowing(ac, sce);
|
||||
ac->oc[1].m4ac.frame_length_short ? ac->dsp.imdct_and_windowing_768(ac, sce) :
|
||||
ac->dsp.imdct_and_windowing(ac, sce);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1390,10 +1372,11 @@ static void decode_tsd(GetBitContext *gb, int *data,
|
||||
break;
|
||||
}
|
||||
int64_t c = k - p + 1;
|
||||
for (int h = 2; h <= p && c <= s; h++) {
|
||||
c += c*(k-p)/h;
|
||||
for (int h = 2; h <= p; h++) {
|
||||
c *= k - p + h;
|
||||
c /= h;
|
||||
}
|
||||
if (s >= c) {
|
||||
if (s >= (int)c) { /* c is long long for up to 32 slots */
|
||||
s -= c;
|
||||
data[k] = 1;
|
||||
p--;
|
||||
|
||||
@@ -464,10 +464,10 @@ static int ec_pair_dec(GetBitContext *gb,
|
||||
}
|
||||
|
||||
if (pair) {
|
||||
p_data[0] = data_diff[0];
|
||||
p_data[1] = data_diff[1];
|
||||
p_data[0] = data_pair[0];
|
||||
p_data[1] = data_pair[1];
|
||||
} else {
|
||||
p_data[0] = data_diff[0];
|
||||
p_data[0] = data_pair[0];
|
||||
p_data[1] = NULL;
|
||||
}
|
||||
|
||||
@@ -480,7 +480,7 @@ static int ec_pair_dec(GetBitContext *gb,
|
||||
if (pair && (diff_freq[0] || diff_time_back))
|
||||
diff_freq[1] = !get_bits1(gb);
|
||||
|
||||
int time_pair = 0;
|
||||
int time_pair;
|
||||
huff_decode(gb, p_data, data_type, diff_freq,
|
||||
nb_bands, &time_pair);
|
||||
|
||||
@@ -534,11 +534,11 @@ static int ec_pair_dec(GetBitContext *gb,
|
||||
}
|
||||
|
||||
/* Decode LSBs */
|
||||
attach_lsb(gb, data_pair[0], quant_offset, attach_lsb_flag,
|
||||
nb_bands, data_pair[0]);
|
||||
attach_lsb(gb, p_data[0], quant_offset, attach_lsb_flag,
|
||||
nb_bands, p_data[0]);
|
||||
if (pair)
|
||||
attach_lsb(gb, data_pair[1], quant_offset, attach_lsb_flag,
|
||||
nb_bands, data_pair[1]);
|
||||
attach_lsb(gb, p_data[1], quant_offset, attach_lsb_flag,
|
||||
nb_bands, p_data[1]);
|
||||
|
||||
memcpy(&set1[start_band], data_pair[0], 2*nb_bands);
|
||||
if (pair)
|
||||
@@ -591,6 +591,9 @@ static int get_freq_strides(int16_t *freq_strides, int band_stride,
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i <= data_bands; i++)
|
||||
freq_strides[i] = av_clip_uintp2(freq_strides[i], 2);
|
||||
|
||||
return data_bands;
|
||||
}
|
||||
|
||||
@@ -640,16 +643,15 @@ int ff_aac_ec_data_dec(GetBitContext *gb, AACMPSLosslessData *ld,
|
||||
fine_to_coarse(ld->last_data, data_type, start_band, end_band);
|
||||
}
|
||||
|
||||
int16_t freq_stride_map[MPS_MAX_PARAM_BANDS + 1];
|
||||
int data_bands = get_freq_strides(freq_stride_map,
|
||||
int data_bands = get_freq_strides(ld->freq_res,
|
||||
stride_table[ld->freq_res[set_idx]],
|
||||
start_band, end_band);
|
||||
|
||||
if (set_idx + data_pair >= MPS_MAX_PARAM_SETS)
|
||||
if (set_idx + data_pair > MPS_MAX_PARAM_SETS)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
for (int j = 0; j < data_bands; j++)
|
||||
ld->last_data[start_band + j] = ld->last_data[freq_stride_map[j]];
|
||||
ld->last_data[start_band + j] = ld->last_data[ld->freq_res[j]];
|
||||
|
||||
int err = ec_pair_dec(gb,
|
||||
ld->data[set_idx + 0], ld->data[set_idx + 1],
|
||||
@@ -662,11 +664,11 @@ int ff_aac_ec_data_dec(GetBitContext *gb, AACMPSLosslessData *ld,
|
||||
if (data_type == MPS_IPD) {
|
||||
const int mask = ld->coarse_quant[set_idx] ? 0x7 : 0xF;
|
||||
for (int j = 0; j < data_bands; j++)
|
||||
for (int k = freq_stride_map[j + 0]; k < freq_stride_map[j + 1]; k++)
|
||||
for (int k = ld->freq_res[j + 0]; k < ld->freq_res[j + 1]; k++)
|
||||
ld->last_data[k] = ld->data[set_idx + data_pair][start_band + j] & mask;
|
||||
} else {
|
||||
for (int j = 0; j < data_bands; j++)
|
||||
for (int k = freq_stride_map[j + 0]; k < freq_stride_map[j + 1]; k++)
|
||||
for (int k = ld->freq_res[j + 0]; k < ld->freq_res[j + 1]; k++)
|
||||
ld->last_data[k] = ld->data[set_idx + data_pair][start_band + j];
|
||||
}
|
||||
|
||||
|
||||
@@ -511,11 +511,8 @@ function hevc_loop_filter_luma_body_\bitdepth\()_neon, export=0
|
||||
sqxtun v6.8b, v6.8h
|
||||
sqxtun v7.8b, v7.8h
|
||||
.endif
|
||||
// Use x15 to signal whether any pixels should be updated or not.
|
||||
mov x15, #1
|
||||
ret
|
||||
3: mov x15, #0
|
||||
ret
|
||||
3: ret x6
|
||||
endfunc
|
||||
.endm
|
||||
|
||||
@@ -565,7 +562,6 @@ function ff_hevc_\dir\()_loop_filter_luma_\bitdepth\()_neon, export=1
|
||||
.endif
|
||||
.endif
|
||||
bl hevc_loop_filter_luma_body_\bitdepth\()_neon
|
||||
cbz x15, 9f
|
||||
.if \bitdepth > 8
|
||||
.ifc \dir, v
|
||||
transpose_8x8H v0, v1, v2, v3, v4, v5, v6, v7, v16, v17
|
||||
@@ -591,7 +587,6 @@ function ff_hevc_\dir\()_loop_filter_luma_\bitdepth\()_neon, export=1
|
||||
st1 {v6.8b}, [x10], x1
|
||||
st1 {v7.8b}, [x10]
|
||||
.endif
|
||||
9:
|
||||
ret x6
|
||||
endfunc
|
||||
.endm
|
||||
|
||||
@@ -56,7 +56,9 @@
|
||||
mov x11, v4.d[0]
|
||||
mov x12, v4.d[1]
|
||||
adds x11, x11, x12
|
||||
b.eq 9f
|
||||
b.ne 1f
|
||||
ret x10
|
||||
1:
|
||||
|
||||
.if \wd >= 8
|
||||
dup v0.8h, w5
|
||||
@@ -187,7 +189,13 @@
|
||||
// If no pixels need flat8in, jump to flat8out
|
||||
// (or to a writeout of the inner 4 pixels, for wd=8)
|
||||
.if \wd >= 8
|
||||
.if \wd == 16
|
||||
b.eq 6f
|
||||
.else
|
||||
b.ne 1f
|
||||
ret x13
|
||||
1:
|
||||
.endif
|
||||
|
||||
// flat8in
|
||||
add \tmp1\().8h, v20.8h, v21.8h
|
||||
@@ -241,16 +249,20 @@
|
||||
mov x11, v2.d[0]
|
||||
mov x12, v2.d[1]
|
||||
adds x11, x11, x12
|
||||
b.ne 1f
|
||||
// If no pixels needed flat8in nor flat8out, jump to a
|
||||
// writeout of the inner 4 pixels
|
||||
b.eq 7f
|
||||
ret x14
|
||||
1:
|
||||
|
||||
mov x11, v7.d[0]
|
||||
mov x12, v7.d[1]
|
||||
adds x11, x11, x12
|
||||
b.ne 1f
|
||||
// If no pixels need flat8out, jump to a writeout of the inner 6 pixels
|
||||
b.eq 8f
|
||||
ret x15
|
||||
|
||||
1:
|
||||
// flat8out
|
||||
// This writes all outputs into v2-v17 (skipping v6 and v16).
|
||||
// If this part is skipped, the output is read from v21-v26 (which is the input
|
||||
@@ -366,57 +378,35 @@
|
||||
// while we need those for inputs/outputs in wd=16 and use v8-v15
|
||||
// for temp registers there instead.
|
||||
function vp9_loop_filter_4
|
||||
mov x13, #0
|
||||
loop_filter 4, v16, v17, v18, v19, v28, v29, v30, v31
|
||||
ret
|
||||
9:
|
||||
mov x13, #(1<<9)
|
||||
ret
|
||||
endfunc
|
||||
|
||||
function vp9_loop_filter_8
|
||||
mov x13, #0
|
||||
loop_filter 8, v16, v17, v18, v19, v28, v29, v30, v31
|
||||
ret
|
||||
6:
|
||||
mov x13, #(1<<6)
|
||||
ret
|
||||
9:
|
||||
mov x13, #(1<<9)
|
||||
ret
|
||||
endfunc
|
||||
|
||||
function vp9_loop_filter_16
|
||||
mov x13, #0
|
||||
loop_filter 16, v8, v9, v10, v11, v12, v13, v14, v15
|
||||
ret
|
||||
7:
|
||||
mov x13, #(1<<7)
|
||||
ret
|
||||
8:
|
||||
mov x13, #(1<<8)
|
||||
ret
|
||||
9:
|
||||
mov x13, #(1<<9)
|
||||
ret
|
||||
endfunc
|
||||
|
||||
.macro loop_filter_4
|
||||
bl vp9_loop_filter_4
|
||||
tbnz x13, #9, 9f
|
||||
.endm
|
||||
|
||||
.macro loop_filter_8
|
||||
// calculate alternative 'return' targets
|
||||
adr x13, 6f
|
||||
bl vp9_loop_filter_8
|
||||
tbnz x13, #6, 6f
|
||||
tbnz x13, #9, 9f
|
||||
.endm
|
||||
|
||||
.macro loop_filter_16
|
||||
// calculate alternative 'return' targets
|
||||
adr x14, 7f
|
||||
adr x15, 8f
|
||||
bl vp9_loop_filter_16
|
||||
tbnz x13, #7, 7f
|
||||
tbnz x13, #8, 8f
|
||||
tbnz x13, #9, 9f
|
||||
.endm
|
||||
|
||||
|
||||
@@ -550,7 +540,7 @@ function vp9_loop_filter_v_4_8_16_neon
|
||||
st1 {v23.8h}, [x9], x1
|
||||
st1 {v25.8h}, [x0], x1
|
||||
sub x0, x0, x1, lsl #1
|
||||
9:
|
||||
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
@@ -598,7 +588,7 @@ function vp9_loop_filter_h_4_8_16_neon
|
||||
st1 {v25.d}[1], [x0], x1
|
||||
sub x0, x0, x1, lsl #3
|
||||
add x0, x0, #4
|
||||
9:
|
||||
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
@@ -629,7 +619,7 @@ function vp9_loop_filter_v_8_8_16_neon
|
||||
st1 {v26.8h}, [x0], x1
|
||||
sub x0, x0, x1, lsl #1
|
||||
sub x0, x0, x1
|
||||
9:
|
||||
|
||||
ret x10
|
||||
6:
|
||||
sub x9, x0, x1, lsl #1
|
||||
@@ -680,7 +670,7 @@ function vp9_loop_filter_h_8_8_16_neon
|
||||
st1 {v27.8h}, [x0], x1
|
||||
sub x0, x0, x1, lsl #3
|
||||
add x0, x0, #8
|
||||
9:
|
||||
|
||||
ret x10
|
||||
6:
|
||||
// If we didn't need to do the flat8in part, we use the same writeback
|
||||
@@ -752,7 +742,7 @@ function vp9_loop_filter_v_16_8_16_neon
|
||||
st1 {v17.8h}, [x0], x1
|
||||
sub x0, x0, x1, lsl #3
|
||||
add x0, x0, x1
|
||||
9:
|
||||
|
||||
ret x10
|
||||
8:
|
||||
add x9, x9, x1, lsl #2
|
||||
@@ -830,7 +820,7 @@ function vp9_loop_filter_h_16_8_16_neon
|
||||
st1 {v9.8h}, [x9], x1
|
||||
st1 {v31.8h}, [x0], x1
|
||||
sub x0, x0, x1, lsl #3
|
||||
9:
|
||||
|
||||
ret x10
|
||||
8:
|
||||
// The same writeback as in loop_filter_h_8_8
|
||||
|
||||
@@ -388,28 +388,32 @@
|
||||
.endif
|
||||
.if \wd == 16
|
||||
6:
|
||||
// If no pixels needed flat8in nor flat8out, jump to a
|
||||
// writeout of the inner 4 pixels
|
||||
orr v2\sz, v6\sz, v7\sz
|
||||
mov x5, v2.d[0]
|
||||
.ifc \sz, .16b
|
||||
mov x6, v2.d[1]
|
||||
adds x5, x5, x6
|
||||
b.eq 7f
|
||||
b.ne 1f
|
||||
.else
|
||||
cbz x5, 7f
|
||||
cbnz x5, 1f
|
||||
.endif
|
||||
// If no pixels needed flat8in nor flat8out, jump to a
|
||||
// writeout of the inner 4 pixels
|
||||
ret x14
|
||||
1:
|
||||
|
||||
// If no pixels need flat8out, jump to a writeout of the inner 6 pixels
|
||||
mov x5, v7.d[0]
|
||||
.ifc \sz, .16b
|
||||
mov x6, v7.d[1]
|
||||
adds x5, x5, x6
|
||||
b.eq 8f
|
||||
b.ne 1f
|
||||
.else
|
||||
cbz x5, 8f
|
||||
cbnz x5, 1f
|
||||
.endif
|
||||
// If no pixels need flat8out, jump to a writeout of the inner 6 pixels
|
||||
ret x15
|
||||
|
||||
1:
|
||||
// flat8out
|
||||
// This writes all outputs into v2-v17 (skipping v6 and v16).
|
||||
// If this part is skipped, the output is read from v21-v26 (which is the input
|
||||
@@ -525,94 +529,76 @@
|
||||
// while we need those for inputs/outputs in wd=16 and use v8-v15
|
||||
// for temp registers there instead.
|
||||
function vp9_loop_filter_4
|
||||
mov x13, #0
|
||||
loop_filter 4, .8b, 0, v16, v17, v18, v19, v28, v29, v30, v31
|
||||
ret
|
||||
9:
|
||||
mov x13, #(1<<9)
|
||||
ret
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
function vp9_loop_filter_4_16b_mix_44
|
||||
mov x13, #0
|
||||
loop_filter 4, .16b, 44, v16, v17, v18, v19, v28, v29, v30, v31
|
||||
ret
|
||||
9:
|
||||
mov x13, #(1<<9)
|
||||
ret
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
function vp9_loop_filter_8
|
||||
mov x13, #0
|
||||
loop_filter 8, .8b, 0, v16, v17, v18, v19, v28, v29, v30, v31
|
||||
ret
|
||||
6:
|
||||
mov x13, #(1<<6)
|
||||
ret
|
||||
ret x13
|
||||
9:
|
||||
mov x13, #(1<<9)
|
||||
ret
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
function vp9_loop_filter_8_16b_mix
|
||||
mov x13, #0
|
||||
loop_filter 8, .16b, 88, v16, v17, v18, v19, v28, v29, v30, v31
|
||||
ret
|
||||
6:
|
||||
mov x13, #(1<<6)
|
||||
ret
|
||||
ret x13
|
||||
9:
|
||||
mov x13, #(1<<9)
|
||||
ret
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
function vp9_loop_filter_16
|
||||
mov x13, #0
|
||||
loop_filter 16, .8b, 0, v8, v9, v10, v11, v12, v13, v14, v15
|
||||
ret
|
||||
7:
|
||||
mov x13, #(1<<7)
|
||||
ret
|
||||
8:
|
||||
mov x13, #(1<<8)
|
||||
ret
|
||||
9:
|
||||
mov x13, #(1<<9)
|
||||
ret
|
||||
ldp d10, d11, [sp, #0x10]
|
||||
ldp d12, d13, [sp, #0x20]
|
||||
ldp d14, d15, [sp, #0x30]
|
||||
ldp d8, d9, [sp], #0x40
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
function vp9_loop_filter_16_16b
|
||||
mov x13, #0
|
||||
loop_filter 16, .16b, 0, v8, v9, v10, v11, v12, v13, v14, v15
|
||||
ret
|
||||
7:
|
||||
mov x13, #(1<<7)
|
||||
ret
|
||||
8:
|
||||
mov x13, #(1<<8)
|
||||
ret
|
||||
9:
|
||||
mov x13, #(1<<9)
|
||||
ret
|
||||
ldp d10, d11, [sp, #0x10]
|
||||
ldp d12, d13, [sp, #0x20]
|
||||
ldp d14, d15, [sp, #0x30]
|
||||
ldp d8, d9, [sp], #0x40
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
.macro loop_filter_4
|
||||
bl vp9_loop_filter_4
|
||||
tbnz x13, #9, 9f
|
||||
.endm
|
||||
|
||||
.macro loop_filter_4_16b_mix mix
|
||||
bl vp9_loop_filter_4_16b_mix_\mix
|
||||
tbnz x13, #9, 9f
|
||||
.endm
|
||||
|
||||
.macro loop_filter_8
|
||||
// calculate alternative 'return' targets
|
||||
adr x13, 6f
|
||||
bl vp9_loop_filter_8
|
||||
tbnz x13, #6, 6f
|
||||
tbnz x13, #9, 9f
|
||||
.endm
|
||||
|
||||
.macro loop_filter_8_16b_mix mix
|
||||
// calculate alternative 'return' targets
|
||||
adr x13, 6f
|
||||
.if \mix == 48
|
||||
mov x11, #0xffffffff00000000
|
||||
.elseif \mix == 84
|
||||
@@ -621,22 +607,20 @@ endfunc
|
||||
mov x11, #0xffffffffffffffff
|
||||
.endif
|
||||
bl vp9_loop_filter_8_16b_mix
|
||||
tbnz x13, #6, 6f
|
||||
tbnz x13, #9, 9f
|
||||
.endm
|
||||
|
||||
.macro loop_filter_16
|
||||
// calculate alternative 'return' targets
|
||||
adr x14, 7f
|
||||
adr x15, 8f
|
||||
bl vp9_loop_filter_16
|
||||
tbnz x13, #7, 7f
|
||||
tbnz x13, #8, 8f
|
||||
tbnz x13, #9, 9f
|
||||
.endm
|
||||
|
||||
.macro loop_filter_16_16b
|
||||
// calculate alternative 'return' targets
|
||||
adr x14, 7f
|
||||
adr x15, 8f
|
||||
bl vp9_loop_filter_16_16b
|
||||
tbnz x13, #7, 7f
|
||||
tbnz x13, #8, 8f
|
||||
tbnz x13, #9, 9f
|
||||
.endm
|
||||
|
||||
|
||||
@@ -663,7 +647,7 @@ function ff_vp9_loop_filter_v_4_8_neon, export=1
|
||||
st1 {v24.8b}, [x0], x1
|
||||
st1 {v23.8b}, [x9], x1
|
||||
st1 {v25.8b}, [x0], x1
|
||||
9:
|
||||
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
@@ -687,7 +671,7 @@ function ff_vp9_loop_filter_v_44_16_neon, export=1
|
||||
st1 {v24.16b}, [x0], x1
|
||||
st1 {v23.16b}, [x9], x1
|
||||
st1 {v25.16b}, [x0], x1
|
||||
9:
|
||||
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
@@ -729,7 +713,7 @@ function ff_vp9_loop_filter_h_4_8_neon, export=1
|
||||
st1 {v24.s}[1], [x0], x1
|
||||
st1 {v25.s}[0], [x9], x1
|
||||
st1 {v25.s}[1], [x0], x1
|
||||
9:
|
||||
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
@@ -781,7 +765,7 @@ function ff_vp9_loop_filter_h_44_16_neon, export=1
|
||||
st1 {v24.s}[3], [x0], x1
|
||||
st1 {v25.s}[1], [x9], x1
|
||||
st1 {v25.s}[3], [x0], x1
|
||||
9:
|
||||
|
||||
ret x10
|
||||
endfunc
|
||||
|
||||
@@ -808,7 +792,7 @@ function ff_vp9_loop_filter_v_8_8_neon, export=1
|
||||
st1 {v25.8b}, [x0], x1
|
||||
st1 {v23.8b}, [x9], x1
|
||||
st1 {v26.8b}, [x0], x1
|
||||
9:
|
||||
|
||||
ret x10
|
||||
6:
|
||||
sub x9, x0, x1, lsl #1
|
||||
@@ -843,7 +827,7 @@ function ff_vp9_loop_filter_v_\mix\()_16_neon, export=1
|
||||
st1 {v25.16b}, [x0], x1
|
||||
st1 {v23.16b}, [x9], x1
|
||||
st1 {v26.16b}, [x0], x1
|
||||
9:
|
||||
|
||||
ret x10
|
||||
6:
|
||||
sub x9, x0, x1, lsl #1
|
||||
@@ -891,7 +875,7 @@ function ff_vp9_loop_filter_h_8_8_neon, export=1
|
||||
st1 {v26.8b}, [x0], x1
|
||||
st1 {v23.8b}, [x9], x1
|
||||
st1 {v27.8b}, [x0], x1
|
||||
9:
|
||||
|
||||
ret x10
|
||||
6:
|
||||
// If we didn't need to do the flat8in part, we use the same writeback
|
||||
@@ -957,7 +941,7 @@ function ff_vp9_loop_filter_h_\mix\()_16_neon, export=1
|
||||
st1 {v26.d}[1], [x0], x1
|
||||
st1 {v27.8b}, [x9], x1
|
||||
st1 {v27.d}[1], [x0], x1
|
||||
9:
|
||||
|
||||
ret x10
|
||||
6:
|
||||
add x9, x9, #2
|
||||
|
||||
+3
-4
@@ -294,8 +294,7 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
|
||||
break;
|
||||
case AV_CODEC_ID_ADPCM_PSXC:
|
||||
max_channels = 8;
|
||||
if (avctx->ch_layout.nb_channels <= 0 || avctx->block_align <= 0 ||
|
||||
avctx->block_align % avctx->ch_layout.nb_channels)
|
||||
if (avctx->ch_layout.nb_channels <= 0 || avctx->block_align <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
break;
|
||||
case AV_CODEC_ID_ADPCM_IMA_DAT4:
|
||||
@@ -1174,7 +1173,7 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
|
||||
|
||||
if(ch <= 0)
|
||||
return 0;
|
||||
if (buf_size > INT_MAX / 14)
|
||||
if (buf_size > INT_MAX / 2)
|
||||
return 0;
|
||||
|
||||
switch (avctx->codec->id) {
|
||||
@@ -2705,7 +2704,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
|
||||
for (int k = i-1; k > -1; k--) {
|
||||
for (int o = 1; o < order; o++)
|
||||
delta += sf_codes[(i-1) - k] * (unsigned)coefs[(o*8) + k];
|
||||
delta += sf_codes[(i-1) - k] * coefs[(o*8) + k];
|
||||
}
|
||||
|
||||
sample = sf_codes[i] * 2048;
|
||||
|
||||
+6
-10
@@ -409,14 +409,12 @@ static int decode_inter_plane(AGMContext *s, GetBitContext *gb, int size,
|
||||
int map = s->map[x];
|
||||
|
||||
if (orig_mv_x >= -32) {
|
||||
int src_y = (s->blocks_h - 1 - y) * 8 - mv_y;
|
||||
int src_x = x * 8 + mv_x;
|
||||
if (src_y < 0 || src_y + 8 > h ||
|
||||
src_x < 0 || src_x + 8 > w)
|
||||
if (y * 8 + mv_y < 0 || y * 8 + mv_y + 8 > h ||
|
||||
x * 8 + mv_x < 0 || x * 8 + mv_x + 8 > w)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
copy_block8(frame->data[plane] + (s->blocks_h - 1 - y) * 8 * frame->linesize[plane] + x * 8,
|
||||
prev->data[plane] + src_y * prev->linesize[plane] + src_x,
|
||||
prev->data[plane] + ((s->blocks_h - 1 - y) * 8 - mv_y) * prev->linesize[plane] + (x * 8 + mv_x),
|
||||
frame->linesize[plane], prev->linesize[plane], 8);
|
||||
if (map) {
|
||||
s->idsp.idct(s->wblocks + x * 64);
|
||||
@@ -448,14 +446,12 @@ static int decode_inter_plane(AGMContext *s, GetBitContext *gb, int size,
|
||||
return ret;
|
||||
|
||||
if (orig_mv_x >= -32) {
|
||||
int src_y = (s->blocks_h - 1 - y) * 8 - mv_y;
|
||||
int src_x = x * 8 + mv_x;
|
||||
if (src_y < 0 || src_y + 8 > h ||
|
||||
src_x < 0 || src_x + 8 > w)
|
||||
if (y * 8 + mv_y < 0 || y * 8 + mv_y + 8 > h ||
|
||||
x * 8 + mv_x < 0 || x * 8 + mv_x + 8 > w)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
copy_block8(frame->data[plane] + (s->blocks_h - 1 - y) * 8 * frame->linesize[plane] + x * 8,
|
||||
prev->data[plane] + src_y * prev->linesize[plane] + src_x,
|
||||
prev->data[plane] + ((s->blocks_h - 1 - y) * 8 - mv_y) * prev->linesize[plane] + (x * 8 + mv_x),
|
||||
frame->linesize[plane], prev->linesize[plane], 8);
|
||||
if (map) {
|
||||
s->idsp.idct(s->block);
|
||||
|
||||
+4
-13
@@ -1548,12 +1548,8 @@ static int read_diff_float_data(ALSDecContext *ctx, unsigned int ra_frame) {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
j = 0;
|
||||
for (i = 0; i < frame_length; ++i) {
|
||||
if (ctx->raw_samples[c][i] == 0) {
|
||||
ctx->raw_mantissa[c][i] = AV_RB32(larray + j);
|
||||
j += 4;
|
||||
}
|
||||
ctx->raw_mantissa[c][i] = AV_RB32(larray);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1564,10 +1560,7 @@ static int read_diff_float_data(ALSDecContext *ctx, unsigned int ra_frame) {
|
||||
if (ctx->raw_samples[c][i] != 0) {
|
||||
//The following logic is taken from Table 14.45 and 14.46 from the ISO spec
|
||||
if (av_cmp_sf_ieee754(acf[c], FLOAT_1)) {
|
||||
int nbit = av_log2(FFABSU(ctx->raw_samples[c][i]));
|
||||
if (nbit > 23)
|
||||
return AVERROR_INVALIDDATA;
|
||||
nbits[i] = 23 - nbit;
|
||||
nbits[i] = 23 - av_log2(abs(ctx->raw_samples[c][i]));
|
||||
} else {
|
||||
nbits[i] = 23;
|
||||
}
|
||||
@@ -1641,7 +1634,7 @@ static int read_diff_float_data(ALSDecContext *ctx, unsigned int ra_frame) {
|
||||
tmp_32 = (sign << 31) | ((e + EXP_BIAS) << 23) | (mantissa);
|
||||
ctx->raw_samples[c][i] = tmp_32;
|
||||
} else {
|
||||
ctx->raw_samples[c][i] = raw_mantissa[c][i];
|
||||
ctx->raw_samples[c][i] = raw_mantissa[c][i] & 0x007fffffUL;
|
||||
}
|
||||
}
|
||||
align_get_bits(gb);
|
||||
@@ -1797,9 +1790,7 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
|
||||
}
|
||||
|
||||
if (sconf->floating) {
|
||||
ret = read_diff_float_data(ctx, ra_frame);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
read_diff_float_data(ctx, ra_frame);
|
||||
}
|
||||
|
||||
if (get_bits_left(gb) < 0) {
|
||||
|
||||
@@ -152,9 +152,8 @@ int ff_aom_parse_film_grain_sets(AVFilmGrainAFGS1Params *s,
|
||||
payload_4byte = get_bits1(gb);
|
||||
payload_size = get_bits(gb, payload_4byte ? 2 : 8);
|
||||
set_idx = get_bits(gb, 3);
|
||||
|
||||
fgp = av_film_grain_params_alloc(&fgp_size);
|
||||
if (!fgp || s->sets[set_idx])
|
||||
if (!fgp)
|
||||
goto error;
|
||||
aom = &fgp->codec.aom;
|
||||
|
||||
@@ -213,7 +212,7 @@ int ff_aom_parse_film_grain_sets(AVFilmGrainAFGS1Params *s,
|
||||
}
|
||||
|
||||
predict_scaling = get_bits1(gb);
|
||||
if (predict_scaling && !ref)
|
||||
if (predict_scaling && (!ref || ref == fgp))
|
||||
goto error; // prediction must be from valid, different set
|
||||
|
||||
predict_y_scaling = predict_scaling ? get_bits1(gb) : 0;
|
||||
|
||||
@@ -208,13 +208,14 @@ static int apv_decode_tile_component(AVCodecContext *avctx, void *data,
|
||||
{
|
||||
APVRawFrame *input = data;
|
||||
APVDecodeContext *apv = avctx->priv_data;
|
||||
const CodedBitstreamAPVContext *apv_cbc = apv->cbc->priv_data;
|
||||
const APVDerivedTileInfo *tile_info = &apv->tile_info;
|
||||
|
||||
int tile_index = job / apv_cbc->num_comp;
|
||||
int comp_index = job % apv_cbc->num_comp;
|
||||
|
||||
const AVPixFmtDescriptor *pix_fmt_desc =
|
||||
av_pix_fmt_desc_get(avctx->pix_fmt);
|
||||
int nb_components = pix_fmt_desc->nb_components;
|
||||
|
||||
int tile_index = job / nb_components;
|
||||
int comp_index = job % nb_components;
|
||||
|
||||
int sub_w_shift = comp_index == 0 ? 0 : pix_fmt_desc->log2_chroma_w;
|
||||
int sub_h_shift = comp_index == 0 ? 0 : pix_fmt_desc->log2_chroma_h;
|
||||
@@ -265,7 +266,7 @@ static int apv_decode_tile_component(AVCodecContext *avctx, void *data,
|
||||
int qp = tile->tile_header.tile_qp[comp_index];
|
||||
int level_scale = apv_level_scale[qp % 6];
|
||||
|
||||
bit_depth = input->frame_header.frame_info.bit_depth_minus8 + 8;
|
||||
bit_depth = apv_cbc->bit_depth;
|
||||
qp_shift = qp / 6;
|
||||
|
||||
for (int y = 0; y < 8; y++) {
|
||||
|
||||
+3
-4
@@ -99,11 +99,12 @@ static int32_t decode_signed_subexp_with_ref(uint32_t sub_exp, int low,
|
||||
|
||||
static void read_global_param(AV1DecContext *s, int type, int ref, int idx)
|
||||
{
|
||||
int primary_frame;
|
||||
uint8_t primary_frame, prev_frame;
|
||||
uint32_t abs_bits, prec_bits, round, prec_diff, sub, mx;
|
||||
int32_t r, prev_gm_param;
|
||||
|
||||
primary_frame = s->raw_frame_header->primary_ref_frame;
|
||||
prev_frame = s->raw_frame_header->ref_frame_idx[primary_frame];
|
||||
abs_bits = AV1_GM_ABS_ALPHA_BITS;
|
||||
prec_bits = AV1_GM_ALPHA_PREC_BITS;
|
||||
|
||||
@@ -113,10 +114,8 @@ static void read_global_param(AV1DecContext *s, int type, int ref, int idx)
|
||||
*/
|
||||
if (s->raw_frame_header->primary_ref_frame == AV1_PRIMARY_REF_NONE)
|
||||
prev_gm_param = s->cur_frame.gm_params[ref][idx];
|
||||
else {
|
||||
int prev_frame = s->raw_frame_header->ref_frame_idx[primary_frame];
|
||||
else
|
||||
prev_gm_param = s->ref[prev_frame].gm_params[ref][idx];
|
||||
}
|
||||
|
||||
if (idx < 2) {
|
||||
if (type == AV1_WARP_MODEL_TRANSLATION) {
|
||||
|
||||
@@ -412,23 +412,11 @@ static int hevc_init_nb_frame(AVBSFContext *ctx, int poc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef struct DTS2PTSCollect {
|
||||
int gop;
|
||||
DTS2PTSNode **out;
|
||||
int count;
|
||||
int max;
|
||||
} DTS2PTSCollect;
|
||||
|
||||
static int collect_same_gop(void *opaque, void *elem)
|
||||
static int same_gop(void *opaque, void *elem)
|
||||
{
|
||||
DTS2PTSCollect *c = opaque;
|
||||
DTS2PTSNode *node = elem;
|
||||
if (node->gop == c->gop) {
|
||||
if (c->count < c->max)
|
||||
c->out[c->count] = node;
|
||||
c->count++;
|
||||
}
|
||||
return 0;
|
||||
int gop = ((int *)opaque)[1];
|
||||
return FFDIFFSIGN(gop, node->gop);
|
||||
}
|
||||
|
||||
static int hevc_queue_frame(AVBSFContext *ctx, AVPacket *pkt, int poc, bool *queued)
|
||||
@@ -452,26 +440,10 @@ static int hevc_queue_frame(AVBSFContext *ctx, AVPacket *pkt, int poc, bool *que
|
||||
}
|
||||
|
||||
if (poc < s->nb_frame && hevc->gop == s->gop) {
|
||||
int dec = s->nb_frame - poc;
|
||||
DTS2PTSNode *nodes[HEVC_MAX_DPB_SIZE * 2];
|
||||
DTS2PTSCollect c = { s->gop, nodes, 0, FF_ARRAY_ELEMS(nodes) };
|
||||
int tmp[] = {s->nb_frame - poc, s->gop};
|
||||
|
||||
s->nb_frame -= dec;
|
||||
|
||||
av_tree_enumerate(s->root, &c, NULL, collect_same_gop);
|
||||
av_assert0(c.count <= c.max);
|
||||
for (int i = 0; i < c.count; i++) {
|
||||
struct AVTreeNode *tnode = NULL;
|
||||
DTS2PTSNode *r;
|
||||
av_tree_insert(&s->root, nodes[i], cmp_insert, &tnode);
|
||||
nodes[i]->poc -= dec;
|
||||
r = av_tree_insert(&s->root, nodes[i], cmp_insert, &tnode);
|
||||
if (r && r != nodes[i]) {
|
||||
*r = *nodes[i];
|
||||
av_refstruct_unref(&nodes[i]);
|
||||
av_free(tnode);
|
||||
}
|
||||
}
|
||||
s->nb_frame -= tmp[0];
|
||||
av_tree_enumerate(s->root, tmp, same_gop, dec_poc);
|
||||
}
|
||||
|
||||
ret = alloc_and_insert_node(ctx, pkt->dts, pkt->duration, s->nb_frame, 1, s->gop);
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "h2645_parse.h"
|
||||
#include "h264.h"
|
||||
#include "lcevc.h"
|
||||
#include "lcevc_parse.h"
|
||||
#include "startcode.h"
|
||||
#include "vc1_common.h"
|
||||
#include "vvc.h"
|
||||
@@ -269,6 +268,22 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline uint64_t get_mb(GetBitContext *s) {
|
||||
int more, i = 0;
|
||||
uint64_t mb = 0;
|
||||
|
||||
do {
|
||||
int byte = get_bits(s, 8);
|
||||
unsigned bits = byte & 0x7f;
|
||||
more = byte & 0x80;
|
||||
mb = (mb << 7) | bits;
|
||||
if (++i == 10)
|
||||
break;
|
||||
} while (more);
|
||||
|
||||
return mb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rewrite the NALu stripping the unneeded blocks.
|
||||
* Given that length fields coded inside the NALu are not aware of any emulation_3bytes
|
||||
@@ -289,8 +304,7 @@ static int write_lcevc_nalu(AVBSFContext *ctx, PutByteContext *pbc, const H2645N
|
||||
|
||||
while (bytestream2_get_bytes_left(&gbc) > 1) {
|
||||
GetBitContext gb;
|
||||
int payload_size_type, payload_type;
|
||||
uint64_t payload_size;
|
||||
int payload_size_type, payload_type, payload_size;
|
||||
int block_size, raw_block_size, block_end;
|
||||
|
||||
init_get_bits8(&gb, gbc.buffer, bytestream2_get_bytes_left(&gbc));
|
||||
@@ -303,9 +317,6 @@ static int write_lcevc_nalu(AVBSFContext *ctx, PutByteContext *pbc, const H2645N
|
||||
if (payload_size_type == 7)
|
||||
payload_size = get_mb(&gb);
|
||||
|
||||
if (payload_size > INT_MAX - (get_bits_count(&gb) >> 3))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
block_size = raw_block_size = payload_size + (get_bits_count(&gb) >> 3);
|
||||
if (block_size >= bytestream2_get_bytes_left(&gbc))
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -369,9 +380,8 @@ static int extract_extradata_lcevc(AVBSFContext *ctx, AVPacket *pkt,
|
||||
for (i = 0; i < s->h2645_pkt.nb_nals; i++) {
|
||||
H2645NAL *nal = &s->h2645_pkt.nals[i];
|
||||
if (val_in_array(extradata_nal_types, nb_extradata_nal_types, nal->type)) {
|
||||
// dummy pass to find sc, gc or ai. A dummy pointer is used to prevent
|
||||
// UB in PutByteContext. Nothing will be written.
|
||||
bytestream2_init_writer(&pb_extradata, nal->data, 0);
|
||||
bytestream2_init_writer(&pb_extradata, NULL, 0);
|
||||
// dummy pass to find sc, gc or ai
|
||||
if (!write_lcevc_nalu(ctx, &pb_extradata, nal, 0))
|
||||
extradata_size += nal->raw_size + 3;
|
||||
}
|
||||
@@ -397,10 +407,14 @@ static int extract_extradata_lcevc(AVBSFContext *ctx, AVPacket *pkt,
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
*data = extradata;
|
||||
*size = 0;
|
||||
|
||||
bytestream2_init_writer(&pb_extradata, extradata, extradata_size);
|
||||
if (s->remove)
|
||||
bytestream2_init_writer(&pb_filtered_data, filtered_buf->data, filtered_size);
|
||||
|
||||
filtered_size = 0;
|
||||
for (i = 0; i < s->h2645_pkt.nb_nals; i++) {
|
||||
H2645NAL *nal = &s->h2645_pkt.nals[i];
|
||||
if (val_in_array(extradata_nal_types, nb_extradata_nal_types,
|
||||
@@ -408,34 +422,33 @@ static int extract_extradata_lcevc(AVBSFContext *ctx, AVPacket *pkt,
|
||||
bytestream2_put_be24(&pb_extradata, 1); //startcode
|
||||
ret = write_lcevc_nalu(ctx, &pb_extradata, nal, 0);
|
||||
if (ret < 0) {
|
||||
av_freep(&extradata);
|
||||
av_freep(data);
|
||||
av_buffer_unref(&filtered_buf);
|
||||
return ret;
|
||||
}
|
||||
*size += ret;
|
||||
if (s->remove) {
|
||||
bytestream2_put_be24(&pb_filtered_data, 1); //startcode
|
||||
ret = write_lcevc_nalu(ctx, &pb_filtered_data, nal, 1);
|
||||
if (ret < 0) {
|
||||
av_freep(&extradata);
|
||||
av_freep(data);
|
||||
av_buffer_unref(&filtered_buf);
|
||||
return ret;
|
||||
}
|
||||
filtered_size += ret;
|
||||
}
|
||||
} else if (s->remove) {
|
||||
bytestream2_put_be24(&pb_filtered_data, 1); //startcode
|
||||
bytestream2_put_bufferu(&pb_filtered_data, nal->raw_data, nal->raw_size);
|
||||
filtered_size += nal->raw_size;
|
||||
}
|
||||
}
|
||||
*data = extradata;
|
||||
*size = bytestream2_tell_p(&pb_extradata);
|
||||
av_assert0(*size <= extradata_size);
|
||||
|
||||
if (s->remove) {
|
||||
av_assert0(bytestream2_tell_p(&pb_filtered_data) <= filtered_size);
|
||||
av_buffer_unref(&pkt->buf);
|
||||
pkt->buf = filtered_buf;
|
||||
pkt->data = filtered_buf->data;
|
||||
pkt->size = bytestream2_tell_p(&pb_filtered_data);
|
||||
pkt->size = filtered_size;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ static int ff_smpte436m_to_eia608_filter(AVBSFContext *ctx, AVPacket *out)
|
||||
return 0;
|
||||
}
|
||||
if (ret != AVERROR_EOF)
|
||||
goto fail;
|
||||
return ret;
|
||||
ret = AVERROR(EAGAIN);
|
||||
|
||||
fail:
|
||||
|
||||
@@ -186,13 +186,10 @@ static int FUNC(decoder_model_info)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
static int FUNC(sequence_header_obu)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
AV1RawSequenceHeader *current)
|
||||
{
|
||||
CodedBitstreamAV1Context *priv = ctx->priv_data;
|
||||
int i, err;
|
||||
|
||||
HEADER("Sequence Header");
|
||||
|
||||
priv->seen_frame_header = 0;
|
||||
|
||||
fc(3, seq_profile, AV_PROFILE_AV1_MAIN,
|
||||
AV_PROFILE_AV1_PROFESSIONAL);
|
||||
flag(still_picture);
|
||||
|
||||
@@ -1133,7 +1133,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
max_width_minus1 = tmp_width_val - 1;
|
||||
max_height_minus1 = tmp_height_val - 1;
|
||||
|
||||
u(1, sps_subpic_info_present_flag, 0, !current->sps_res_change_in_clvs_allowed_flag);
|
||||
flag(sps_subpic_info_present_flag);
|
||||
if (current->sps_subpic_info_present_flag) {
|
||||
ue(sps_num_subpics_minus1, 0, VVC_MAX_SLICES - 1);
|
||||
if (current->sps_num_subpics_minus1 > 0) {
|
||||
@@ -1216,7 +1216,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
int num_subpic_cols = tmp_width_val /
|
||||
(current->sps_subpic_width_minus1[0] + 1);
|
||||
if (tmp_width_val % (current->sps_subpic_width_minus1[0] + 1) ||
|
||||
tmp_height_val % (current->sps_subpic_height_minus1[0] + 1) ||
|
||||
tmp_height_val % (current->sps_subpic_width_minus1[0] + 1) ||
|
||||
current->sps_num_subpics_minus1 !=
|
||||
(num_subpic_cols * tmp_height_val /
|
||||
(current->sps_subpic_height_minus1[0] + 1) - 1))
|
||||
@@ -1971,8 +1971,6 @@ static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw,
|
||||
current->slice_top_left_tile_idx[i] = tile_idx;
|
||||
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;
|
||||
if (tile_x != current->num_tile_columns - 1) {
|
||||
ues(pps_slice_width_in_tiles_minus1[i],
|
||||
0, current->num_tile_columns - 1 - tile_x, 1, i);
|
||||
@@ -2022,7 +2020,7 @@ static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw,
|
||||
for (j = 0; j < current->pps_num_exp_slices_in_tile[i];
|
||||
j++) {
|
||||
ues(pps_exp_slice_height_in_ctus_minus1[i][j], 0,
|
||||
remaining_height_in_ctbs_y - (current->pps_num_exp_slices_in_tile[i] - j), 2,
|
||||
remaining_height_in_ctbs_y - 1, 2,
|
||||
i, j);
|
||||
slice_height_in_ctus =
|
||||
current->
|
||||
@@ -3145,7 +3143,7 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
|
||||
|
||||
if (!pps->pps_rect_slice_flag &&
|
||||
pps->num_tiles_in_pic - current->sh_slice_address > 1)
|
||||
ue(sh_num_tiles_in_slice_minus1, 0, pps->num_tiles_in_pic - 1 - current->sh_slice_address);
|
||||
ue(sh_num_tiles_in_slice_minus1, 0, pps->num_tiles_in_pic - 1);
|
||||
else
|
||||
infer(sh_num_tiles_in_slice_minus1, 0);
|
||||
|
||||
@@ -3508,7 +3506,7 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
|
||||
tile_idx <=
|
||||
current->sh_slice_address +
|
||||
current->sh_num_tiles_in_slice_minus1; tile_idx++) {
|
||||
tile_y = tile_idx / pps->num_tile_columns;
|
||||
tile_y = tile_idx / pps->num_tile_rows;
|
||||
height = pps->row_height_val[tile_y];
|
||||
current->num_entry_points += (entropy_sync ? height : 1);
|
||||
}
|
||||
|
||||
@@ -674,9 +674,6 @@ int ff_cbs_lcevc_find_process_block(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamUnit *unit = &au->units[i];
|
||||
LCEVCRawProcessBlockList *list;
|
||||
|
||||
if (!unit->content)
|
||||
continue;
|
||||
|
||||
err = cbs_lcevc_get_process_block_list(ctx, unit, &list);
|
||||
if (err < 0)
|
||||
continue;
|
||||
|
||||
@@ -635,8 +635,6 @@ static int FUNC(process_block_list)(CodedBitstreamContext *ctx, RWContext *rw,
|
||||
*rw = start_state;
|
||||
|
||||
tmp = FFMIN(block->payload_size, 7);
|
||||
if (tmp == 6)
|
||||
tmp = 7;
|
||||
xu(3, payload_size_type, tmp, 0, 7, 0);
|
||||
xu(5, payload_type, block->payload_type, 0, MAX_UINT_BITS(5), 0);
|
||||
|
||||
|
||||
+2
-5
@@ -1080,7 +1080,6 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
|
||||
int s = 0;
|
||||
unsigned int channel_mask = 0;
|
||||
int samples_per_frame = 0;
|
||||
int total_channels = 0;
|
||||
int ret;
|
||||
int channels = avctx->ch_layout.nb_channels;
|
||||
|
||||
@@ -1238,12 +1237,10 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
|
||||
q->subpacket[s].gains2.now = q->subpacket[s].gain_3;
|
||||
q->subpacket[s].gains2.previous = q->subpacket[s].gain_4;
|
||||
|
||||
if (total_channels + q->subpacket[s].num_channels > channels) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Too many subpacket channels %d for channels %d\n",
|
||||
total_channels + q->subpacket[s].num_channels, channels);
|
||||
if (q->num_subpackets + q->subpacket[s].num_channels > channels) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Too many subpackets %d for channels %d\n", q->num_subpackets, channels);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
total_channels += q->subpacket[s].num_channels;
|
||||
|
||||
q->num_subpackets++;
|
||||
s++;
|
||||
|
||||
@@ -69,7 +69,6 @@ static av_cold int cri_decode_init(AVCodecContext *avctx)
|
||||
s->jpeg_avctx->flags = avctx->flags;
|
||||
s->jpeg_avctx->flags2 = avctx->flags2;
|
||||
s->jpeg_avctx->idct_algo = avctx->idct_algo;
|
||||
s->jpeg_avctx->max_pixels = avctx->max_pixels;
|
||||
ret = avcodec_open2(s->jpeg_avctx, NULL, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
+11
-33
@@ -98,8 +98,6 @@ typedef struct DecodeContext {
|
||||
struct {
|
||||
FFLCEVCContext *ctx;
|
||||
int frame;
|
||||
int base_width;
|
||||
int base_height;
|
||||
int width;
|
||||
int height;
|
||||
} lcevc;
|
||||
@@ -1663,7 +1661,7 @@ int ff_attach_decode_data(AVFrame *frame)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int update_frame_props(AVCodecContext *avctx, AVFrame *frame)
|
||||
static void update_frame_props(AVCodecContext *avctx, AVFrame *frame)
|
||||
{
|
||||
#if CONFIG_LIBLCEVC_DEC
|
||||
AVCodecInternal *avci = avctx->internal;
|
||||
@@ -1673,23 +1671,12 @@ static int update_frame_props(AVCodecContext *avctx, AVFrame *frame)
|
||||
av_frame_get_side_data(frame, AV_FRAME_DATA_LCEVC);
|
||||
|
||||
if (dc->lcevc.frame) {
|
||||
int ret = ff_lcevc_parse_frame(dc->lcevc.ctx, frame,
|
||||
&dc->lcevc.width, &dc->lcevc.height, avctx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
// force get_buffer2() to allocate the base frame using the same dimensions
|
||||
// as the final enhanced frame, in order to prevent reinitializing the buffer
|
||||
// pools unnecessarely
|
||||
if (dc->lcevc.width && dc->lcevc.height) {
|
||||
dc->lcevc.base_width = frame->width;
|
||||
dc->lcevc.base_height = frame->height;
|
||||
frame->width = dc->lcevc.width;
|
||||
frame->height = dc->lcevc.height;
|
||||
}
|
||||
dc->lcevc.width = frame->width;
|
||||
dc->lcevc.height = frame->height;
|
||||
frame->width = frame->width * 2 / FFMAX(frame->sample_aspect_ratio.den, 1);
|
||||
frame->height = frame->height * 2 / FFMAX(frame->sample_aspect_ratio.num, 1);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int attach_post_process_data(AVCodecContext *avctx, AVFrame *frame)
|
||||
@@ -1703,11 +1690,6 @@ static int attach_post_process_data(AVCodecContext *avctx, AVFrame *frame)
|
||||
FFLCEVCFrame *frame_ctx;
|
||||
int ret;
|
||||
|
||||
if (!dc->lcevc.width || !dc->lcevc.height) {
|
||||
dc->lcevc.frame = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
frame_ctx = av_mallocz(sizeof(*frame_ctx));
|
||||
if (!frame_ctx)
|
||||
return AVERROR(ENOMEM);
|
||||
@@ -1719,12 +1701,12 @@ static int attach_post_process_data(AVCodecContext *avctx, AVFrame *frame)
|
||||
}
|
||||
|
||||
frame_ctx->lcevc = av_refstruct_ref(dc->lcevc.ctx);
|
||||
frame_ctx->frame->width = dc->lcevc.width;
|
||||
frame_ctx->frame->height = dc->lcevc.height;
|
||||
frame_ctx->frame->width = frame->width;
|
||||
frame_ctx->frame->height = frame->height;
|
||||
frame_ctx->frame->format = frame->format;
|
||||
|
||||
frame->width = dc->lcevc.base_width;
|
||||
frame->height = dc->lcevc.base_height;
|
||||
frame->width = dc->lcevc.width;
|
||||
frame->height = dc->lcevc.height;
|
||||
|
||||
ret = avctx->get_buffer2(avctx, frame_ctx->frame, 0);
|
||||
if (ret < 0) {
|
||||
@@ -1789,9 +1771,7 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
|
||||
}
|
||||
} else {
|
||||
avctx->sw_pix_fmt = avctx->pix_fmt;
|
||||
ret = update_frame_props(avctx, frame);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
update_frame_props(avctx, frame);
|
||||
}
|
||||
|
||||
ret = avctx->get_buffer2(avctx, frame, flags);
|
||||
@@ -2111,7 +2091,7 @@ av_cold int ff_decode_preinit(AVCodecContext *avctx)
|
||||
if (!(avctx->export_side_data & AV_CODEC_EXPORT_DATA_ENHANCEMENTS)) {
|
||||
if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
#if CONFIG_LIBLCEVC_DEC
|
||||
ret = ff_lcevc_alloc(&dc->lcevc.ctx, avctx);
|
||||
ret = ff_lcevc_alloc(&dc->lcevc.ctx);
|
||||
if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
|
||||
return ret;
|
||||
#endif
|
||||
@@ -2358,8 +2338,6 @@ av_cold void ff_decode_internal_sync(AVCodecContext *dst, const AVCodecContext *
|
||||
dst_dc->side_data_pref_mask = src_dc->side_data_pref_mask;
|
||||
#if CONFIG_LIBLCEVC_DEC
|
||||
av_refstruct_replace(&dst_dc->lcevc.ctx, src_dc->lcevc.ctx);
|
||||
dst_dc->lcevc.width = src_dc->lcevc.width;
|
||||
dst_dc->lcevc.height = src_dc->lcevc.height;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+3
-7
@@ -93,13 +93,9 @@ int ff_attach_decode_data(AVFrame *frame);
|
||||
*/
|
||||
int ff_copy_palette(void *dst, const AVPacket *src, void *logctx);
|
||||
|
||||
/*
|
||||
* Validate and set video frame dimensions on AVCodecContext.
|
||||
*
|
||||
* Dimensions accepted here satisfy FFmpeg's generic image-size validation
|
||||
* (see av_image_check_size2()). Decoder code normally should not duplicate
|
||||
* generic width/height overflow checks before ff_get_buffer(); add local
|
||||
* checks only for codec-specific derived sizes or complexity bounds.
|
||||
/**
|
||||
* Check that the provided frame dimensions are valid and set them on the codec
|
||||
* context.
|
||||
*/
|
||||
int ff_set_dimensions(AVCodecContext *s, int width, int height);
|
||||
|
||||
|
||||
@@ -101,16 +101,15 @@ static int dfpwm_dec_frame(struct AVCodecContext *ctx, AVFrame *frame,
|
||||
{
|
||||
DFPWMState *state = ctx->priv_data;
|
||||
int ret;
|
||||
uint64_t nb_samples = packet->size * 8LL / ctx->ch_layout.nb_channels;
|
||||
|
||||
if (packet->size * 8LL % ctx->ch_layout.nb_channels)
|
||||
return AVERROR_PATCHWELCOME;
|
||||
|
||||
if (nb_samples > INT_MAX || !nb_samples) {
|
||||
frame->nb_samples = packet->size * 8LL / ctx->ch_layout.nb_channels;
|
||||
if (frame->nb_samples <= 0) {
|
||||
av_log(ctx, AV_LOG_ERROR, "invalid number of samples in packet\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
frame->nb_samples = nb_samples;
|
||||
|
||||
if ((ret = ff_get_buffer(ctx, frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
@@ -339,9 +339,9 @@ static int alloc_buffers(DiracContext *s, int stride)
|
||||
av_freep(&s->mctmp);
|
||||
av_freep(&s->mcscratch);
|
||||
|
||||
s->edge_emu_buffer_base = av_malloc_array(stride, 4 * MAX_BLOCKSIZE);
|
||||
s->edge_emu_buffer_base = av_malloc_array(stride, MAX_BLOCKSIZE);
|
||||
|
||||
s->mctmp = av_malloc_array((stride+MAX_BLOCKSIZE), (h + 5*MAX_BLOCKSIZE) * sizeof(*s->mctmp));
|
||||
s->mctmp = av_malloc_array((stride+MAX_BLOCKSIZE), (h+MAX_BLOCKSIZE) * sizeof(*s->mctmp));
|
||||
s->mcscratch = av_malloc_array(stride, MAX_BLOCKSIZE);
|
||||
|
||||
if (!s->edge_emu_buffer_base || !s->mctmp || !s->mcscratch)
|
||||
@@ -1895,7 +1895,7 @@ static int dirac_decode_frame_internal(DiracContext *s)
|
||||
|
||||
/* FIXME: small resolutions */
|
||||
for (i = 0; i < 4; i++)
|
||||
s->edge_emu_buffer[i] = s->edge_emu_buffer_base + i*s->buffer_stride*MAX_BLOCKSIZE;
|
||||
s->edge_emu_buffer[i] = s->edge_emu_buffer_base + i*FFALIGN(p->width, 16);
|
||||
|
||||
if (!s->zero_res && !s->low_delay)
|
||||
{
|
||||
@@ -1944,7 +1944,7 @@ static int dirac_decode_frame_internal(DiracContext *s)
|
||||
h = p->height - start;
|
||||
else
|
||||
h = p->ybsep - (start - dsty);
|
||||
if (h <= 0)
|
||||
if (h < 0)
|
||||
break;
|
||||
|
||||
memset(mctmp+2*p->yoffset*p->stride, 0, 2*rowheight);
|
||||
|
||||
@@ -60,7 +60,7 @@ static int dvdsub_parse(AVCodecParserContext *s,
|
||||
pc->packet = av_malloc(pc->packet_len + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
}
|
||||
if (pc->packet) {
|
||||
if (buf_size <= pc->packet_len - pc->packet_index) {
|
||||
if (pc->packet_index + buf_size <= pc->packet_len) {
|
||||
memcpy(pc->packet + pc->packet_index, buf, buf_size);
|
||||
pc->packet_index += buf_size;
|
||||
if (pc->packet_index >= pc->packet_len) {
|
||||
|
||||
@@ -125,7 +125,7 @@ static av_cold int escape130_decode_init(AVCodecContext *avctx)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
s->old_y_avg = av_mallocz(avctx->width * avctx->height / 4);
|
||||
s->old_y_avg = av_malloc(avctx->width * avctx->height / 4);
|
||||
s->buf1 = av_malloc(avctx->width * avctx->height * 3 / 2);
|
||||
s->buf2 = av_malloc(avctx->width * avctx->height * 3 / 2);
|
||||
if (!s->old_y_avg || !s->buf1 || !s->buf2) {
|
||||
|
||||
@@ -637,9 +637,6 @@ static int piz_uncompress(const EXRContext *s, const uint8_t *src, int ssize,
|
||||
max_non_zero - min_non_zero + 1);
|
||||
memset(td->bitmap + max_non_zero + 1, 0, BITMAP_SIZE - max_non_zero - 1);
|
||||
|
||||
if (bytestream2_get_bytes_left(&gb) < 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
maxval = reverse_lut(td->bitmap, td->lut);
|
||||
|
||||
bytestream2_skip(&gb, 4);
|
||||
|
||||
@@ -113,8 +113,6 @@ static int fastaudio_decode(AVCodecContext *avctx, AVFrame *frame,
|
||||
int ret;
|
||||
|
||||
subframes = pkt->size / (40 * avctx->ch_layout.nb_channels);
|
||||
if (subframes <= 0 || subframes > INT_MAX / 256)
|
||||
return AVERROR_INVALIDDATA;
|
||||
frame->nb_samples = subframes * 256;
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
@@ -241,7 +241,7 @@ static int vulkan_encode_ffv1_submit_frame(AVCodecContext *avctx,
|
||||
if (maxsize < fv->max_heap_size) {
|
||||
out_buf_flags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
|
||||
/* If we can't map host memory, we can't let the GPU copy its buffer. */
|
||||
if (!(fv->s.extensions & FF_VK_EXT_EXTERNAL_HOST_MEMORY))
|
||||
if (!fv->s.extensions & FF_VK_EXT_EXTERNAL_HOST_MEMORY)
|
||||
out_buf_flags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
|
||||
} else {
|
||||
out_buf_flags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
|
||||
|
||||
+2
-3
@@ -481,13 +481,12 @@ static void epic_free_pixel_cache(ePICPixHash *hash)
|
||||
static inline int is_pixel_on_stack(const ePICContext *dc, uint32_t pix)
|
||||
{
|
||||
int i;
|
||||
int n = FFMIN(dc->stack_pos, EPIC_PIX_STACK_SIZE);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
for (i = 0; i < dc->stack_pos; i++)
|
||||
if (dc->stack[i] == pix)
|
||||
break;
|
||||
|
||||
return i != n;
|
||||
return i != dc->stack_pos;
|
||||
}
|
||||
|
||||
#define TOSIGNED(val) (((val) >> 1) ^ -((val) & 1))
|
||||
|
||||
+71
-107
@@ -145,7 +145,7 @@ static int decode_registered_user_data_closed_caption(H2645SEIA53Caption *h,
|
||||
static int decode_registered_user_data(H2645SEI *h, GetByteContext *gb,
|
||||
enum AVCodecID codec_id, void *logctx)
|
||||
{
|
||||
int country_code, provider_code = -1;
|
||||
int country_code, provider_code;
|
||||
|
||||
if (bytestream2_get_bytes_left(gb) < 3)
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -159,128 +159,92 @@ static int decode_registered_user_data(H2645SEI *h, GetByteContext *gb,
|
||||
}
|
||||
|
||||
/* itu_t_t35_payload_byte follows */
|
||||
provider_code = bytestream2_get_be16u(gb);
|
||||
|
||||
switch (country_code) {
|
||||
case ITU_T_T35_COUNTRY_CODE_US:
|
||||
provider_code = bytestream2_get_be16u(gb);
|
||||
if (country_code == ITU_T_T35_COUNTRY_CODE_US && provider_code == ITU_T_T35_PROVIDER_CODE_ATSC) {
|
||||
uint32_t user_identifier;
|
||||
|
||||
switch (provider_code) {
|
||||
case ITU_T_T35_PROVIDER_CODE_ATSC: {
|
||||
uint32_t user_identifier;
|
||||
if (bytestream2_get_bytes_left(gb) < 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (bytestream2_get_bytes_left(gb) < 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
user_identifier = bytestream2_get_be32u(gb);
|
||||
switch (user_identifier) {
|
||||
case MKBETAG('D', 'T', 'G', '1'): // afd_data
|
||||
return decode_registered_user_data_afd(&h->afd, gb);
|
||||
case MKBETAG('G', 'A', '9', '4'): // closed captions
|
||||
return decode_registered_user_data_closed_caption(&h->a53_caption, gb);
|
||||
default:
|
||||
av_log(logctx, AV_LOG_VERBOSE,
|
||||
"Unsupported User Data Registered ITU-T T35 SEI message (atsc user_identifier = 0x%04x)\n",
|
||||
user_identifier);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#if CONFIG_HEVC_SEI
|
||||
case ITU_T_T35_PROVIDER_CODE_AOM: {
|
||||
const uint16_t aom_grain_provider_oriented_code = 0x0001;
|
||||
uint16_t provider_oriented_code;
|
||||
|
||||
if (!IS_HEVC(codec_id))
|
||||
break;
|
||||
|
||||
if (bytestream2_get_bytes_left(gb) < 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
provider_oriented_code = bytestream2_get_byteu(gb);
|
||||
if (provider_oriented_code == aom_grain_provider_oriented_code) {
|
||||
return ff_aom_parse_film_grain_sets(&h->aom_film_grain,
|
||||
gb->buffer,
|
||||
bytestream2_get_bytes_left(gb));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ITU_T_T35_PROVIDER_CODE_SAMSUNG: {
|
||||
// A/341 Amendment - 2094-40
|
||||
const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
|
||||
const uint8_t smpte2094_40_application_identifier = 0x04;
|
||||
uint16_t provider_oriented_code;
|
||||
uint8_t application_identifier;
|
||||
|
||||
if (!IS_HEVC(codec_id))
|
||||
break;
|
||||
|
||||
if (bytestream2_get_bytes_left(gb) < 3)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
provider_oriented_code = bytestream2_get_be16u(gb);
|
||||
application_identifier = bytestream2_get_byteu(gb);
|
||||
if (provider_oriented_code == smpte2094_40_provider_oriented_code &&
|
||||
application_identifier == smpte2094_40_application_identifier) {
|
||||
return decode_registered_user_data_dynamic_hdr_plus(&h->dynamic_hdr_plus, gb);
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
user_identifier = bytestream2_get_be32u(gb);
|
||||
switch (user_identifier) {
|
||||
case MKBETAG('D', 'T', 'G', '1'): // afd_data
|
||||
return decode_registered_user_data_afd(&h->afd, gb);
|
||||
case MKBETAG('G', 'A', '9', '4'): // closed captions
|
||||
return decode_registered_user_data_closed_caption(&h->a53_caption, gb);
|
||||
default:
|
||||
av_log(logctx, AV_LOG_VERBOSE,
|
||||
"Unsupported User Data Registered ITU-T T35 SEI message (atsc user_identifier = 0x%04x)\n",
|
||||
user_identifier);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ITU_T_T35_COUNTRY_CODE_UK:
|
||||
bytestream2_skipu(gb, 1); // t35_uk_country_code_second_octet
|
||||
} else if (country_code == ITU_T_T35_COUNTRY_CODE_UK && provider_code == ITU_T_T35_PROVIDER_CODE_VNOVA) {
|
||||
if (bytestream2_get_bytes_left(gb) < 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
provider_code = bytestream2_get_be16u(gb);
|
||||
|
||||
switch (provider_code) {
|
||||
case ITU_T_T35_PROVIDER_CODE_VNOVA:
|
||||
if (bytestream2_get_bytes_left(gb) < 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
return decode_registered_user_data_lcevc(&h->lcevc, gb);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
bytestream2_skipu(gb, 1); // user_data_type_code
|
||||
return decode_registered_user_data_lcevc(&h->lcevc, gb);
|
||||
}
|
||||
#if CONFIG_HEVC_SEI
|
||||
case ITU_T_T35_COUNTRY_CODE_CN: {
|
||||
else if (country_code == ITU_T_T35_COUNTRY_CODE_CN && provider_code == ITU_T_T35_PROVIDER_CODE_HDR_VIVID) {
|
||||
const uint16_t cuva_provider_oriented_code = 0x0005;
|
||||
uint16_t provider_oriented_code;
|
||||
|
||||
provider_code = bytestream2_get_be16u(gb);
|
||||
if (!IS_HEVC(codec_id))
|
||||
goto unsupported_provider_code;
|
||||
|
||||
switch (provider_code) {
|
||||
case ITU_T_T35_PROVIDER_CODE_HDR_VIVID:
|
||||
if (!IS_HEVC(codec_id))
|
||||
break;
|
||||
if (bytestream2_get_bytes_left(gb) < 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (bytestream2_get_bytes_left(gb) < 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
provider_oriented_code = bytestream2_get_be16u(gb);
|
||||
if (provider_oriented_code == cuva_provider_oriented_code) {
|
||||
return decode_registered_user_data_dynamic_hdr_vivid(&h->dynamic_hdr_vivid, gb);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
provider_oriented_code = bytestream2_get_be16u(gb);
|
||||
if (provider_oriented_code == cuva_provider_oriented_code) {
|
||||
return decode_registered_user_data_dynamic_hdr_vivid(&h->dynamic_hdr_vivid, gb);
|
||||
}
|
||||
} else if(country_code == ITU_T_T35_COUNTRY_CODE_US && provider_code == ITU_T_T35_PROVIDER_CODE_SAMSUNG) {
|
||||
// A/341 Amendment - 2094-40
|
||||
const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
|
||||
const uint8_t smpte2094_40_application_identifier = 0x04;
|
||||
uint16_t provider_oriented_code;
|
||||
uint8_t application_identifier;
|
||||
|
||||
if (!IS_HEVC(codec_id))
|
||||
goto unsupported_provider_code;
|
||||
|
||||
if (bytestream2_get_bytes_left(gb) < 3)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
provider_oriented_code = bytestream2_get_be16u(gb);
|
||||
application_identifier = bytestream2_get_byteu(gb);
|
||||
if (provider_oriented_code == smpte2094_40_provider_oriented_code &&
|
||||
application_identifier == smpte2094_40_application_identifier) {
|
||||
return decode_registered_user_data_dynamic_hdr_plus(&h->dynamic_hdr_plus, gb);
|
||||
}
|
||||
} else if (country_code == ITU_T_T35_COUNTRY_CODE_US && provider_code == ITU_T_T35_PROVIDER_CODE_AOM) {
|
||||
const uint16_t aom_grain_provider_oriented_code = 0x0001;
|
||||
uint16_t provider_oriented_code;
|
||||
|
||||
if (!IS_HEVC(codec_id))
|
||||
goto unsupported_provider_code;
|
||||
|
||||
if (bytestream2_get_bytes_left(gb) < 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
provider_oriented_code = bytestream2_get_byteu(gb);
|
||||
if (provider_oriented_code == aom_grain_provider_oriented_code) {
|
||||
return ff_aom_parse_film_grain_sets(&h->aom_film_grain,
|
||||
gb->buffer,
|
||||
bytestream2_get_bytes_left(gb));
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
else {
|
||||
unsupported_provider_code:
|
||||
av_log(logctx, AV_LOG_VERBOSE,
|
||||
"Unsupported User Data Registered ITU-T T35 SEI message (country_code = %d, provider_code = %d)\n",
|
||||
country_code, provider_code);
|
||||
}
|
||||
|
||||
av_log(logctx, AV_LOG_VERBOSE,
|
||||
"Unsupported User Data Registered ITU-T T35 SEI message (country_code = %d, provider_code = %d)\n",
|
||||
country_code, provider_code);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -629,15 +593,15 @@ static int h2645_sei_to_side_data(AVCodecContext *avctx, H2645SEI *sei,
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
dst_env->ambient_illuminance = av_make_q(env->ambient_illuminance, 10000);
|
||||
dst_env->ambient_light_x = av_make_q(env->ambient_light_x, 50000);
|
||||
dst_env->ambient_light_y = av_make_q(env->ambient_light_y, 50000);
|
||||
|
||||
ret = ff_frame_new_side_data_from_buf_ext(avctx, sd, nb_sd,
|
||||
AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT, &buf);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
dst_env->ambient_illuminance = av_make_q(env->ambient_illuminance, 10000);
|
||||
dst_env->ambient_light_x = av_make_q(env->ambient_light_x, 50000);
|
||||
dst_env->ambient_light_y = av_make_q(env->ambient_light_y, 50000);
|
||||
}
|
||||
|
||||
if (sei->mastering_display.present) {
|
||||
|
||||
+15
-19
@@ -121,30 +121,26 @@ void ff_h264_direct_ref_list_init(const H264Context *const h, H264SliceContext *
|
||||
{
|
||||
H264Ref *const ref1 = &sl->ref_list[1][0];
|
||||
H264Picture *const cur = h->cur_pic_ptr;
|
||||
int list, field;
|
||||
int list, j, field;
|
||||
int sidx = (h->picture_structure & 1) ^ 1;
|
||||
int ref1sidx = (ref1->reference & 1) ^ 1;
|
||||
|
||||
/* Updates to cur_pic are not safe once ff_thread_finish_setup() has been
|
||||
* called (other threads may already be reading these fields). */
|
||||
if (!h->setup_finished) {
|
||||
for (list = 0; list < sl->list_count; list++) {
|
||||
cur->ref_count[sidx][list] = sl->ref_count[list];
|
||||
for (int j = 0; j < sl->ref_count[list]; j++)
|
||||
cur->ref_poc[sidx][list][j] = 4 * sl->ref_list[list][j].parent->frame_num +
|
||||
(sl->ref_list[list][j].reference & 3);
|
||||
}
|
||||
for (list = 0; list < sl->list_count; list++) {
|
||||
cur->ref_count[sidx][list] = sl->ref_count[list];
|
||||
for (j = 0; j < sl->ref_count[list]; j++)
|
||||
cur->ref_poc[sidx][list][j] = 4 * sl->ref_list[list][j].parent->frame_num +
|
||||
(sl->ref_list[list][j].reference & 3);
|
||||
}
|
||||
|
||||
if (h->picture_structure == PICT_FRAME) {
|
||||
memcpy(cur->ref_count[1], cur->ref_count[0], sizeof(cur->ref_count[0]));
|
||||
memcpy(cur->ref_poc[1], cur->ref_poc[0], sizeof(cur->ref_poc[0]));
|
||||
}
|
||||
if (h->picture_structure == PICT_FRAME) {
|
||||
memcpy(cur->ref_count[1], cur->ref_count[0], sizeof(cur->ref_count[0]));
|
||||
memcpy(cur->ref_poc[1], cur->ref_poc[0], sizeof(cur->ref_poc[0]));
|
||||
}
|
||||
|
||||
if (h->current_slice == 0) {
|
||||
cur->mbaff = FRAME_MBAFF(h);
|
||||
} else {
|
||||
av_assert0(cur->mbaff == FRAME_MBAFF(h));
|
||||
}
|
||||
if (h->current_slice == 0) {
|
||||
cur->mbaff = FRAME_MBAFF(h);
|
||||
} else {
|
||||
av_assert0(cur->mbaff == FRAME_MBAFF(h));
|
||||
}
|
||||
|
||||
sl->col_fieldoff = 0;
|
||||
|
||||
@@ -156,7 +156,8 @@ static void h264_initialise_ref_list(H264Context *h, H264SliceContext *sl)
|
||||
h->long_ref, 16, 1, h->picture_structure);
|
||||
av_assert0(len <= 32);
|
||||
|
||||
memset(&sl->ref_list[list][len], 0, sizeof(H264Ref) * (32 - len));
|
||||
if (len < sl->ref_count[list])
|
||||
memset(&sl->ref_list[list][len], 0, sizeof(H264Ref) * (sl->ref_count[list] - len));
|
||||
lens[list] = len;
|
||||
}
|
||||
|
||||
@@ -177,7 +178,8 @@ static void h264_initialise_ref_list(H264Context *h, H264SliceContext *sl)
|
||||
h-> long_ref, 16, 1, h->picture_structure);
|
||||
av_assert0(len <= 32);
|
||||
|
||||
memset(&sl->ref_list[0][len], 0, sizeof(H264Ref) * (32 - len));
|
||||
if (len < sl->ref_count[0])
|
||||
memset(&sl->ref_list[0][len], 0, sizeof(H264Ref) * (sl->ref_count[0] - len));
|
||||
}
|
||||
#ifdef TRACE
|
||||
for (int i = 0; i < sl->ref_count[0]; i++) {
|
||||
|
||||
+4
-11
@@ -316,10 +316,8 @@ static void color_frame(AVFrame *frame, const int c[4])
|
||||
int bytes = is_chroma ? AV_CEIL_RSHIFT(frame->width, desc->log2_chroma_w) : frame->width;
|
||||
int height = is_chroma ? AV_CEIL_RSHIFT(frame->height, desc->log2_chroma_h) : frame->height;
|
||||
if (desc->comp[0].depth >= 9) {
|
||||
if (bytes >= 1)
|
||||
((uint16_t*)dst)[0] = c[p];
|
||||
if (bytes >= 2)
|
||||
av_memcpy_backptr(dst + 2, 2, 2 * (bytes - 1));
|
||||
((uint16_t*)dst)[0] = c[p];
|
||||
av_memcpy_backptr(dst + 2, 2, bytes - 2);
|
||||
dst += frame->linesize[p];
|
||||
for (int y = 1; y < height; y++) {
|
||||
memcpy(dst, frame->data[p], 2*bytes);
|
||||
@@ -1951,7 +1949,8 @@ static int h264_slice_init(H264Context *h, H264SliceContext *sl,
|
||||
|
||||
if (sl->slice_type_nos == AV_PICTURE_TYPE_B && !sl->direct_spatial_mv_pred)
|
||||
ff_h264_direct_dist_scale_factor(h, sl);
|
||||
ff_h264_direct_ref_list_init(h, sl);
|
||||
if (!h->setup_finished)
|
||||
ff_h264_direct_ref_list_init(h, sl);
|
||||
|
||||
if (h->avctx->skip_loop_filter >= AVDISCARD_ALL ||
|
||||
(h->avctx->skip_loop_filter >= AVDISCARD_NONKEY &&
|
||||
@@ -1980,12 +1979,6 @@ static int h264_slice_init(H264Context *h, H264SliceContext *sl,
|
||||
h->ps.pps->chroma_qp_index_offset[1]) +
|
||||
6 * (h->ps.sps->bit_depth_luma - 8);
|
||||
|
||||
// slice_table is uint16_t initialized to 0xFFFF as a sentinel.
|
||||
if (h->current_slice >= 0xFFFE) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "Too many slices (%d)\n", h->current_slice + 1);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
sl->slice_num = ++h->current_slice;
|
||||
|
||||
if (sl->slice_num)
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ static int decompress(uint8_t *scanline, int w, GetByteContext *gb, const uint8_
|
||||
for (int i = run << rshift; i > 0 && w > 0 && scanline >= start + 4; i--) {
|
||||
memcpy(scanline, scanline - 4, 4);
|
||||
scanline += 4;
|
||||
w--;
|
||||
w -= 4;
|
||||
}
|
||||
rshift += 8;
|
||||
if (rshift > 16)
|
||||
|
||||
+22
-37
@@ -62,29 +62,6 @@ static const uint8_t hevc_sub_height_c[] = {
|
||||
1, 2, 1, 1
|
||||
};
|
||||
|
||||
static int read_window(HEVCWindow *window, GetBitContext *gb, int chroma_format_idc, int w, int h)
|
||||
{
|
||||
int64_t vert_mult = hevc_sub_height_c[chroma_format_idc];
|
||||
int64_t horiz_mult = hevc_sub_width_c [chroma_format_idc];
|
||||
int64_t left = get_ue_golomb_long(gb) * horiz_mult;
|
||||
int64_t right = get_ue_golomb_long(gb) * horiz_mult;
|
||||
int64_t top = get_ue_golomb_long(gb) * vert_mult;
|
||||
int64_t bottom = get_ue_golomb_long(gb) * vert_mult;
|
||||
|
||||
if (left < 0 || right < 0 || top < 0 || bottom < 0 ||
|
||||
w <= left + right ||
|
||||
h <= top + bottom) {
|
||||
memset(window, 0, sizeof(*window));
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
window->left_offset = left;
|
||||
window->right_offset = right;
|
||||
window->top_offset = top;
|
||||
window->bottom_offset = bottom;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void remove_sps(HEVCParamSets *s, int id)
|
||||
{
|
||||
int i;
|
||||
@@ -725,9 +702,12 @@ static int decode_vps_ext(GetBitContext *gb, AVCodecContext *avctx, HEVCVPS *vps
|
||||
}
|
||||
|
||||
if (get_bits1(gb) /* conformance_window_vps_flag */) {
|
||||
int ret = read_window(&vps->rep_format.conf_win, gb, vps->rep_format.chroma_format_idc, vps->rep_format.pic_width_in_luma_samples, vps->rep_format.pic_height_in_luma_samples);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
int vert_mult = hevc_sub_height_c[vps->rep_format.chroma_format_idc];
|
||||
int horiz_mult = hevc_sub_width_c[vps->rep_format.chroma_format_idc];
|
||||
vps->rep_format.conf_win_left_offset = get_ue_golomb(gb) * horiz_mult;
|
||||
vps->rep_format.conf_win_right_offset = get_ue_golomb(gb) * horiz_mult;
|
||||
vps->rep_format.conf_win_top_offset = get_ue_golomb(gb) * vert_mult;
|
||||
vps->rep_format.conf_win_bottom_offset = get_ue_golomb(gb) * vert_mult;
|
||||
}
|
||||
|
||||
vps->max_one_active_ref_layer = get_bits1(gb);
|
||||
@@ -982,7 +962,12 @@ static void decode_vui(GetBitContext *gb, AVCodecContext *avctx,
|
||||
vui->default_display_window_flag = get_bits1(gb);
|
||||
|
||||
if (vui->default_display_window_flag) {
|
||||
read_window(&vui->def_disp_win, gb, sps->chroma_format_idc, sps->width, sps->height);
|
||||
int vert_mult = hevc_sub_height_c[sps->chroma_format_idc];
|
||||
int horiz_mult = hevc_sub_width_c[sps->chroma_format_idc];
|
||||
vui->def_disp_win.left_offset = get_ue_golomb_long(gb) * horiz_mult;
|
||||
vui->def_disp_win.right_offset = get_ue_golomb_long(gb) * horiz_mult;
|
||||
vui->def_disp_win.top_offset = get_ue_golomb_long(gb) * vert_mult;
|
||||
vui->def_disp_win.bottom_offset = get_ue_golomb_long(gb) * vert_mult;
|
||||
|
||||
if (apply_defdispwin &&
|
||||
avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) {
|
||||
@@ -1295,14 +1280,11 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
|
||||
sps->bit_depth = rf->bit_depth_luma;
|
||||
sps->width = rf->pic_width_in_luma_samples;
|
||||
sps->height = rf->pic_height_in_luma_samples;
|
||||
if ((ret = av_image_check_size(sps->width,
|
||||
sps->height, 0, avctx)) < 0)
|
||||
return ret;
|
||||
|
||||
sps->pic_conf_win.left_offset = rf->conf_win.left_offset;
|
||||
sps->pic_conf_win.right_offset = rf->conf_win.right_offset;
|
||||
sps->pic_conf_win.top_offset = rf->conf_win.top_offset;
|
||||
sps->pic_conf_win.bottom_offset = rf->conf_win.bottom_offset;
|
||||
sps->pic_conf_win.left_offset = rf->conf_win_left_offset;
|
||||
sps->pic_conf_win.right_offset = rf->conf_win_right_offset;
|
||||
sps->pic_conf_win.top_offset = rf->conf_win_top_offset;
|
||||
sps->pic_conf_win.bottom_offset = rf->conf_win_bottom_offset;
|
||||
|
||||
} else {
|
||||
sps->chroma_format_idc = get_ue_golomb_long(gb);
|
||||
@@ -1325,9 +1307,12 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
|
||||
|
||||
sps->conformance_window = get_bits1(gb);
|
||||
if (sps->conformance_window) {
|
||||
ret = read_window(&sps->pic_conf_win, gb, sps->chroma_format_idc, sps->width, sps->height);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
int vert_mult = hevc_sub_height_c[sps->chroma_format_idc];
|
||||
int horiz_mult = hevc_sub_width_c[sps->chroma_format_idc];
|
||||
sps->pic_conf_win.left_offset = get_ue_golomb_long(gb) * horiz_mult;
|
||||
sps->pic_conf_win.right_offset = get_ue_golomb_long(gb) * horiz_mult;
|
||||
sps->pic_conf_win.top_offset = get_ue_golomb_long(gb) * vert_mult;
|
||||
sps->pic_conf_win.bottom_offset = get_ue_golomb_long(gb) * vert_mult;
|
||||
|
||||
if (avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) {
|
||||
av_log(avctx, AV_LOG_DEBUG,
|
||||
|
||||
@@ -162,7 +162,10 @@ typedef struct RepFormat {
|
||||
uint8_t separate_colour_plane_flag;
|
||||
uint8_t bit_depth_luma; ///< bit_depth_vps_luma_minus8 + 8
|
||||
uint8_t bit_depth_chroma; ///< bit_depth_vps_chroma_minus8 + 8
|
||||
HEVCWindow conf_win;
|
||||
uint16_t conf_win_left_offset;
|
||||
uint16_t conf_win_right_offset;
|
||||
uint16_t conf_win_top_offset;
|
||||
uint16_t conf_win_bottom_offset;
|
||||
} RepFormat;
|
||||
|
||||
typedef struct HEVCVPS {
|
||||
|
||||
@@ -162,10 +162,7 @@ static HEVCFrame *alloc_frame(HEVCContext *s, HEVCLayerContext *l)
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
size_t rpl_bytes;
|
||||
if (av_size_mult(s->pkt.nb_nals, sizeof(*frame->rpl), &rpl_bytes) < 0)
|
||||
goto fail;
|
||||
frame->rpl = av_refstruct_allocz(rpl_bytes);
|
||||
frame->rpl = av_refstruct_allocz(s->pkt.nb_nals * sizeof(*frame->rpl));
|
||||
if (!frame->rpl)
|
||||
goto fail;
|
||||
frame->nb_rpl_elems = s->pkt.nb_nals;
|
||||
@@ -473,13 +470,12 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, HEVCLayerContext *l, int
|
||||
return NULL;
|
||||
|
||||
if (!s->avctx->hwaccel) {
|
||||
int nb_planes = l->sps->chroma_format_idc ? 3 : 1;
|
||||
if (!l->sps->pixel_shift) {
|
||||
for (i = 0; i < nb_planes; i++)
|
||||
for (i = 0; frame->f->data[i]; i++)
|
||||
memset(frame->f->data[i], 1 << (l->sps->bit_depth - 1),
|
||||
frame->f->linesize[i] * AV_CEIL_RSHIFT(l->sps->height, l->sps->vshift[i]));
|
||||
} else {
|
||||
for (i = 0; i < nb_planes; i++)
|
||||
for (i = 0; frame->f->data[i]; i++)
|
||||
for (y = 0; y < (l->sps->height >> l->sps->vshift[i]); y++) {
|
||||
uint8_t *dst = frame->f->data[i] + y * frame->f->linesize[i];
|
||||
AV_WN16(dst, 1 << (l->sps->bit_depth - 1));
|
||||
|
||||
@@ -62,7 +62,6 @@ static av_cold int imm5_init(AVCodecContext *avctx)
|
||||
ctx->h264_avctx->thread_count = 1;
|
||||
ctx->h264_avctx->flags = avctx->flags;
|
||||
ctx->h264_avctx->flags2 = avctx->flags2;
|
||||
ctx->h264_avctx->max_pixels = avctx->max_pixels;
|
||||
ret = avcodec_open2(ctx->h264_avctx, NULL, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@@ -74,7 +73,6 @@ static av_cold int imm5_init(AVCodecContext *avctx)
|
||||
ctx->hevc_avctx->thread_count = 1;
|
||||
ctx->hevc_avctx->flags = avctx->flags;
|
||||
ctx->hevc_avctx->flags2 = avctx->flags2;
|
||||
ctx->hevc_avctx->max_pixels = avctx->max_pixels;
|
||||
ret = avcodec_open2(ctx->hevc_avctx, NULL, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
+3
-1
@@ -30,8 +30,10 @@
|
||||
// - CN providers
|
||||
#define ITU_T_T35_PROVIDER_CODE_HDR_VIVID 0x0004
|
||||
// - UK providers
|
||||
// V-Nova should be 0x5000 according to UK Register of Manufacturer Codes
|
||||
// https://www.cix.co.uk/~bpechey/H221/h221code.htm
|
||||
#define ITU_T_T35_PROVIDER_CODE_VNOVA 0x5000
|
||||
// but FFmpeg has been using 0x0050
|
||||
#define ITU_T_T35_PROVIDER_CODE_VNOVA 0x0050
|
||||
// - US providers
|
||||
#define ITU_T_T35_PROVIDER_CODE_ATSC 0x0031
|
||||
#define ITU_T_T35_PROVIDER_CODE_DOLBY 0x003B
|
||||
|
||||
@@ -1957,7 +1957,7 @@ static void decode_clnpass(const Jpeg2000DecoderContext *s, Jpeg2000T1Context *t
|
||||
int width, int height, int bpno, int bandno,
|
||||
int seg_symbols, int vert_causal_ctx_csty_symbol)
|
||||
{
|
||||
int mask = (3u << bpno)>>1, y0, x, y, runlen, dec;
|
||||
int mask = 3 << (bpno - 1), y0, x, y, runlen, dec;
|
||||
|
||||
for (y0 = 0; y0 < height; y0 += 4) {
|
||||
for (x = 0; x < width; x++) {
|
||||
@@ -2448,14 +2448,8 @@ static void jpeg2000_dec_cleanup(Jpeg2000DecoderContext *s)
|
||||
memset(s->qntsty, 0, sizeof(s->qntsty));
|
||||
memset(s->properties, 0, sizeof(s->properties));
|
||||
memset(&s->poc , 0, sizeof(s->poc));
|
||||
memset(s->roi_shift, 0, sizeof(s->roi_shift));
|
||||
s->numXtiles = s->numYtiles = 0;
|
||||
s->ncomponents = 0;
|
||||
s->has_ppm = 0;
|
||||
s->isHT = 0;
|
||||
s->precision = 0;
|
||||
s->colour_space = 0;
|
||||
s->pal8 = 0;
|
||||
}
|
||||
|
||||
static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
|
||||
|
||||
@@ -1334,19 +1334,8 @@ ff_jpeg2000_decode_htj2k(const Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c
|
||||
sign = val & INT32_MIN;
|
||||
val &= INT32_MAX;
|
||||
/* ROI shift, if necessary */
|
||||
if (roi_shift && (((uint32_t)val & ~mask) == 0)) {
|
||||
if ((32 - ff_clz(val | 1)) < roi_shift)
|
||||
// Assuming that the internal precision for codeblock decoding is 32 bits.
|
||||
val <<= roi_shift;
|
||||
else {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"Pixel precision in ROI is beyond the supported range.\n"
|
||||
);
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto free;
|
||||
}
|
||||
|
||||
}
|
||||
if (roi_shift && (((uint32_t)val & ~mask) == 0))
|
||||
val <<= roi_shift;
|
||||
t1->data[n] = val | sign; /* NOTE: Binary point for reconstruction value is located in 31 - M_b */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -499,7 +499,7 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s)
|
||||
if (s->bits <= 8) {
|
||||
uint8_t *src = s->picture_ptr->data[0];
|
||||
|
||||
for (i = 0; i < decoded_height; i++) {
|
||||
for (i = 0; i < s->height; i++) {
|
||||
switch(s->xfrm) {
|
||||
case 1:
|
||||
for (x = off; x + 2 < w; x += 3) {
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_LCEVC_PARSE_H
|
||||
#define AVCODEC_LCEVC_PARSE_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "get_bits.h"
|
||||
|
||||
static inline uint64_t get_mb(GetBitContext *s) {
|
||||
int more, i = 0;
|
||||
uint64_t mb = 0;
|
||||
|
||||
do {
|
||||
int byte = get_bits(s, 8);
|
||||
unsigned bits = byte & 0x7f;
|
||||
more = byte & 0x80;
|
||||
mb = (mb << 7) | bits;
|
||||
if (++i == 10)
|
||||
break;
|
||||
} while (more);
|
||||
|
||||
return mb;
|
||||
}
|
||||
|
||||
#endif /* AVCODEC_LCEVC_PARSE_H */
|
||||
+39
-12
@@ -25,8 +25,6 @@
|
||||
#include "get_bits.h"
|
||||
#include "h2645_parse.h"
|
||||
#include "lcevc.h"
|
||||
#include "lcevc_parse.h"
|
||||
#include "lcevctab.h"
|
||||
#include "parser.h"
|
||||
#include "parser_internal.h"
|
||||
|
||||
@@ -83,6 +81,41 @@ static const enum AVPixelFormat pix_fmts[4][4] = {
|
||||
AV_PIX_FMT_YUV422P14, AV_PIX_FMT_YUV444P14, },
|
||||
};
|
||||
|
||||
static const struct {
|
||||
int width;
|
||||
int height;
|
||||
} resolution_type_lut[63] = {
|
||||
{ 0, 0},
|
||||
{ 360, 200 }, { 400, 240 }, { 480, 320 }, { 640, 360 },
|
||||
{ 640, 480 }, { 768, 480 }, { 800, 600 }, { 852, 480 },
|
||||
{ 854, 480 }, { 856, 480 }, { 960, 540 }, { 960, 640 },
|
||||
{ 1024, 576 }, { 1024, 600 }, { 1024, 768 }, { 1152, 864 },
|
||||
{ 1280, 720 }, { 1280, 800 }, { 1280, 1024 }, { 1360, 768 },
|
||||
{ 1366, 768 }, { 1920, 1200 }, { 2048, 1080 }, { 2048, 1152 },
|
||||
{ 2048, 1536 }, { 2160, 1440 }, { 2560, 1440 }, { 2560, 1600 },
|
||||
{ 2560, 2048 }, { 3200, 1800 }, { 3200, 2048 }, { 3200, 2400 },
|
||||
{ 3440, 1440 }, { 3840, 1600 }, { 3840, 2160 }, { 3840, 2400 },
|
||||
{ 4096, 2160 }, { 4096, 3072 }, { 5120, 2880 }, { 5120, 3200 },
|
||||
{ 5120, 4096 }, { 6400, 4096 }, { 6400, 4800 }, { 7680, 4320 },
|
||||
{ 7680, 4800 },
|
||||
};
|
||||
|
||||
static inline uint64_t get_mb(GetBitContext *s) {
|
||||
int more, i = 0;
|
||||
uint64_t mb = 0;
|
||||
|
||||
do {
|
||||
int byte = get_bits(s, 8);
|
||||
unsigned bits = byte & 0x7f;
|
||||
more = byte & 0x80;
|
||||
mb = (mb << 7) | bits;
|
||||
if (++i == 10)
|
||||
break;
|
||||
} while (more);
|
||||
|
||||
return mb;
|
||||
}
|
||||
|
||||
static int parse_nal_unit(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||
const H2645NAL *nal)
|
||||
{
|
||||
@@ -92,13 +125,10 @@ static int parse_nal_unit(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||
|
||||
while (bytestream2_get_bytes_left(&gbc) > 1) {
|
||||
GetBitContext gb;
|
||||
uint64_t payload_size;
|
||||
int payload_size_type, payload_type;
|
||||
int payload_size_type, payload_type, payload_size;
|
||||
int block_size;
|
||||
|
||||
int ret = init_get_bits8(&gb, gbc.buffer, bytestream2_get_bytes_left(&gbc));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
init_get_bits8(&gb, gbc.buffer, bytestream2_get_bytes_left(&gbc));
|
||||
|
||||
payload_size_type = get_bits(&gb, 3);
|
||||
payload_type = get_bits(&gb, 5);
|
||||
@@ -108,9 +138,6 @@ static int parse_nal_unit(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||
if (payload_size_type == 7)
|
||||
payload_size = get_mb(&gb);
|
||||
|
||||
if (payload_size > INT_MAX - (get_bits_count(&gb) >> 3))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
block_size = payload_size + (get_bits_count(&gb) >> 3);
|
||||
if (block_size >= bytestream2_get_bytes_left(&gbc))
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -134,8 +161,8 @@ static int parse_nal_unit(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||
s->format = pix_fmts[bit_depth][chroma_format_idc];
|
||||
|
||||
if (resolution_type < 63) {
|
||||
s->width = ff_lcevc_resolution_type[resolution_type].width;
|
||||
s->height = ff_lcevc_resolution_type[resolution_type].height;
|
||||
s->width = resolution_type_lut[resolution_type].width;
|
||||
s->height = resolution_type_lut[resolution_type].height;
|
||||
} else {
|
||||
int upsample_type, tile_dimensions_type;
|
||||
int temporal_step_width_modifier_signalled_flag, level1_filtering_signalled_flag;
|
||||
|
||||
+1
-78
@@ -23,12 +23,8 @@
|
||||
#include "libavutil/mem.h"
|
||||
#include "libavutil/refstruct.h"
|
||||
|
||||
#include "cbs.h"
|
||||
#include "cbs_lcevc.h"
|
||||
#include "decode.h"
|
||||
#include "lcevc_parse.h"
|
||||
#include "lcevcdec.h"
|
||||
#include "lcevctab.h"
|
||||
|
||||
static LCEVC_ColorFormat map_format(int format)
|
||||
{
|
||||
@@ -195,15 +191,6 @@ static int generate_output(void *logctx, FFLCEVCFrame *frame_ctx, AVFrame *out)
|
||||
out->width = desc.width + out->crop_left + out->crop_right;
|
||||
out->height = desc.height + out->crop_top + out->crop_bottom;
|
||||
|
||||
av_log(logctx, AV_LOG_DEBUG, "out PTS %"PRId64", %dx%d, "
|
||||
"%zu/%zu/%zu/%zu, "
|
||||
"SAR %d:%d, "
|
||||
"hasEnhancement %d, enhanced %d\n",
|
||||
out->pts, out->width, out->height,
|
||||
out->crop_top, out->crop_bottom, out->crop_left, out->crop_right,
|
||||
out->sample_aspect_ratio.num, out->sample_aspect_ratio.den,
|
||||
info.hasEnhancement, info.enhanced);
|
||||
|
||||
res = LCEVC_FreePicture(lcevc->decoder, picture);
|
||||
if (res != LCEVC_Success)
|
||||
return AVERROR_EXTERNAL;
|
||||
@@ -269,10 +256,6 @@ static void lcevc_free(AVRefStructOpaque unused, void *obj)
|
||||
lcevc_flush_pictures(lcevc);
|
||||
LCEVC_DestroyDecoder(lcevc->decoder);
|
||||
}
|
||||
if (lcevc->frag)
|
||||
ff_cbs_fragment_free(lcevc->frag);
|
||||
av_freep(&lcevc->frag);
|
||||
ff_cbs_close(&lcevc->cbc);
|
||||
memset(lcevc, 0, sizeof(*lcevc));
|
||||
}
|
||||
|
||||
@@ -330,74 +313,14 @@ int ff_lcevc_process(void *logctx, AVFrame *frame)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ff_lcevc_parse_frame(FFLCEVCContext *lcevc, const AVFrame *frame,
|
||||
int *width, int *height, void *logctx)
|
||||
{
|
||||
LCEVCRawProcessBlock *block = NULL;
|
||||
LCEVCRawGlobalConfig *gc = NULL;
|
||||
AVFrameSideData *sd = av_frame_get_side_data(frame, AV_FRAME_DATA_LCEVC);
|
||||
int ret;
|
||||
|
||||
ret = ff_cbs_read(lcevc->cbc, lcevc->frag, sd->buf, sd->data, sd->size);
|
||||
if (ret < 0) {
|
||||
av_log(logctx, AV_LOG_ERROR, "Failed to parse Access Unit.\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
ret = ff_cbs_lcevc_find_process_block(lcevc->cbc, lcevc->frag,
|
||||
LCEVC_PAYLOAD_TYPE_GLOBAL_CONFIG, &block);
|
||||
if (ret < 0) {
|
||||
ret = 0;
|
||||
goto end;
|
||||
}
|
||||
|
||||
gc = block->payload;
|
||||
if (gc->resolution_type < 63) {
|
||||
*width = ff_lcevc_resolution_type[gc->resolution_type].width;
|
||||
*height = ff_lcevc_resolution_type[gc->resolution_type].height;
|
||||
} else {
|
||||
*width = gc->custom_resolution_width;
|
||||
*height = gc->custom_resolution_height;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
end:
|
||||
ff_cbs_fragment_reset(lcevc->frag);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const CodedBitstreamUnitType decompose_unit_types[] = {
|
||||
LCEVC_IDR_NUT,
|
||||
};
|
||||
|
||||
int ff_lcevc_alloc(FFLCEVCContext **plcevc, void *logctx)
|
||||
int ff_lcevc_alloc(FFLCEVCContext **plcevc)
|
||||
{
|
||||
FFLCEVCContext *lcevc = NULL;
|
||||
int ret;
|
||||
|
||||
lcevc = av_refstruct_alloc_ext(sizeof(*lcevc), 0, NULL, lcevc_free);
|
||||
if (!lcevc)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
lcevc->frag = av_mallocz(sizeof(*lcevc->frag));
|
||||
if (!lcevc->frag) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ret = ff_cbs_init(&lcevc->cbc, AV_CODEC_ID_LCEVC, logctx);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
lcevc->cbc->decompose_unit_types = decompose_unit_types;
|
||||
lcevc->cbc->nb_decompose_unit_types = FF_ARRAY_ELEMS(decompose_unit_types);
|
||||
|
||||
*plcevc = lcevc;
|
||||
return 0;
|
||||
fail:
|
||||
av_refstruct_unref(&lcevc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ff_lcevc_unref(void *opaque)
|
||||
|
||||
@@ -28,13 +28,8 @@
|
||||
typedef uintptr_t LCEVC_DecoderHandle;
|
||||
#endif
|
||||
|
||||
struct CodedBitstreamContext;
|
||||
struct CodedBitstreamFragment;
|
||||
|
||||
typedef struct FFLCEVCContext {
|
||||
LCEVC_DecoderHandle decoder;
|
||||
struct CodedBitstreamContext *cbc;
|
||||
struct CodedBitstreamFragment *frag;
|
||||
int initialized;
|
||||
} FFLCEVCContext;
|
||||
|
||||
@@ -45,9 +40,7 @@ typedef struct FFLCEVCFrame {
|
||||
struct AVFrame *frame;
|
||||
} FFLCEVCFrame;
|
||||
|
||||
int ff_lcevc_alloc(FFLCEVCContext **plcevc, void *logctx);
|
||||
int ff_lcevc_alloc(FFLCEVCContext **plcevc);
|
||||
int ff_lcevc_process(void *logctx, struct AVFrame *frame);
|
||||
int ff_lcevc_parse_frame(FFLCEVCContext *lcevc, const struct AVFrame *frame,
|
||||
int *width, int *height, void *logctx);
|
||||
void ff_lcevc_unref(void *opaque);
|
||||
#endif /* AVCODEC_LCEVCDEC_H */
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "lcevctab.h"
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_LCEVCTAB_H
|
||||
#define AVCODEC_LCEVCTAB_H
|
||||
|
||||
static const struct {
|
||||
int width;
|
||||
int height;
|
||||
} ff_lcevc_resolution_type[63] = {
|
||||
{ 0, 0},
|
||||
{ 360, 200 }, { 400, 240 }, { 480, 320 }, { 640, 360 },
|
||||
{ 640, 480 }, { 768, 480 }, { 800, 600 }, { 852, 480 },
|
||||
{ 854, 480 }, { 856, 480 }, { 960, 540 }, { 960, 640 },
|
||||
{ 1024, 576 }, { 1024, 600 }, { 1024, 768 }, { 1152, 864 },
|
||||
{ 1280, 720 }, { 1280, 800 }, { 1280, 1024 }, { 1360, 768 },
|
||||
{ 1366, 768 }, { 1920, 1200 }, { 2048, 1080 }, { 2048, 1152 },
|
||||
{ 2048, 1536 }, { 2160, 1440 }, { 2560, 1440 }, { 2560, 1600 },
|
||||
{ 2560, 2048 }, { 3200, 1800 }, { 3200, 2048 }, { 3200, 2400 },
|
||||
{ 3440, 1440 }, { 3840, 1600 }, { 3840, 2160 }, { 3840, 2400 },
|
||||
{ 4096, 2160 }, { 4096, 3072 }, { 5120, 2880 }, { 5120, 3200 },
|
||||
{ 5120, 4096 }, { 6400, 4096 }, { 6400, 4800 }, { 7680, 4320 },
|
||||
{ 7680, 4800 },
|
||||
};
|
||||
|
||||
#endif /* AVCODEC_LCEVCTAB_H */
|
||||
+2
-2
@@ -175,7 +175,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
int height = avctx->height; // Real image height
|
||||
unsigned int mszh_dlen;
|
||||
unsigned char yq, y1q, uq, vq;
|
||||
int ret;
|
||||
int uqvq, ret;
|
||||
unsigned int mthread_inlen, mthread_outlen;
|
||||
unsigned int len = buf_size;
|
||||
int linesize, offset;
|
||||
@@ -306,7 +306,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
for (row = 0; row < height; row++) {
|
||||
pixel_ptr = row * width * 3;
|
||||
yq = encoded[pixel_ptr++];
|
||||
unsigned uqvq = AV_RL16(encoded+pixel_ptr);
|
||||
uqvq = AV_RL16(encoded+pixel_ptr);
|
||||
pixel_ptr += 2;
|
||||
for (col = 1; col < width; col++) {
|
||||
encoded[pixel_ptr] = yq -= encoded[pixel_ptr];
|
||||
|
||||
@@ -434,8 +434,7 @@ static int libjxl_preprocess_stream(AVCodecContext *avctx, const AVFrame *frame,
|
||||
if (ret >= 0)
|
||||
ret = av_exif_get_entry(avctx, &ifd, tag, 0, &orient);
|
||||
if (ret >= 0 && orient) {
|
||||
if (!have_matrix && orient->type == AV_TIFF_SHORT && orient->count
|
||||
&& orient->value.uint[0] >= 1 && orient->value.uint[0] <= 8) {
|
||||
if (!have_matrix && orient->value.uint[0] >= 1 && orient->value.uint[0] <= 8) {
|
||||
av_exif_orientation_to_matrix(matrix, orient->value.uint[0]);
|
||||
have_matrix = 1;
|
||||
}
|
||||
|
||||
+18
-134
@@ -59,6 +59,8 @@ typedef struct ApvEncContext {
|
||||
|
||||
oapv_frms_t ifrms; // frames for input
|
||||
|
||||
int num_frames; // number of frames in an access unit
|
||||
|
||||
int preset_id; // preset of apv ( fastest, fast, medium, slow, placebo)
|
||||
|
||||
int qp; // quantization parameter (QP) [0,63]
|
||||
@@ -127,121 +129,6 @@ static inline int get_color_format(enum AVPixelFormat pix_fmt)
|
||||
return cf;
|
||||
}
|
||||
|
||||
static inline int get_chroma_format_idc(enum AVPixelFormat pix_fmt)
|
||||
{
|
||||
int cfi = -1;
|
||||
|
||||
switch (pix_fmt) {
|
||||
case AV_PIX_FMT_GRAY10:
|
||||
cfi = APV_CHROMA_FORMAT_400;
|
||||
break;
|
||||
case AV_PIX_FMT_YUV422P10:
|
||||
case AV_PIX_FMT_YUV422P12:
|
||||
cfi = APV_CHROMA_FORMAT_422;
|
||||
break;
|
||||
case AV_PIX_FMT_YUV444P10:
|
||||
case AV_PIX_FMT_YUV444P12:
|
||||
cfi = APV_CHROMA_FORMAT_444;
|
||||
break;
|
||||
case AV_PIX_FMT_YUVA444P10:
|
||||
case AV_PIX_FMT_YUVA444P12:
|
||||
cfi = APV_CHROMA_FORMAT_4444;
|
||||
break;
|
||||
default:
|
||||
av_assert0(cfi >= 0);
|
||||
}
|
||||
|
||||
return cfi;
|
||||
}
|
||||
|
||||
static inline int get_min_profile(enum AVPixelFormat pix_fmt)
|
||||
{
|
||||
int profile = AV_PROFILE_UNKNOWN;
|
||||
|
||||
switch (pix_fmt) {
|
||||
case AV_PIX_FMT_GRAY10:
|
||||
profile = AV_PROFILE_APV_400_10;
|
||||
break;
|
||||
case AV_PIX_FMT_YUV422P10:
|
||||
profile = AV_PROFILE_APV_422_10;
|
||||
break;
|
||||
case AV_PIX_FMT_YUV422P12:
|
||||
profile = AV_PROFILE_APV_422_12;
|
||||
break;
|
||||
case AV_PIX_FMT_YUV444P10:
|
||||
profile = AV_PROFILE_APV_444_10;
|
||||
break;
|
||||
case AV_PIX_FMT_YUV444P12:
|
||||
profile = AV_PROFILE_APV_444_12;
|
||||
break;
|
||||
case AV_PIX_FMT_YUVA444P10:
|
||||
profile = AV_PROFILE_APV_4444_10;
|
||||
break;
|
||||
case AV_PIX_FMT_YUVA444P12:
|
||||
profile = AV_PROFILE_APV_4444_12;
|
||||
break;
|
||||
default:
|
||||
av_assert0(profile != AV_PROFILE_UNKNOWN);
|
||||
}
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
static int profile_is_compatible(enum AVPixelFormat pix_fmt, int profile)
|
||||
{
|
||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
|
||||
const int chroma_format_idc = get_chroma_format_idc(pix_fmt);
|
||||
const int bit_depth = desc->comp[0].depth;
|
||||
|
||||
av_assert0(desc);
|
||||
|
||||
switch (profile) {
|
||||
case AV_PROFILE_APV_422_10:
|
||||
return chroma_format_idc == APV_CHROMA_FORMAT_422 && bit_depth == 10;
|
||||
case AV_PROFILE_APV_422_12:
|
||||
return chroma_format_idc == APV_CHROMA_FORMAT_422 &&
|
||||
bit_depth >= 10 && bit_depth <= 12;
|
||||
case AV_PROFILE_APV_444_10:
|
||||
return chroma_format_idc >= APV_CHROMA_FORMAT_422 &&
|
||||
chroma_format_idc <= APV_CHROMA_FORMAT_444 &&
|
||||
bit_depth == 10;
|
||||
case AV_PROFILE_APV_444_12:
|
||||
return chroma_format_idc >= APV_CHROMA_FORMAT_422 &&
|
||||
chroma_format_idc <= APV_CHROMA_FORMAT_444 &&
|
||||
bit_depth >= 10 && bit_depth <= 12;
|
||||
case AV_PROFILE_APV_4444_10:
|
||||
return chroma_format_idc >= APV_CHROMA_FORMAT_422 &&
|
||||
chroma_format_idc <= APV_CHROMA_FORMAT_4444 &&
|
||||
bit_depth == 10;
|
||||
case AV_PROFILE_APV_4444_12:
|
||||
return chroma_format_idc >= APV_CHROMA_FORMAT_422 &&
|
||||
chroma_format_idc <= APV_CHROMA_FORMAT_4444 &&
|
||||
bit_depth >= 10 && bit_depth <= 12;
|
||||
case AV_PROFILE_APV_400_10:
|
||||
return chroma_format_idc == APV_CHROMA_FORMAT_400 && bit_depth == 10;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int validate_profile(AVCodecContext *avctx, int profile)
|
||||
{
|
||||
const int minimum = get_min_profile(avctx->pix_fmt);
|
||||
const char *profile_name = av_get_profile_name(avctx->codec, profile);
|
||||
const char *minimum_name = av_get_profile_name(avctx->codec, minimum);
|
||||
|
||||
if (!profile_is_compatible(avctx->pix_fmt, profile)) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Profile %s (%d) is incompatible with pixel format %s; minimum compatible profile is %s (%d)\n",
|
||||
profile_name ? profile_name : "unknown", profile,
|
||||
av_get_pix_fmt_name(avctx->pix_fmt),
|
||||
minimum_name ? minimum_name : "unknown", minimum);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static oapv_imgb_t *apv_imgb_create(AVCodecContext *avctx)
|
||||
{
|
||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
|
||||
@@ -293,12 +180,22 @@ fail:
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the liboapv configuration from AVCodecContext and encoder options.
|
||||
* The function returns a pointer to the object of the oapve_cdesc_t type.
|
||||
* oapve_cdesc_t contains all encoder parameters that should be initialized before the encoder is used.
|
||||
*
|
||||
* AVCodecContext fields are applied first, followed by liboapv private options
|
||||
* and finally oapv-params. The APV profile defaults to the minimum profile
|
||||
* implied by pix_fmt, and later overrides must remain compatible with that
|
||||
* pixel format.
|
||||
* The field values of the oapve_cdesc_t structure are populated based on:
|
||||
* - the corresponding field values of the AvCodecConetxt structure,
|
||||
* - the apv encoder specific option values,
|
||||
*
|
||||
* The order of processing input data and populating the apve_cdsc structure
|
||||
* 1) first, the fields of the AVCodecContext structure corresponding to the provided input options are processed,
|
||||
* (i.e -pix_fmt yuv422p -s:v 1920x1080 -r 30 -profile:v 0)
|
||||
* 2) then apve-specific options added as AVOption to the apv AVCodec implementation
|
||||
* (i.e -preset 0)
|
||||
*
|
||||
* Keep in mind that, there are options that can be set in different ways.
|
||||
* In this case, please follow the above-mentioned order of processing.
|
||||
* The most recent assignments overwrite the previous values.
|
||||
*
|
||||
* @param[in] avctx codec context (AVCodecContext)
|
||||
* @param[out] cdsc contains all APV encoder encoder parameters that should be initialized before the encoder is use
|
||||
@@ -331,13 +228,6 @@ static int get_conf(AVCodecContext *avctx, oapve_cdesc_t *cdsc)
|
||||
cdsc->param[FRM_IDX].fps_den = avctx->time_base.num;
|
||||
}
|
||||
|
||||
cdsc->param[FRM_IDX].profile_idc = get_min_profile(avctx->pix_fmt);
|
||||
if (avctx->profile != AV_PROFILE_UNKNOWN) {
|
||||
ret = validate_profile(avctx, avctx->profile);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
cdsc->param[FRM_IDX].profile_idc = avctx->profile;
|
||||
}
|
||||
cdsc->param[FRM_IDX].preset = apv->preset_id;
|
||||
cdsc->param[FRM_IDX].qp = apv->qp;
|
||||
if (avctx->bit_rate / 1000 > INT_MAX || avctx->rc_max_rate / 1000 > INT_MAX) {
|
||||
@@ -385,12 +275,6 @@ static int get_conf(AVCodecContext *avctx, oapve_cdesc_t *cdsc)
|
||||
av_log(avctx, AV_LOG_WARNING, "Error parsing option '%s = %s'.\n", en->key, en->value);
|
||||
}
|
||||
|
||||
ret = validate_profile(avctx, cdsc->param[FRM_IDX].profile_idc);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
avctx->profile = cdsc->param[FRM_IDX].profile_idc;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -542,7 +426,7 @@ static av_cold int liboapve_close(AVCodecContext *avctx)
|
||||
{
|
||||
ApvEncContext *apv = avctx->priv_data;
|
||||
|
||||
for (int i = 0; i < apv->ifrms.num_frms; i++) {
|
||||
for (int i = 0; i < apv->num_frames; i++) {
|
||||
if (apv->ifrms.frm[i].imgb != NULL)
|
||||
apv->ifrms.frm[i].imgb->release(apv->ifrms.frm[i].imgb);
|
||||
apv->ifrms.frm[i].imgb = NULL;
|
||||
|
||||
+5
-13
@@ -225,8 +225,7 @@ static int magy_decode_slice10(AVCodecContext *avctx, void *tdata,
|
||||
s->llviddsp.add_left_pred_int16(dst, dst, max, width, 0);
|
||||
dst += stride;
|
||||
}
|
||||
if (1 + interlaced < height)
|
||||
lefttop = left = dst[0];
|
||||
lefttop = left = dst[0];
|
||||
for (k = 1 + interlaced; k < height; k++) {
|
||||
magicyuv_median_pred16(dst, dst - fake_stride, dst, width, &left, &lefttop, max);
|
||||
lefttop = left = dst[0];
|
||||
@@ -554,13 +553,6 @@ static int magy_decode_frame(AVCodecContext *avctx, AVFrame *p,
|
||||
"invalid slice height: %d\n", s->slice_height);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (s->vshift[1] && (s->slice_height & ((1 << s->vshift[1]) - 1))) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"slice_height %d is not aligned to chroma vertical "
|
||||
"subsampling (must be a multiple of %d)\n",
|
||||
s->slice_height, 1 << s->vshift[1]);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
bytestream2_skipu(&gb, 4);
|
||||
|
||||
@@ -571,11 +563,11 @@ static int magy_decode_frame(AVCodecContext *avctx, AVFrame *p,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if ((s->slice_height >> s->vshift[1]) <= s->interlaced) {
|
||||
av_log(avctx, AV_LOG_ERROR, "impossible slice height\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (s->interlaced) {
|
||||
if ((s->slice_height >> s->vshift[1]) < 2) {
|
||||
av_log(avctx, AV_LOG_ERROR, "impossible slice height\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if ((avctx->coded_height % s->slice_height) && ((avctx->coded_height % s->slice_height) >> s->vshift[1]) < 2) {
|
||||
av_log(avctx, AV_LOG_ERROR, "impossible height\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -57,12 +57,6 @@ static av_cold int misc4_init(AVCodecContext *avctx)
|
||||
{
|
||||
MISC4Context *s = avctx->priv_data;
|
||||
|
||||
if (avctx->sample_rate <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (avctx->ch_layout.nb_channels != 1 && avctx->ch_layout.nb_channels != 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||
switch (avctx->sample_rate) {
|
||||
case 8000:
|
||||
|
||||
@@ -1453,7 +1453,6 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s)
|
||||
int linesize[MAX_COMPONENTS];
|
||||
GetBitContext mb_bitmask_gb = {0}; // initialize to silence gcc warning
|
||||
int bytes_per_pixel = 1 + (s->bits > 8);
|
||||
int field_pos = -1;
|
||||
int ret;
|
||||
|
||||
if (s->avctx->codec_id == AV_CODEC_ID_MXPEG) {
|
||||
@@ -1587,11 +1586,9 @@ next_field:
|
||||
if (s->interlaced &&
|
||||
bytestream2_get_bytes_left(&s->gB) > 2 &&
|
||||
bytestream2_tell(&s->gB) > 2 &&
|
||||
bytestream2_tell(&s->gB) != field_pos &&
|
||||
s->gB.buffer[-2] == 0xFF &&
|
||||
s->gB.buffer[-1] == 0xD1) {
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "AVRn interlaced picture marker found\n");
|
||||
field_pos = bytestream2_tell(&s->gB);
|
||||
s->bottom_field ^= 1;
|
||||
|
||||
goto next_field;
|
||||
|
||||
+3
-11
@@ -65,9 +65,6 @@ static int rle_uncompress(GetByteContext *gb, PutByteContext *pb, GetByteContext
|
||||
} else if (run == 255) {
|
||||
int pos = bytestream2_tell_p(pb);
|
||||
|
||||
if (!gbp)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
bytestream2_seek(gbp, pos, SEEK_SET);
|
||||
|
||||
if (pos + width - w < fill)
|
||||
@@ -131,16 +128,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
return ret;
|
||||
|
||||
bytestream2_init(&gb, s->decomp_buf, zstream->total_out);
|
||||
if (s->prev_frame->data[0])
|
||||
bytestream2_init(&gbp, s->prev_frame->data[0], avctx->height * s->prev_frame->linesize[0]);
|
||||
bytestream2_init(&gbp, s->prev_frame->data[0], avctx->height * s->prev_frame->linesize[0]);
|
||||
bytestream2_init_writer(&pb, frame->data[0], avctx->height * frame->linesize[0]);
|
||||
|
||||
ret = rle_uncompress(&gb, &pb, s->prev_frame->data[0] ? &gbp : NULL,
|
||||
avctx->width, avctx->height, avctx->width * 3,
|
||||
frame->linesize[0], s->prev_frame->linesize[0]);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (ret)
|
||||
if (rle_uncompress(&gb, &pb, &gbp, avctx->width, avctx->height, avctx->width * 3,
|
||||
frame->linesize[0], s->prev_frame->linesize[0]))
|
||||
frame->flags |= AV_FRAME_FLAG_KEY;
|
||||
else
|
||||
frame->flags &= ~AV_FRAME_FLAG_KEY;
|
||||
|
||||
@@ -90,8 +90,6 @@ static int lz4_decompress(AVCodecContext *avctx,
|
||||
unsigned char current;
|
||||
do {
|
||||
current = bytestream2_get_byte(gb);
|
||||
if (current > INT_MAX - num_literals)
|
||||
return AVERROR_INVALIDDATA;
|
||||
num_literals += current;
|
||||
} while (current == 255);
|
||||
}
|
||||
@@ -124,8 +122,6 @@ static int lz4_decompress(AVCodecContext *avctx,
|
||||
|
||||
do {
|
||||
current = bytestream2_get_byte(gb);
|
||||
if (current > INT_MAX - match_length)
|
||||
return AVERROR_INVALIDDATA;
|
||||
match_length += current;
|
||||
} while (current == 255);
|
||||
}
|
||||
|
||||
+1
-8
@@ -263,10 +263,8 @@ static void nvenc_map_preset(NvencContext *ctx)
|
||||
|
||||
static void nvenc_print_driver_requirement(AVCodecContext *avctx, int level)
|
||||
{
|
||||
#if NVENCAPI_CHECK_VERSION(13, 2)
|
||||
#if NVENCAPI_CHECK_VERSION(13, 1)
|
||||
const char *minver = "(unknown)";
|
||||
#elif NVENCAPI_CHECK_VERSION(13, 1)
|
||||
const char *minver = "610.00";
|
||||
#elif NVENCAPI_CHECK_VERSION(13, 0)
|
||||
const char *minver = "570.0";
|
||||
#elif NVENCAPI_CHECK_VERSION(12, 2)
|
||||
@@ -2528,12 +2526,7 @@ static void nvenc_fill_time_code(AVCodecContext *avctx, const AVFrame *frame, NV
|
||||
unsigned hh, mm, ss, ff, drop;
|
||||
ff_timecode_set_smpte(&drop, &hh, &mm, &ss, &ff, avctx->framerate, tc[i + 1], 0, 0);
|
||||
|
||||
#ifdef NVENC_NEW_COUNTING_TYPE
|
||||
time_code->clockTimestamp[i].countingTypeLSB = 0;
|
||||
time_code->clockTimestamp[i].countingTypeMSB = 0;
|
||||
#else
|
||||
time_code->clockTimestamp[i].countingType = 0;
|
||||
#endif
|
||||
time_code->clockTimestamp[i].discontinuityFlag = 0;
|
||||
time_code->clockTimestamp[i].cntDroppedFrames = drop;
|
||||
time_code->clockTimestamp[i].nFrames = ff;
|
||||
|
||||
@@ -111,11 +111,6 @@ typedef void ID3D11Device;
|
||||
#define NVENC_HAVE_MVHEVC
|
||||
#endif
|
||||
|
||||
// SDK 13.1 compile time feature checks
|
||||
#if NVENCAPI_CHECK_VERSION(13, 1)
|
||||
#define NVENC_NEW_COUNTING_TYPE
|
||||
#endif
|
||||
|
||||
typedef struct NvencSurface
|
||||
{
|
||||
NV_ENC_INPUT_PTR input_surface;
|
||||
|
||||
@@ -866,12 +866,6 @@ static int on2avc_decode_frame(AVCodecContext * avctx, AVFrame *frame,
|
||||
av_log(avctx, AV_LOG_ERROR, "No subframes present\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (num_frames > INT_MAX / ON2AVC_SUBFRAME_SIZE) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Too many subframes (%d); per-frame sample count overflows\n",
|
||||
num_frames);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/* get output buffer */
|
||||
frame->nb_samples = ON2AVC_SUBFRAME_SIZE * num_frames;
|
||||
|
||||
@@ -291,9 +291,7 @@ static const AVOption avcodec_options[] = {
|
||||
{"bt709", "BT.709", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_BT709 }, INT_MIN, INT_MAX, V|E|D, .unit = "color_trc_type"},
|
||||
{"unknown", "Unspecified", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_UNSPECIFIED }, INT_MIN, INT_MAX, V|E|D, .unit = "color_trc_type"},
|
||||
{"gamma22", "BT.470 M", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_GAMMA22 }, INT_MIN, INT_MAX, V|E|D, .unit = "color_trc_type"},
|
||||
{"bt470m", "BT.470 M", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_GAMMA22 }, INT_MIN, INT_MAX, V|E|D, .unit = "color_trc_type"},
|
||||
{"gamma28", "BT.470 BG", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_GAMMA28 }, INT_MIN, INT_MAX, V|E|D, .unit = "color_trc_type"},
|
||||
{"bt470bg", "BT.470 BG", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_GAMMA28 }, INT_MIN, INT_MAX, V|E|D, .unit = "color_trc_type"},
|
||||
{"smpte170m", "SMPTE 170 M", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_SMPTE170M }, INT_MIN, INT_MAX, V|E|D, .unit = "color_trc_type"},
|
||||
{"smpte240m", "SMPTE 240 M", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_SMPTE240M }, INT_MIN, INT_MAX, V|E|D, .unit = "color_trc_type"},
|
||||
{"linear", "Linear", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_LINEAR }, INT_MIN, INT_MAX, V|E|D, .unit = "color_trc_type"},
|
||||
|
||||
@@ -463,8 +463,6 @@ int ff_celt_decode_frame(CeltFrame *f, OpusRangeCoder *rc,
|
||||
block->emph_coeff,
|
||||
ff_opus_deemph_weights,
|
||||
frame_size);
|
||||
if (!isnormal(block->emph_coeff))
|
||||
block->emph_coeff = 0.0;
|
||||
}
|
||||
|
||||
if (channels == 1)
|
||||
|
||||
@@ -77,9 +77,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (avpkt->size * 1032LL < ((avctx->width + 7) >> 3) * avctx->height) //Asymptotic max compression of deflate
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
|
||||
return ret;
|
||||
|
||||
|
||||
+1
-1
@@ -558,7 +558,7 @@ static int decode_text_to_exif(PNGDecContext *s, const char *txt_utf8)
|
||||
}
|
||||
|
||||
// first condition checks for overflow in 2 * exif_len
|
||||
if (exif_len > SIZE_MAX / 2 || end - ptr < 2 * exif_len)
|
||||
if ((exif_len & ~SIZE_MAX) || end - ptr < 2 * exif_len)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (exif_len < 10)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -414,11 +414,6 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
/* Flags */
|
||||
int flags = bytestream2_get_be16(&gb_hdr);
|
||||
int align = (flags >> 1) & 0x7;
|
||||
if (align > 4) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Invalid tile alignment %d (max 4)\n", align);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/* Quantization matrix */
|
||||
if (flags & 1)
|
||||
|
||||
@@ -403,7 +403,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
dst->hwaccel_flags = src->hwaccel_flags;
|
||||
|
||||
av_refstruct_replace(&dst->internal->pool, src->internal->pool);
|
||||
ff_decode_internal_sync(dst, src);
|
||||
}
|
||||
|
||||
if (for_user) {
|
||||
|
||||
@@ -157,7 +157,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
if (ctx->max_frame_size > (1 << 20) || !ctx->max_frame_size) {
|
||||
av_log(avctx, AV_LOG_ERROR, "invalid frame size %d\n",
|
||||
ctx->max_frame_size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
ctx->max_frame_size = FFMAX(ctx->max_frame_size, avctx->sample_rate);
|
||||
|
||||
|
||||
+4
-6
@@ -51,8 +51,6 @@ typedef struct RASCContext {
|
||||
GetByteContext gb;
|
||||
uint8_t *delta;
|
||||
int delta_size;
|
||||
uint8_t *mv_scratch;
|
||||
unsigned int mv_scratch_size;
|
||||
uint8_t *cursor;
|
||||
int cursor_size;
|
||||
unsigned cursor_w;
|
||||
@@ -296,8 +294,10 @@ static int decode_move(AVCodecContext *avctx,
|
||||
b2 -= s->frame2->linesize[0];
|
||||
}
|
||||
} else if (type == 0) {
|
||||
av_fast_padded_malloc(&s->mv_scratch, &s->mv_scratch_size, w * h * s->bpp);
|
||||
uint8_t *buffer = s->mv_scratch;
|
||||
uint8_t *buffer;
|
||||
|
||||
av_fast_padded_malloc(&s->delta, &s->delta_size, w * h * s->bpp);
|
||||
buffer = s->delta;
|
||||
if (!buffer)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
@@ -772,8 +772,6 @@ static av_cold int decode_close(AVCodecContext *avctx)
|
||||
s->cursor_size = 0;
|
||||
av_freep(&s->delta);
|
||||
s->delta_size = 0;
|
||||
av_freep(&s->mv_scratch);
|
||||
s->mv_scratch_size = 0;
|
||||
av_frame_free(&s->frame1);
|
||||
av_frame_free(&s->frame2);
|
||||
ff_inflate_end(&s->zstream);
|
||||
|
||||
+1
-2
@@ -415,9 +415,8 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf,
|
||||
H263DecContext *const h = &rv->h;
|
||||
int mb_count, mb_pos, left, start_mb_x, active_bits_size, ret;
|
||||
|
||||
if ((ret = init_get_bits8(&h->gb, buf, FFMAX(buf_size, buf_size2))) < 0)
|
||||
return ret;
|
||||
active_bits_size = buf_size * 8;
|
||||
init_get_bits(&h->gb, buf, FFMAX(buf_size, buf_size2) * 8);
|
||||
if (h->c.codec_id == AV_CODEC_ID_RV10)
|
||||
mb_count = rv10_decode_picture_header(h);
|
||||
else
|
||||
|
||||
+3
-8
@@ -1427,9 +1427,7 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int
|
||||
int mb_pos, slice_type;
|
||||
int res;
|
||||
|
||||
res = init_get_bits8(gb, buf, buf_size);
|
||||
if (res < 0)
|
||||
return res;
|
||||
init_get_bits(gb, buf, buf_size*8);
|
||||
res = r->parse_slice_header(r, gb, &r->si);
|
||||
if(res < 0){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Incorrect or unknown slice header\n");
|
||||
@@ -1649,8 +1647,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict,
|
||||
av_log(avctx, AV_LOG_ERROR, "Slice offset is invalid\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if ((ret = init_get_bits8(&r->gb, buf+offset, buf_size-offset)) < 0)
|
||||
return ret;
|
||||
init_get_bits(&r->gb, buf+offset, (buf_size-offset)*8);
|
||||
if (r->parse_slice_header(r, &r->gb, &si) < 0 || si.start) {
|
||||
av_log(avctx, AV_LOG_ERROR, "First slice header is incorrect\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -1780,9 +1777,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict,
|
||||
av_log(avctx, AV_LOG_ERROR, "Slice offset is invalid\n");
|
||||
break;
|
||||
}
|
||||
ret = init_get_bits8(&r->gb, buf+offset1, buf_size-offset1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
init_get_bits(&r->gb, buf+offset1, (buf_size-offset1)*8);
|
||||
if (r->parse_slice_header(r, &r->gb, &si) < 0) {
|
||||
size = offset2 - offset;
|
||||
}else
|
||||
|
||||
@@ -1228,9 +1228,6 @@ static int old_codec37(SANMVideoContext *ctx, GetByteContext *gb, int top, int l
|
||||
if (width > ctx->aligned_width)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (FFALIGN(height, 4) > ctx->aligned_height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (bytestream2_get_bytes_left(gb) < 16)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -1554,9 +1551,6 @@ static int old_codec47(SANMVideoContext *ctx, GetByteContext *gb, int top, int l
|
||||
if (width > ctx->aligned_width)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (FFALIGN(height, 8) > ctx->aligned_height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (bytestream2_get_bytes_left(gb) < 26)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
|
||||
+9
-15
@@ -705,15 +705,13 @@ static int get_dc(SnowEncContext *enc, int mb_x, int mb_y, int plane_index)
|
||||
|
||||
for(y2= FFMAX(y, 0); y2<FFMIN(h, y+block_h); y2++){
|
||||
for(x2= FFMAX(x, 0); x2<FFMIN(w, x+block_w); x2++){
|
||||
int col= x2-(block_w*mb_x - block_w/2);
|
||||
int row= y2-(block_h*mb_y - block_h/2);
|
||||
int index= col + row*obmc_stride;
|
||||
int index= x2-(block_w*mb_x - block_w/2) + (y2-(block_h*mb_y - block_h/2))*obmc_stride;
|
||||
int obmc_v= obmc[index];
|
||||
int d;
|
||||
if(y<0) obmc_v += obmc[index + block_h*obmc_stride];
|
||||
if(x<0) obmc_v += obmc[index + block_w];
|
||||
if(y+block_h>h && row-block_h >= 0) obmc_v += obmc[index - block_h*obmc_stride];
|
||||
if(x+block_w>w && col-block_w >= 0) obmc_v += obmc[index - block_w];
|
||||
if(y<0) obmc_v += obmc[index + block_h*obmc_stride];
|
||||
if(x<0) obmc_v += obmc[index + block_w];
|
||||
if(y+block_h>h) obmc_v += obmc[index - block_h*obmc_stride];
|
||||
if(x+block_w>w) obmc_v += obmc[index - block_w];
|
||||
//FIXME precalculate this or simplify it somehow else
|
||||
|
||||
d = -dst[index] + (1<<(FRAC_BITS-1));
|
||||
@@ -725,9 +723,6 @@ static int get_dc(SnowEncContext *enc, int mb_x, int mb_y, int plane_index)
|
||||
}
|
||||
*b= backup;
|
||||
|
||||
if (!aa)
|
||||
return 0;
|
||||
|
||||
return av_clip_uint8( ROUNDED_DIV((int64_t)ab<<LOG2_OBMC_MAX, aa) ); //FIXME we should not need clipping
|
||||
}
|
||||
|
||||
@@ -825,14 +820,13 @@ static int get_block_rd(SnowEncContext *enc, int mb_x, int mb_y,
|
||||
&& (mb_x == 0 || mb_x == b_stride-1)
|
||||
&& (mb_y == 0 || mb_y == b_height-1)){
|
||||
if(mb_x == 0)
|
||||
x1 = FFMIN(x1, block_w);
|
||||
x1 = block_w;
|
||||
else
|
||||
x0 = FFMAX(x0, block_w);
|
||||
x0 = block_w;
|
||||
if(mb_y == 0)
|
||||
y1 = FFMIN(y1, block_h);
|
||||
y1 = block_h;
|
||||
else
|
||||
y0 = FFMAX(y0, block_h);
|
||||
x0 = FFMIN(x0, x1);
|
||||
y0 = block_h;
|
||||
for(y=y0; y<y1; y++)
|
||||
memcpy(dst + sx+x0 + (sy+y)*ref_stride, cur + x0 + y*ref_stride, x1-x0);
|
||||
}
|
||||
|
||||
@@ -696,11 +696,6 @@ static int svq1_decode_frame(AVCodecContext *avctx, AVFrame *cur,
|
||||
avctx->skip_frame >= AVDISCARD_ALL)
|
||||
return buf_size;
|
||||
|
||||
// Reject obviously too-small packets early: require at least one remaining bit per aligned luma macroblock.
|
||||
// FFALIGN(s->width, 16) * FFALIGN(s->height, 16) / 256 represent the number of Macroblocks
|
||||
if (get_bits_left(&s->gb) < FFALIGN(s->width, 16) * FFALIGN(s->height, 16) / 256)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
result = ff_get_buffer(avctx, cur, s->nonref ? 0 : AV_GET_BUFFER_FLAG_REF);
|
||||
if (result < 0)
|
||||
return result;
|
||||
|
||||
+4
-7
@@ -127,7 +127,6 @@ static av_cold int tdsc_init(AVCodecContext *avctx)
|
||||
ctx->jpeg_avctx->flags = avctx->flags;
|
||||
ctx->jpeg_avctx->flags2 = avctx->flags2;
|
||||
ctx->jpeg_avctx->idct_algo = avctx->idct_algo;
|
||||
ctx->jpeg_avctx->max_pixels = avctx->max_pixels;
|
||||
ret = avcodec_open2(ctx->jpeg_avctx, NULL, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@@ -241,6 +240,7 @@ static int tdsc_load_cursor(AVCodecContext *avctx)
|
||||
bits <<= 1;
|
||||
}
|
||||
}
|
||||
dst += ctx->cursor_stride - ctx->cursor_w * 4;
|
||||
}
|
||||
|
||||
dst = ctx->cursor;
|
||||
@@ -272,6 +272,7 @@ static int tdsc_load_cursor(AVCodecContext *avctx)
|
||||
bits <<= 1;
|
||||
}
|
||||
}
|
||||
dst += ctx->cursor_stride - ctx->cursor_w * 4;
|
||||
}
|
||||
break;
|
||||
case CUR_FMT_BGRA:
|
||||
@@ -357,8 +358,7 @@ static int tdsc_decode_jpeg_tile(AVCodecContext *avctx, int tile_size,
|
||||
}
|
||||
|
||||
ret = avcodec_receive_frame(ctx->jpeg_avctx, ctx->jpgframe);
|
||||
if (ret < 0 || ctx->jpgframe->format != AV_PIX_FMT_YUVJ420P ||
|
||||
w > ctx->jpgframe->width || h > ctx->jpgframe->height) {
|
||||
if (ret < 0 || ctx->jpgframe->format != AV_PIX_FMT_YUVJ420P) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"JPEG decoding error (%d).\n", ret);
|
||||
|
||||
@@ -402,7 +402,7 @@ static int tdsc_decode_tiles(AVCodecContext *avctx, int number_tiles)
|
||||
}
|
||||
|
||||
tile_size = bytestream2_get_le32(&ctx->gbc);
|
||||
if (bytestream2_get_bytes_left(&ctx->gbc) < tile_size + 24LL)
|
||||
if (bytestream2_get_bytes_left(&ctx->gbc) < tile_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
tile_mode = bytestream2_get_le32(&ctx->gbc);
|
||||
@@ -435,9 +435,6 @@ static int tdsc_decode_tiles(AVCodecContext *avctx, int number_tiles)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else if (tile_mode == MKTAG(' ','W','A','R')) {
|
||||
if (3LL * w * h > tile_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* Just copy the buffer to output */
|
||||
av_image_copy_plane(ctx->refframe->data[0] + x * 3 +
|
||||
ctx->refframe->linesize[0] * y,
|
||||
|
||||
@@ -323,11 +323,6 @@ static int truespeech_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
"Too small input buffer (%d bytes), need at least 32 bytes\n", buf_size);
|
||||
return -1;
|
||||
}
|
||||
if (iterations > INT_MAX / 240) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Too large input buffer (%d bytes); per-block sample count overflows\n", buf_size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/* get output buffer */
|
||||
frame->nb_samples = iterations * 240;
|
||||
|
||||
+33
-33
@@ -56,7 +56,7 @@ static void vc2_subband_dwt_97(VC2TransformContext *t, dwtcoef *data,
|
||||
ptrdiff_t stride, int width, int height)
|
||||
{
|
||||
int x, y;
|
||||
uint32_t *datal = (uint32_t *)data, *synth = (uint32_t *)t->buffer, *synthl = synth;
|
||||
dwtcoef *datal = data, *synth = t->buffer, *synthl = synth;
|
||||
const ptrdiff_t synth_width = width << 1;
|
||||
const ptrdiff_t synth_height = height << 1;
|
||||
|
||||
@@ -75,21 +75,21 @@ static void vc2_subband_dwt_97(VC2TransformContext *t, dwtcoef *data,
|
||||
synthl = synth;
|
||||
for (y = 0; y < synth_height; y++) {
|
||||
/* Lifting stage 2. */
|
||||
synthl[1] -= (dwtcoef)(8*synthl[0] + 9*synthl[2] - synthl[4] + 8) >> 4;
|
||||
synthl[1] -= (8*synthl[0] + 9*synthl[2] - synthl[4] + 8) >> 4;
|
||||
for (x = 1; x < width - 2; x++)
|
||||
synthl[2*x + 1] -= (dwtcoef)(9*synthl[2*x] + 9*synthl[2*x + 2] - synthl[2*x + 4] -
|
||||
synthl[2*x + 1] -= (9*synthl[2*x] + 9*synthl[2*x + 2] - synthl[2*x + 4] -
|
||||
synthl[2 * x - 2] + 8) >> 4;
|
||||
synthl[synth_width - 1] -= (dwtcoef)(17*synthl[synth_width - 2] -
|
||||
synthl[synth_width - 1] -= (17*synthl[synth_width - 2] -
|
||||
synthl[synth_width - 4] + 8) >> 4;
|
||||
synthl[synth_width - 3] -= (dwtcoef)(8*synthl[synth_width - 2] +
|
||||
synthl[synth_width - 3] -= (8*synthl[synth_width - 2] +
|
||||
9*synthl[synth_width - 4] -
|
||||
synthl[synth_width - 6] + 8) >> 4;
|
||||
/* Lifting stage 1. */
|
||||
synthl[0] += (dwtcoef)(synthl[1] + synthl[1] + 2) >> 2;
|
||||
synthl[0] += (synthl[1] + synthl[1] + 2) >> 2;
|
||||
for (x = 1; x < width - 1; x++)
|
||||
synthl[2*x] += (dwtcoef)(synthl[2*x - 1] + synthl[2*x + 1] + 2) >> 2;
|
||||
synthl[2*x] += (synthl[2*x - 1] + synthl[2*x + 1] + 2) >> 2;
|
||||
|
||||
synthl[synth_width - 2] += (dwtcoef)(synthl[synth_width - 3] +
|
||||
synthl[synth_width - 2] += (synthl[synth_width - 3] +
|
||||
synthl[synth_width - 1] + 2) >> 2;
|
||||
synthl += synth_width;
|
||||
}
|
||||
@@ -97,13 +97,13 @@ static void vc2_subband_dwt_97(VC2TransformContext *t, dwtcoef *data,
|
||||
/* Vertical synthesis: Lifting stage 2. */
|
||||
synthl = synth + synth_width;
|
||||
for (x = 0; x < synth_width; x++)
|
||||
synthl[x] -= (dwtcoef)(8*synthl[x - synth_width] + 9*synthl[x + synth_width] -
|
||||
synthl[x] -= (8*synthl[x - synth_width] + 9*synthl[x + synth_width] -
|
||||
synthl[x + 3 * synth_width] + 8) >> 4;
|
||||
|
||||
synthl = synth + (synth_width << 1);
|
||||
for (y = 1; y < height - 2; y++) {
|
||||
for (x = 0; x < synth_width; x++)
|
||||
synthl[x + synth_width] -= (dwtcoef)(9*synthl[x] +
|
||||
synthl[x + synth_width] -= (9*synthl[x] +
|
||||
9*synthl[x + 2 * synth_width] -
|
||||
synthl[x - 2 * synth_width] -
|
||||
synthl[x + 4 * synth_width] + 8) >> 4;
|
||||
@@ -112,36 +112,36 @@ static void vc2_subband_dwt_97(VC2TransformContext *t, dwtcoef *data,
|
||||
|
||||
synthl = synth + (synth_height - 1) * synth_width;
|
||||
for (x = 0; x < synth_width; x++) {
|
||||
synthl[x] -= (dwtcoef)(17*synthl[x - synth_width] -
|
||||
synthl[x] -= (17*synthl[x - synth_width] -
|
||||
synthl[x - 3*synth_width] + 8) >> 4;
|
||||
synthl[x - 2*synth_width] -= (dwtcoef)(9*synthl[x - 3*synth_width] +
|
||||
synthl[x - 2*synth_width] -= (9*synthl[x - 3*synth_width] +
|
||||
8*synthl[x - 1*synth_width] - synthl[x - 5*synth_width] + 8) >> 4;
|
||||
}
|
||||
|
||||
/* Vertical synthesis: Lifting stage 1. */
|
||||
synthl = synth;
|
||||
for (x = 0; x < synth_width; x++)
|
||||
synthl[x] += (dwtcoef)(synthl[x + synth_width] + synthl[x + synth_width] + 2) >> 2;
|
||||
synthl[x] += (synthl[x + synth_width] + synthl[x + synth_width] + 2) >> 2;
|
||||
|
||||
synthl = synth + (synth_width << 1);
|
||||
for (y = 1; y < height - 1; y++) {
|
||||
for (x = 0; x < synth_width; x++)
|
||||
synthl[x] += (dwtcoef)(synthl[x - synth_width] + synthl[x + synth_width] + 2) >> 2;
|
||||
synthl[x] += (synthl[x - synth_width] + synthl[x + synth_width] + 2) >> 2;
|
||||
synthl += synth_width << 1;
|
||||
}
|
||||
|
||||
synthl = synth + (synth_height - 2) * synth_width;
|
||||
for (x = 0; x < synth_width; x++)
|
||||
synthl[x] += (dwtcoef)(synthl[x - synth_width] + synthl[x + synth_width] + 2) >> 2;
|
||||
synthl[x] += (synthl[x - synth_width] + synthl[x + synth_width] + 2) >> 2;
|
||||
|
||||
deinterleave(data, stride, width, height, (dwtcoef *)synth);
|
||||
deinterleave(data, stride, width, height, synth);
|
||||
}
|
||||
|
||||
static void vc2_subband_dwt_53(VC2TransformContext *t, dwtcoef *data,
|
||||
ptrdiff_t stride, int width, int height)
|
||||
{
|
||||
int x, y;
|
||||
uint32_t *synth = (uint32_t *)t->buffer, *synthl = synth, *datal = (uint32_t *)data;
|
||||
dwtcoef *synth = t->buffer, *synthl = synth, *datal = data;
|
||||
const ptrdiff_t synth_width = width << 1;
|
||||
const ptrdiff_t synth_height = height << 1;
|
||||
|
||||
@@ -161,16 +161,16 @@ static void vc2_subband_dwt_53(VC2TransformContext *t, dwtcoef *data,
|
||||
for (y = 0; y < synth_height; y++) {
|
||||
/* Lifting stage 2. */
|
||||
for (x = 0; x < width - 1; x++)
|
||||
synthl[2 * x + 1] -= (dwtcoef)(synthl[2 * x] + synthl[2 * x + 2] + 1) >> 1;
|
||||
synthl[2 * x + 1] -= (synthl[2 * x] + synthl[2 * x + 2] + 1) >> 1;
|
||||
|
||||
synthl[synth_width - 1] -= (dwtcoef)(2*synthl[synth_width - 2] + 1) >> 1;
|
||||
synthl[synth_width - 1] -= (2*synthl[synth_width - 2] + 1) >> 1;
|
||||
|
||||
/* Lifting stage 1. */
|
||||
synthl[0] += (dwtcoef)(2*synthl[1] + 2) >> 2;
|
||||
synthl[0] += (2*synthl[1] + 2) >> 2;
|
||||
for (x = 1; x < width - 1; x++)
|
||||
synthl[2 * x] += (dwtcoef)(synthl[2 * x - 1] + synthl[2 * x + 1] + 2) >> 2;
|
||||
synthl[2 * x] += (synthl[2 * x - 1] + synthl[2 * x + 1] + 2) >> 2;
|
||||
|
||||
synthl[synth_width - 2] += (dwtcoef)(synthl[synth_width - 3] + synthl[synth_width - 1] + 2) >> 2;
|
||||
synthl[synth_width - 2] += (synthl[synth_width - 3] + synthl[synth_width - 1] + 2) >> 2;
|
||||
|
||||
synthl += synth_width;
|
||||
}
|
||||
@@ -178,37 +178,37 @@ static void vc2_subband_dwt_53(VC2TransformContext *t, dwtcoef *data,
|
||||
/* Vertical synthesis: Lifting stage 2. */
|
||||
synthl = synth + synth_width;
|
||||
for (x = 0; x < synth_width; x++)
|
||||
synthl[x] -= (dwtcoef)(synthl[x - synth_width] + synthl[x + synth_width] + 1) >> 1;
|
||||
synthl[x] -= (synthl[x - synth_width] + synthl[x + synth_width] + 1) >> 1;
|
||||
|
||||
synthl = synth + (synth_width << 1);
|
||||
for (y = 1; y < height - 1; y++) {
|
||||
for (x = 0; x < synth_width; x++)
|
||||
synthl[x + synth_width] -= (dwtcoef)(synthl[x] + synthl[x + synth_width * 2] + 1) >> 1;
|
||||
synthl[x + synth_width] -= (synthl[x] + synthl[x + synth_width * 2] + 1) >> 1;
|
||||
synthl += (synth_width << 1);
|
||||
}
|
||||
|
||||
synthl = synth + (synth_height - 1) * synth_width;
|
||||
for (x = 0; x < synth_width; x++)
|
||||
synthl[x] -= (dwtcoef)(2*synthl[x - synth_width] + 1) >> 1;
|
||||
synthl[x] -= (2*synthl[x - synth_width] + 1) >> 1;
|
||||
|
||||
/* Vertical synthesis: Lifting stage 1. */
|
||||
synthl = synth;
|
||||
for (x = 0; x < synth_width; x++)
|
||||
synthl[x] += (dwtcoef)(2*synthl[synth_width + x] + 2) >> 2;
|
||||
synthl[x] += (2*synthl[synth_width + x] + 2) >> 2;
|
||||
|
||||
synthl = synth + (synth_width << 1);
|
||||
for (y = 1; y < height - 1; y++) {
|
||||
for (x = 0; x < synth_width; x++)
|
||||
synthl[x] += (dwtcoef)(synthl[x + synth_width] + synthl[x - synth_width] + 2) >> 2;
|
||||
synthl[x] += (synthl[x + synth_width] + synthl[x - synth_width] + 2) >> 2;
|
||||
synthl += (synth_width << 1);
|
||||
}
|
||||
|
||||
synthl = synth + (synth_height - 2)*synth_width;
|
||||
for (x = 0; x < synth_width; x++)
|
||||
synthl[x] += (dwtcoef)(synthl[x - synth_width] + synthl[x + synth_width] + 2) >> 2;
|
||||
synthl[x] += (synthl[x - synth_width] + synthl[x + synth_width] + 2) >> 2;
|
||||
|
||||
|
||||
deinterleave(data, stride, width, height, (dwtcoef *)synth);
|
||||
deinterleave(data, stride, width, height, synth);
|
||||
}
|
||||
|
||||
static av_always_inline void dwt_haar(VC2TransformContext *t, dwtcoef *data,
|
||||
@@ -216,7 +216,7 @@ static av_always_inline void dwt_haar(VC2TransformContext *t, dwtcoef *data,
|
||||
const int s)
|
||||
{
|
||||
int x, y;
|
||||
uint32_t *synth = (uint32_t *)t->buffer, *synthl = synth, *datal = (uint32_t *)data;
|
||||
dwtcoef *synth = t->buffer, *synthl = synth, *datal = data;
|
||||
const ptrdiff_t synth_width = width << 1;
|
||||
const ptrdiff_t synth_height = height << 1;
|
||||
|
||||
@@ -225,7 +225,7 @@ static av_always_inline void dwt_haar(VC2TransformContext *t, dwtcoef *data,
|
||||
for (x = 0; x < synth_width; x += 2) {
|
||||
synthl[y*synth_width + x + 1] = (datal[y*stride + x + 1] - datal[y*stride + x]) * (1 << s);
|
||||
synthl[y*synth_width + x] = datal[y*stride + x + 0] * (1 << s) +
|
||||
((dwtcoef)(synthl[y*synth_width + x + 1] + 1) >> 1);
|
||||
((synthl[y*synth_width + x + 1] + 1) >> 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,11 +235,11 @@ static av_always_inline void dwt_haar(VC2TransformContext *t, dwtcoef *data,
|
||||
synthl[(y + 1)*synth_width + x] = synthl[(y + 1)*synth_width + x] -
|
||||
synthl[y*synth_width + x];
|
||||
synthl[y*synth_width + x] = synthl[y*synth_width + x] +
|
||||
((dwtcoef)(synthl[(y + 1)*synth_width + x] + 1) >> 1);
|
||||
((synthl[(y + 1)*synth_width + x] + 1) >> 1);
|
||||
}
|
||||
}
|
||||
|
||||
deinterleave(data, stride, width, height, (dwtcoef *)synth);
|
||||
deinterleave(data, stride, width, height, synth);
|
||||
}
|
||||
|
||||
static void vc2_subband_dwt_haar(VC2TransformContext *t, dwtcoef *data,
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
#include "version_major.h"
|
||||
|
||||
#define LIBAVCODEC_VERSION_MINOR 28
|
||||
#define LIBAVCODEC_VERSION_MICRO 102
|
||||
#define LIBAVCODEC_VERSION_MINOR 29
|
||||
#define LIBAVCODEC_VERSION_MICRO 100
|
||||
|
||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||
LIBAVCODEC_VERSION_MINOR, \
|
||||
|
||||
@@ -83,7 +83,7 @@ CFDataRef ff_videotoolbox_vpcc_extradata_create(AVCodecContext *avctx)
|
||||
p = vt_extradata;
|
||||
|
||||
*p++ = 1; /* version */
|
||||
AV_WB24(p, 0); /* flags */
|
||||
AV_WB24(p + 1, 0); /* flags */
|
||||
p += 3;
|
||||
|
||||
*p++ = h->h.profile;
|
||||
|
||||
@@ -2150,7 +2150,7 @@ static int copy_replace_length_codes(
|
||||
uint8_t *new_sei;
|
||||
old_sei_length = find_sei_end(avctx, dst_box, box_len, &new_sei);
|
||||
if (old_sei_length < 0)
|
||||
return old_sei_length;
|
||||
return status;
|
||||
|
||||
wrote_bytes = write_sei(sei,
|
||||
SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35,
|
||||
|
||||
+1
-4
@@ -255,10 +255,8 @@ static int update_size(AVCodecContext *avctx, int w, int h)
|
||||
*fmtp = AV_PIX_FMT_NONE;
|
||||
|
||||
ret = ff_get_format(avctx, pix_fmts);
|
||||
if (ret < 0) {
|
||||
ff_set_dimensions(avctx, s->w, s->h);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
avctx->pix_fmt = ret;
|
||||
s->gf_fmt = s->pix_fmt;
|
||||
@@ -1827,7 +1825,6 @@ finish:
|
||||
|
||||
return pkt->size;
|
||||
fail:
|
||||
ff_cbs_fragment_reset(&s->current_frag);
|
||||
ff_progress_frame_report(&s->s.frames[CUR_FRAME].tf, INT_MAX);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -751,8 +751,6 @@ av_cold int ff_vulkan_encode_init(AVCodecContext *avctx, FFVulkanEncodeContext *
|
||||
|
||||
VkVideoFormatPropertiesKHR *ret_info;
|
||||
uint32_t nb_out_fmts = 0;
|
||||
const uint32_t feedback_flags = VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BUFFER_OFFSET_BIT_KHR |
|
||||
VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BYTES_WRITTEN_BIT_KHR;
|
||||
|
||||
VkPhysicalDeviceVideoEncodeQualityLevelInfoKHR quality_info;
|
||||
|
||||
@@ -873,14 +871,6 @@ av_cold int ff_vulkan_encode_init(AVCodecContext *avctx, FFVulkanEncodeContext *
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
if ((ctx->enc_caps.supportedEncodeFeedbackFlags & feedback_flags) !=
|
||||
feedback_flags) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Driver does not support required encode feedback flags "
|
||||
"(BUFFER_OFFSET and BYTES_WRITTEN).\n");
|
||||
return AVERROR(ENOTSUP);
|
||||
}
|
||||
|
||||
err = init_rc(avctx, ctx);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@@ -889,7 +879,8 @@ av_cold int ff_vulkan_encode_init(AVCodecContext *avctx, FFVulkanEncodeContext *
|
||||
query_create = (VkQueryPoolVideoEncodeFeedbackCreateInfoKHR) {
|
||||
.sType = VK_STRUCTURE_TYPE_QUERY_POOL_VIDEO_ENCODE_FEEDBACK_CREATE_INFO_KHR,
|
||||
.pNext = &ctx->profile,
|
||||
.encodeFeedbackFlags = feedback_flags,
|
||||
.encodeFeedbackFlags = ctx->enc_caps.supportedEncodeFeedbackFlags &
|
||||
(~VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_HAS_OVERRIDES_BIT_KHR),
|
||||
};
|
||||
err = ff_vk_exec_pool_init(s, ctx->qf_enc, &ctx->enc_pool, base_ctx->async_depth,
|
||||
1, VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR, 0,
|
||||
|
||||
+2
-2
@@ -65,14 +65,14 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
flags1 = 0;
|
||||
flags2 = 1;
|
||||
if (avctx->codec->id == AV_CODEC_ID_WMAV1) {
|
||||
extradata = av_mallocz(4 + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
extradata = av_malloc(4);
|
||||
if (!extradata)
|
||||
return AVERROR(ENOMEM);
|
||||
avctx->extradata_size = 4;
|
||||
AV_WL16(extradata, flags1);
|
||||
AV_WL16(extradata + 2, flags2);
|
||||
} else if (avctx->codec->id == AV_CODEC_ID_WMAV2) {
|
||||
extradata = av_mallocz(10 + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
extradata = av_mallocz(10);
|
||||
if (!extradata)
|
||||
return AVERROR(ENOMEM);
|
||||
avctx->extradata_size = 10;
|
||||
|
||||
@@ -343,8 +343,6 @@ static int parse_mb_skip(WMV2DecContext *w)
|
||||
mb_type[mb_y * h->c.mb_stride + mb_x] =
|
||||
MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV;
|
||||
} else {
|
||||
if (get_bits_left(&h->gb) < h->c.mb_width)
|
||||
return AVERROR_INVALIDDATA;
|
||||
for (int mb_x = 0; mb_x < h->c.mb_width; mb_x++)
|
||||
mb_type[mb_y * h->c.mb_stride + mb_x] =
|
||||
(get_bits1(&h->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV;
|
||||
@@ -360,8 +358,6 @@ static int parse_mb_skip(WMV2DecContext *w)
|
||||
mb_type[mb_y * h->c.mb_stride + mb_x] =
|
||||
MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV;
|
||||
} else {
|
||||
if (get_bits_left(&h->gb) < h->c.mb_height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
for (int mb_y = 0; mb_y < h->c.mb_height; mb_y++)
|
||||
mb_type[mb_y * h->c.mb_stride + mb_x] =
|
||||
(get_bits1(&h->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_FORWARD_MV;
|
||||
|
||||
@@ -41,8 +41,8 @@ align 16
|
||||
mova m1, [angq+block_sizeq]
|
||||
xorps m2, m2
|
||||
xorps m3, m3
|
||||
cmpltps m2, m0 ; m < 0.0
|
||||
cmpltps m3, m1 ; a < 0.0
|
||||
cmpleps m2, m0 ; m <= 0.0
|
||||
cmpleps m3, m1 ; a <= 0.0
|
||||
andps m2, m5 ; keep only the sign bit
|
||||
xorps m1, m2
|
||||
mova m4, m3
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ static av_cold int xan_decode_init(AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
s->buffer_size = avctx->width * avctx->height;
|
||||
s->y_buffer = av_mallocz(s->buffer_size);
|
||||
s->y_buffer = av_malloc(s->buffer_size);
|
||||
if (!s->y_buffer)
|
||||
return AVERROR(ENOMEM);
|
||||
s->scratch_buffer = av_malloc(s->buffer_size + 130);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user