Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd26b07e8b |
4
CREDITS
4
CREDITS
@@ -1,6 +1,6 @@
|
||||
See the Git history of the project (https://git.ffmpeg.org/ffmpeg) to
|
||||
See the Git history of the project (git://source.ffmpeg.org/ffmpeg) to
|
||||
get the names of people who have contributed to FFmpeg.
|
||||
|
||||
To check the log, you can type the command "git log" in the FFmpeg
|
||||
source directory, or browse the online repository at
|
||||
https://git.ffmpeg.org/ffmpeg
|
||||
http://source.ffmpeg.org.
|
||||
|
||||
142
Changelog
142
Changelog
@@ -1,148 +1,6 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 5.1.3:
|
||||
- avcodec/tests/snowenc: Fix 2nd test
|
||||
- avcodec/tests/snowenc: return a failure if DWT/IDWT mismatches
|
||||
- avcodec/snowenc: Fix visual weight calculation
|
||||
- avcodec/tests/snowenc: unbreak DWT tests
|
||||
- update for 5.1.3
|
||||
- avcodec/mpeg12dec: Check input size
|
||||
- avcodec/escape124: Fix some return codes
|
||||
- avcodec/escape124: fix signdness of end of input check
|
||||
- Use https for repository links
|
||||
- avcodec/rpzaenc: stop accessing out of bounds frame
|
||||
- avcodec/smcenc: stop accessing out of bounds frame
|
||||
- avcodec/motionpixels: Mask pixels to valid values
|
||||
- avcodec/xpmdec: Check size before allocation to avoid truncation
|
||||
- avcodec/bink: Avoid undefined out of array end pointers in binkb_decode_plane()
|
||||
- avcodec/bink: Fix off by 1 error in ref end
|
||||
- avcodec/utils: Ensure linesize for SVQ3
|
||||
- avcodec/utils: allocate a line more for VC1 and WMV3
|
||||
- avcodec/videodsp_template: Adjust pointers to avoid undefined pointer things
|
||||
- avcodec/pngdec: dont skip/read chunk twice
|
||||
- avcodec/pngdec: Check deloco index more exactly
|
||||
- avcodec/ffv1dec: Check that num h/v slices is supported
|
||||
- avformat/mov: Check samplesize and offset to avoid integer overflow
|
||||
- lavu/vulkan: fix handle type for 32-bit targets
|
||||
- vulkan: Fix win/i386 calling convention
|
||||
- avcodec/pictordec: Remove mid exit branch
|
||||
- avcodec/eac3dec: avoid float noise in fixed mode addition to overflow
|
||||
- avcodec/utils: use 32pixel alignment for bink
|
||||
- avcodec/scpr3: Check bx
|
||||
- avcodec/012v: Order operations for odd size handling
|
||||
- avcodec/eatgq: : Check index increments in tgq_decode_block()
|
||||
- avcodec/h274: fix include
|
||||
- avcodec/scpr: Test bx before use
|
||||
- avformat/mxfdec: Use 64bit in remainder
|
||||
- avcodec/sunrast: Fix maplength check
|
||||
- avcodec/wavpack: Avoid undefined shift in get_tail()
|
||||
- avcodec/wavpack: Check for end of input in wv_unpack_dsd_high()
|
||||
- avformat/id3v2: Check taglen in read_uslt()
|
||||
- avcodec/tiff: Ignore tile_count
|
||||
- avcodec/ffv1dec: restructure slice coordinate reading a bit
|
||||
- avcodec/mlpdec: Check max matrix instead of max channel in noise check
|
||||
- avutil/tx: Use unsigned in ff_tx_fft_sr_combine() to avoid undefined behavior
|
||||
- swscale/input: Use more unsigned intermediates
|
||||
- avcodec/alsdec: Check bits left before block decoding in non multi channel coding loop
|
||||
- avcodec/alsdec: The minimal block is at least 7 bits
|
||||
- avformat/replaygain: avoid undefined / negative abs
|
||||
- swscale/output: Bias 16bps output calculations to improve non overflowing range for GBRP16/GBRPF32
|
||||
- swscale/output: Bias 16bps output calculations to improve non overflowing range
|
||||
- avcodec/speedhq: Check buf_size to be big enough for DC
|
||||
- avcodec/ffv1dec: Fail earlier if prior context is corrupted
|
||||
- avcodec/speexdec: Check channels > 2
|
||||
- avformat/vividas: Check packet size
|
||||
- hwcontext_vulkan: remove optional encode/decode extensions from the list
|
||||
- avcodec/libjxldec: fix gamma22 and gamma28 recognition
|
||||
- avcodec/mpeg12dec: use init_get_bits8 and check the return value
|
||||
- avcodec/nvenc: fix vbv buffer size in cq mode
|
||||
- avcodec/mjpegenc: take into account component count when writing the SOF header size
|
||||
- swscale: aarch64: Fix yuv2rgb with negative strides
|
||||
- avcodec/atrac3plus: reorder channels to match the output layout
|
||||
- avcodec/aacdec: fix parsing streams with channel configuration 11
|
||||
- libswscale: force a minimum size of the slide for bayer sources
|
||||
- lavf/async: Fix ring_write return value
|
||||
- avcodec/audiotoolboxenc: return AVERROR_EXTERNAL immediately when encode error
|
||||
- avcodec/libjxlenc: avoid hard failure with unspecified primaries
|
||||
|
||||
version 5.1.2:
|
||||
- avcodec/dstdec: Check for overflow in build_filter()
|
||||
- avformat/spdifdec: Use 64bit to compute bit rate
|
||||
- avformat/rpl: Use 64bit for duration computation
|
||||
- avformat/xwma: Use av_rescale() for duration computation
|
||||
- avformat/sdsdec: Use av_rescale() to avoid intermediate overflow in duration calculation
|
||||
- avformat/sbgdec: Check ts_int in genrate_intervals
|
||||
- avformat/sbgdec: clamp end_ts
|
||||
- avformat/rmdec: check tag_size
|
||||
- avformat/nutdec: Check fields
|
||||
- avformat/flvdec: Use 64bit for sum_flv_tag_size
|
||||
- avformat/jacosubdec: Fix overflow in get_shift()
|
||||
- avformat/genh: Check nb_channels for IMA ADPCM
|
||||
- avformat/dxa: avoid bpc overflows
|
||||
- avformat/dhav: Use 64bit seek_back
|
||||
- avformat/cafdec: Check that nb_frasmes fits within 64bit
|
||||
- avformat/asfdec_o: Limit packet offset
|
||||
- avformat/apm: Use 64bit for bit_rate computation
|
||||
- avformat/ape: Check frames size
|
||||
- avformat/icodec: Check nb_pal
|
||||
- avformat/aiffdec: Use 64bit for block_duration use
|
||||
- avformat/aiffdec: Check block_duration
|
||||
- avformat/mxfdec: only probe max run in
|
||||
- avformat/mxfdec: Check run_in is within 65536
|
||||
- avcodec/mjpegdec: Check for unsupported bayer case
|
||||
- avcodec/apedec: Fix integer overflow in filter_3800()
|
||||
- avcodec/tta: Check 24bit scaling for overflow
|
||||
- avcodec/mobiclip: Check quantizer for overflow
|
||||
- avcodec/exr: Check preview psize
|
||||
- avcodec/tiff: Fix loop detection
|
||||
- libavformat/hls: Free keys
|
||||
- avcodec/fmvc: Move frame allocation to a later stage
|
||||
- avfilter/vf_showinfo: remove backspaces
|
||||
- avcodec/speedhq: Check width
|
||||
- avcodec/bink: disallow odd positioned scaled blocks
|
||||
- avformat/cafenc: derive Opus frame size from the relevant stream parameters
|
||||
- avformat/dashdec: Fix crash on invalid input/ENOMEM, fix leak
|
||||
- lavc/videotoolbox: do not pass AVCodecContext to decoder output callback
|
||||
- lavc/pthread_frame: always transfer stashed hwaccel state
|
||||
- avcodec/arm/sbcenc: avoid callee preserved vfp registers
|
||||
- avformat/riffdec: don't unconditionally overwrite WAVEFORMATEXTENSIBLE layout
|
||||
- avfilter/vf_scale: overwrite the width and height expressions with the original values
|
||||
- lavc/pthread_frame: avoid leaving stale hwaccel state in worker threads
|
||||
- avutil/tests/.gitignore: Add channel_layout testtool
|
||||
|
||||
|
||||
version 5.1.1:
|
||||
- avformat/asfdec_o: limit recursion depth in asf_read_unknown()
|
||||
- avformat/mov: Check count sums in build_open_gop_key_points()
|
||||
- doc/git-howto.texi: Document commit signing
|
||||
- libavcodec/8bps: Check that line lengths fit within the buffer
|
||||
- avcodec/midivid: Perform lzss_uncompress() before ff_reget_buffer()
|
||||
- libavformat/iff: Check for overflow in body_end calculation
|
||||
- avformat/avidec: Prevent entity expansion attacks
|
||||
- avcodec/h263dec: Sanity check against minimal I/P frame size
|
||||
- avcodec/hevcdec: Check s->ref in the md5 path similar to hwaccel
|
||||
- avcodec/mpegaudiodec_template: use unsigned shift in handle_crc()
|
||||
- avformat/subviewerdec: Make read_ts() more flexible
|
||||
- avcodec/mjpegdec: bayer and rct are incompatible
|
||||
- MAINTAINERS: Add ED25519 key for signing my commits in the future
|
||||
- avcodec/pngdec: Fix APNG_DISPOSE_OP_BACKGROUND
|
||||
- avcodec/libvpx: fix assembling vp9 packets with alpha channel
|
||||
- fftools/ffmpeg_opt: try to propagate the requested output channel layout
|
||||
- avcodec/libsvtav1: properly initialize the flush EbBufferHeaderType struct
|
||||
- configure: enable the av1_frame_split bsf for the av1 decoder
|
||||
- swresample/swresample: fill the correct buffer to print the output layout string
|
||||
- ffprobe: restore reporting error code for failed inputs
|
||||
- ipfsgateway: Remove default gateway
|
||||
- avcodec/libspeexdec: Fix use of uninitialized value
|
||||
- avformat/avisynth: use ch_layout.nb_channels for channel count
|
||||
- fate/lavf-image: Disable file checksums for exr tests
|
||||
- tests/fate-run: Allow to skip file checksums for lavf_image
|
||||
- fate/imf: Rename IMF fate-target
|
||||
- avcodec/alac: don't fail if channels aren't set during init() when extradata is valid
|
||||
- configure: properly require libx264 if enabled
|
||||
|
||||
|
||||
version 5.1:
|
||||
- add ipfs/ipns protocol support
|
||||
- dialogue enhance audio filter
|
||||
|
||||
@@ -625,7 +625,6 @@ Leo Izen (thebombzen) B6FD 3CFC 7ACF 83FC 9137 6945 5A71 C331 FD2F A19A
|
||||
Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE
|
||||
Lynne FE50 139C 6805 72CA FD52 1F8D A2FE A5F0 3F03 4464
|
||||
Michael Niedermayer 9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB
|
||||
DD1E C9E8 DE08 5C62 9B3E 1846 B18E 8928 B394 8D64
|
||||
Nicolas George 24CE 01CE 9ACC 5CEB 74D8 8D9D B063 D997 36E5 4C93
|
||||
Niklas Haas (haasn) 1DDB 8076 B14D 5B48 32FC 99D9 EB52 DA9C 02BA 6FB4
|
||||
Nikolay Aleksandrov 8978 1D8C FB71 588E 4B27 EAA8 C4F0 B5FC E011 13B1
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
|
||||
┌────────────────────────────────────────────┐
|
||||
│ RELEASE NOTES for FFmpeg 5.1 "Riemann" LTS │
|
||||
└────────────────────────────────────────────┘
|
||||
|
||||
The FFmpeg Project proudly presents FFmpeg 5.1 "Riemann" LTS, about 6
|
||||
months after the release of FFmpeg 5.0, our first Long Term Support
|
||||
release. While several past FFmpeg releases have enjoyed long term
|
||||
support, this is the first release where such an intention is made
|
||||
clear at release.
|
||||
|
||||
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.
|
||||
4
configure
vendored
4
configure
vendored
@@ -2781,7 +2781,7 @@ atrac3al_decoder_select="mdct"
|
||||
atrac3p_decoder_select="mdct sinewin"
|
||||
atrac3pal_decoder_select="mdct sinewin"
|
||||
atrac9_decoder_select="mdct"
|
||||
av1_decoder_select="av1_frame_split_bsf cbs_av1"
|
||||
av1_decoder_select="cbs_av1"
|
||||
bink_decoder_select="blockdsp hpeldsp"
|
||||
binkaudio_dct_decoder_select="mdct rdft dct sinewin wma_freqs"
|
||||
binkaudio_rdft_decoder_select="mdct rdft sinewin wma_freqs"
|
||||
@@ -6666,7 +6666,7 @@ enabled libvpx && {
|
||||
enabled libwebp && {
|
||||
enabled libwebp_encoder && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
|
||||
enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
|
||||
enabled libx264 && require_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode &&
|
||||
enabled libx264 && check_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode &&
|
||||
require_cpp_condition libx264 x264.h "X264_BUILD >= 118" && {
|
||||
[ "$toolchain" != "msvc" ] ||
|
||||
require_cpp_condition libx264 x264.h "X264_BUILD >= 158"; } &&
|
||||
|
||||
@@ -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 = 5.1.3
|
||||
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
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
The FFmpeg developers.
|
||||
|
||||
For details about the authorship, see the Git history of the project
|
||||
(https://git.ffmpeg.org/ffmpeg), e.g. by typing the command
|
||||
(git://source.ffmpeg.org/ffmpeg), e.g. by typing the command
|
||||
@command{git log} in the FFmpeg source directory, or browsing the
|
||||
online repository at @url{https://git.ffmpeg.org/ffmpeg}.
|
||||
online repository at @url{http://source.ffmpeg.org}.
|
||||
|
||||
Maintainers for the specific components are listed in the file
|
||||
@file{MAINTAINERS} in the source code tree.
|
||||
|
||||
@@ -518,21 +518,6 @@ see @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1)
|
||||
Like the @code{-ss} option but relative to the "end of file". That is negative
|
||||
values are earlier in the file, 0 is at EOF.
|
||||
|
||||
@item -isync @var{input_index} (@emph{input})
|
||||
Assign an input as a sync source.
|
||||
|
||||
This will take the difference between the start times of the target and reference inputs and
|
||||
offset the timestamps of the target file by that difference. The source timestamps of the two
|
||||
inputs should derive from the same clock source for expected results. If @code{copyts} is set
|
||||
then @code{start_at_zero} must also be set. If either of the inputs has no starting timestamp
|
||||
then no sync adjustment is made.
|
||||
|
||||
Acceptable values are those that refer to a valid ffmpeg input index. If the sync reference is
|
||||
the target index itself or @var{-1}, then no adjustment is made to target timestamps. A sync
|
||||
reference may not itself be synced to any other input.
|
||||
|
||||
Default value is @var{-1}.
|
||||
|
||||
@item -itsoffset @var{offset} (@emph{input})
|
||||
Set the input time offset.
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ Most distribution and operating system provide a package for it.
|
||||
@section Cloning the source tree
|
||||
|
||||
@example
|
||||
git clone https://git.ffmpeg.org/ffmpeg.git <target>
|
||||
git clone git://source.ffmpeg.org/ffmpeg <target>
|
||||
@end example
|
||||
|
||||
This will put the FFmpeg sources into the directory @var{<target>}.
|
||||
@@ -187,18 +187,11 @@ to make sure you don't have untracked files or deletions.
|
||||
git add [-i|-p|-A] <filenames/dirnames>
|
||||
@end example
|
||||
|
||||
Make sure you have told Git your name, email address and GPG key
|
||||
Make sure you have told Git your name and email address
|
||||
|
||||
@example
|
||||
git config --global user.name "My Name"
|
||||
git config --global user.email my@@email.invalid
|
||||
git config --global user.signingkey ABCDEF0123245
|
||||
@end example
|
||||
|
||||
Enable signing all commits or use -S
|
||||
|
||||
@example
|
||||
git config --global commit.gpgsign true
|
||||
@end example
|
||||
|
||||
Use @option{--global} to set the global configuration for all your Git checkouts.
|
||||
@@ -430,19 +423,6 @@ git checkout -b svn_23456 $SHA1
|
||||
where @var{$SHA1} is the commit hash from the @command{git log} output.
|
||||
|
||||
|
||||
@chapter gpg key generation
|
||||
|
||||
If you have no gpg key yet, we recommend that you create a ed25519 based key as it
|
||||
is small, fast and secure. Especially it results in small signatures in git.
|
||||
|
||||
@example
|
||||
gpg --default-new-key-algo "ed25519/cert,sign+cv25519/encr" --quick-generate-key "human@@server.com"
|
||||
@end example
|
||||
|
||||
When generating a key, make sure the email specified matches the email used in git as some sites like
|
||||
github consider mismatches a reason to declare such commits unverified. After generating a key you
|
||||
can add it to the MAINTAINER file and upload it to a keyserver.
|
||||
|
||||
@chapter Pre-push checklist
|
||||
|
||||
Once you have a set of commits that you feel are ready for pushing,
|
||||
|
||||
@@ -118,7 +118,6 @@ typedef struct OptionsContext {
|
||||
float readrate;
|
||||
int accurate_seek;
|
||||
int thread_queue_size;
|
||||
int input_sync_ref;
|
||||
|
||||
SpecifierOpt *ts_scale;
|
||||
int nb_ts_scale;
|
||||
@@ -411,7 +410,6 @@ typedef struct InputFile {
|
||||
at the moment when looping happens */
|
||||
AVRational time_base; /* time base of the duration */
|
||||
int64_t input_ts_offset;
|
||||
int input_sync_ref;
|
||||
|
||||
int64_t ts_offset;
|
||||
int64_t last_ts;
|
||||
|
||||
@@ -235,7 +235,6 @@ static void init_options(OptionsContext *o)
|
||||
o->chapters_input_file = INT_MAX;
|
||||
o->accurate_seek = 1;
|
||||
o->thread_queue_size = -1;
|
||||
o->input_sync_ref = -1;
|
||||
}
|
||||
|
||||
static int show_hwaccels(void *optctx, const char *opt, const char *arg)
|
||||
@@ -288,58 +287,6 @@ static int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, in
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int apply_sync_offsets(void)
|
||||
{
|
||||
for (int i = 0; i < nb_input_files; i++) {
|
||||
InputFile *ref, *self = input_files[i];
|
||||
int64_t adjustment;
|
||||
int64_t self_start_time, ref_start_time, self_seek_start, ref_seek_start;
|
||||
int start_times_set = 1;
|
||||
|
||||
if (self->input_sync_ref == -1 || self->input_sync_ref == i) continue;
|
||||
if (self->input_sync_ref >= nb_input_files || self->input_sync_ref < -1) {
|
||||
av_log(NULL, AV_LOG_FATAL, "-isync for input %d references non-existent input %d.\n", i, self->input_sync_ref);
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
if (copy_ts && !start_at_zero) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Use of -isync requires that start_at_zero be set if copyts is set.\n");
|
||||
exit_program(1);
|
||||
}
|
||||
|
||||
ref = input_files[self->input_sync_ref];
|
||||
if (ref->input_sync_ref != -1 && ref->input_sync_ref != self->input_sync_ref) {
|
||||
av_log(NULL, AV_LOG_ERROR, "-isync for input %d references a resynced input %d. Sync not set.\n", i, self->input_sync_ref);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (self->ctx->start_time_realtime != AV_NOPTS_VALUE && ref->ctx->start_time_realtime != AV_NOPTS_VALUE) {
|
||||
self_start_time = self->ctx->start_time_realtime;
|
||||
ref_start_time = ref->ctx->start_time_realtime;
|
||||
} else if (self->ctx->start_time != AV_NOPTS_VALUE && ref->ctx->start_time != AV_NOPTS_VALUE) {
|
||||
self_start_time = self->ctx->start_time;
|
||||
ref_start_time = ref->ctx->start_time;
|
||||
} else {
|
||||
start_times_set = 0;
|
||||
}
|
||||
|
||||
if (start_times_set) {
|
||||
self_seek_start = self->start_time == AV_NOPTS_VALUE ? 0 : self->start_time;
|
||||
ref_seek_start = ref->start_time == AV_NOPTS_VALUE ? 0 : ref->start_time;
|
||||
|
||||
adjustment = (self_start_time - ref_start_time) + !copy_ts*(self_seek_start - ref_seek_start) + ref->input_ts_offset;
|
||||
|
||||
self->ts_offset += adjustment;
|
||||
|
||||
av_log(NULL, AV_LOG_INFO, "Adjusted ts offset for Input #%d by %"PRId64" us to sync with Input #%d.\n", i, adjustment, self->input_sync_ref);
|
||||
} else {
|
||||
av_log(NULL, AV_LOG_INFO, "Unable to identify start times for Inputs #%d and %d both. No sync adjustment made.\n", i, self->input_sync_ref);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_filter_threads(void *optctx, const char *opt, const char *arg)
|
||||
{
|
||||
av_free(filter_nbthreads);
|
||||
@@ -1358,7 +1305,6 @@ static int open_input_file(OptionsContext *o, const char *filename)
|
||||
f->ist_index = nb_input_streams - ic->nb_streams;
|
||||
f->start_time = o->start_time;
|
||||
f->recording_time = o->recording_time;
|
||||
f->input_sync_ref = o->input_sync_ref;
|
||||
f->input_ts_offset = o->input_ts_offset;
|
||||
f->ts_offset = o->input_ts_offset - (copy_ts ? (start_at_zero && ic->start_time != AV_NOPTS_VALUE ? ic->start_time : 0) : timestamp);
|
||||
f->nb_streams = ic->nb_streams;
|
||||
@@ -2372,43 +2318,6 @@ static int init_complex_filters(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void set_channel_layout(OutputFilter *f, OutputStream *ost)
|
||||
{
|
||||
int i, err;
|
||||
|
||||
if (ost->enc_ctx->ch_layout.order != AV_CHANNEL_ORDER_UNSPEC) {
|
||||
/* Pass the layout through for all orders but UNSPEC */
|
||||
err = av_channel_layout_copy(&f->ch_layout, &ost->enc_ctx->ch_layout);
|
||||
if (err < 0)
|
||||
exit_program(1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Requested layout is of order UNSPEC */
|
||||
if (!ost->enc->ch_layouts) {
|
||||
/* Use the default native layout for the requested amount of channels when the
|
||||
encoder doesn't have a list of supported layouts */
|
||||
av_channel_layout_default(&f->ch_layout, ost->enc_ctx->ch_layout.nb_channels);
|
||||
return;
|
||||
}
|
||||
/* Encoder has a list of supported layouts. Pick the first layout in it with the
|
||||
same amount of channels as the requested layout */
|
||||
for (i = 0; ost->enc->ch_layouts[i].nb_channels; i++) {
|
||||
if (ost->enc->ch_layouts[i].nb_channels == ost->enc_ctx->ch_layout.nb_channels)
|
||||
break;
|
||||
}
|
||||
if (ost->enc->ch_layouts[i].nb_channels) {
|
||||
/* Use it if one is found */
|
||||
err = av_channel_layout_copy(&f->ch_layout, &ost->enc->ch_layouts[i]);
|
||||
if (err < 0)
|
||||
exit_program(1);
|
||||
return;
|
||||
}
|
||||
/* If no layout for the amount of channels requested was found, use the default
|
||||
native layout for it. */
|
||||
av_channel_layout_default(&f->ch_layout, ost->enc_ctx->ch_layout.nb_channels);
|
||||
}
|
||||
|
||||
static int open_output_file(OptionsContext *o, const char *filename)
|
||||
{
|
||||
AVFormatContext *oc;
|
||||
@@ -2811,7 +2720,7 @@ loop_end:
|
||||
f->sample_rates = ost->enc->supported_samplerates;
|
||||
}
|
||||
if (ost->enc_ctx->ch_layout.nb_channels) {
|
||||
set_channel_layout(f, ost);
|
||||
av_channel_layout_default(&f->ch_layout, ost->enc_ctx->ch_layout.nb_channels);
|
||||
} else if (ost->enc->ch_layouts) {
|
||||
f->ch_layouts = ost->enc->ch_layouts;
|
||||
}
|
||||
@@ -3580,8 +3489,6 @@ int ffmpeg_parse_options(int argc, char **argv)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
apply_sync_offsets();
|
||||
|
||||
/* create the complex filtergraphs */
|
||||
ret = init_complex_filters();
|
||||
if (ret < 0) {
|
||||
@@ -3696,9 +3603,6 @@ const OptionDef options[] = {
|
||||
{ "accurate_seek", OPT_BOOL | OPT_OFFSET | OPT_EXPERT |
|
||||
OPT_INPUT, { .off = OFFSET(accurate_seek) },
|
||||
"enable/disable accurate seeking with -ss" },
|
||||
{ "isync", HAS_ARG | OPT_INT | OPT_OFFSET |
|
||||
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(input_sync_ref) },
|
||||
"Indicate the input index for sync reference", "sync ref" },
|
||||
{ "itsoffset", HAS_ARG | OPT_TIME | OPT_OFFSET |
|
||||
OPT_EXPERT | OPT_INPUT, { .off = OFFSET(input_ts_offset) },
|
||||
"set the input ts offset", "time_off" },
|
||||
|
||||
@@ -4026,7 +4026,7 @@ int main(int argc, char **argv)
|
||||
WriterContext *wctx;
|
||||
char *buf;
|
||||
char *w_name = NULL, *w_args = NULL;
|
||||
int ret, input_ret, i;
|
||||
int ret, i;
|
||||
|
||||
init_dynload();
|
||||
|
||||
@@ -4150,14 +4150,10 @@ int main(int argc, char **argv)
|
||||
show_error(wctx, ret);
|
||||
}
|
||||
|
||||
input_ret = ret;
|
||||
|
||||
writer_print_section_footer(wctx);
|
||||
ret = writer_close(&wctx);
|
||||
if (ret < 0)
|
||||
av_log(NULL, AV_LOG_ERROR, "Writing output failed: %s\n", av_err2str(ret));
|
||||
|
||||
ret = FFMIN(ret, input_ret);
|
||||
}
|
||||
|
||||
end:
|
||||
|
||||
@@ -131,8 +131,8 @@ static int zero12v_decode_frame(AVCodecContext *avctx, AVFrame *pic,
|
||||
u = x/2 + (uint16_t *)(pic->data[1] + line * pic->linesize[1]);
|
||||
v = x/2 + (uint16_t *)(pic->data[2] + line * pic->linesize[2]);
|
||||
memcpy(y, y_temp, sizeof(*y) * (width - x));
|
||||
memcpy(u, u_temp, sizeof(*u) * ((width - x + 1) / 2));
|
||||
memcpy(v, v_temp, sizeof(*v) * ((width - x + 1) / 2));
|
||||
memcpy(u, u_temp, sizeof(*u) * (width - x + 1) / 2);
|
||||
memcpy(v, v_temp, sizeof(*v) * (width - x + 1) / 2);
|
||||
}
|
||||
|
||||
line_end += stride;
|
||||
|
||||
@@ -71,9 +71,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
unsigned char *planemap = c->planemap;
|
||||
int ret;
|
||||
|
||||
if (buf_size < planes * height *2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -730,7 +730,9 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
|
||||
return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][2];
|
||||
}
|
||||
case 11:
|
||||
if (ac->tags_mapped == 3 && type == TYPE_SCE) {
|
||||
if (ac->tags_mapped == 2 &&
|
||||
ac->oc[1].m4ac.chan_config == 11 &&
|
||||
type == TYPE_SCE) {
|
||||
ac->tags_mapped++;
|
||||
return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][1];
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 5, 5, 16, 5, 0 };
|
||||
static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 4, 5, 16, 5, 0 };
|
||||
|
||||
static const uint8_t aac_channel_layout_map[16][16][3] = {
|
||||
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, },
|
||||
@@ -84,7 +84,7 @@ static const uint64_t aac_channel_layout[16] = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
AV_CH_LAYOUT_6POINT1_BACK,
|
||||
AV_CH_LAYOUT_6POINT1,
|
||||
AV_CH_LAYOUT_7POINT1,
|
||||
AV_CH_LAYOUT_22POINT2,
|
||||
0,
|
||||
@@ -103,7 +103,7 @@ static const AVChannelLayout aac_ch_layout[16] = {
|
||||
{ 0 },
|
||||
{ 0 },
|
||||
{ 0 },
|
||||
AV_CHANNEL_LAYOUT_6POINT1_BACK,
|
||||
AV_CHANNEL_LAYOUT_6POINT1,
|
||||
AV_CHANNEL_LAYOUT_7POINT1,
|
||||
AV_CHANNEL_LAYOUT_22POINT2,
|
||||
{ 0 },
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
#define AC3_DYNAMIC_RANGE1 0
|
||||
|
||||
typedef int INTFLOAT;
|
||||
typedef unsigned int UINTFLOAT;
|
||||
typedef int16_t SHORTFLOAT;
|
||||
|
||||
#else /* USE_FIXED */
|
||||
@@ -76,7 +75,6 @@ typedef int16_t SHORTFLOAT;
|
||||
#define AC3_DYNAMIC_RANGE1 1.0f
|
||||
|
||||
typedef float INTFLOAT;
|
||||
typedef float UINTFLOAT;
|
||||
typedef float SHORTFLOAT;
|
||||
|
||||
#endif /* USE_FIXED */
|
||||
|
||||
@@ -574,15 +574,13 @@ static av_cold int alac_decode_init(AVCodecContext * avctx)
|
||||
avctx->bits_per_raw_sample = alac->sample_size;
|
||||
avctx->sample_rate = alac->sample_rate;
|
||||
|
||||
if (alac->channels < 1) {
|
||||
if (alac->channels < 1 || alac->channels > ALAC_MAX_CHANNELS) {
|
||||
av_log(avctx, AV_LOG_WARNING, "Invalid channel count\n");
|
||||
if (avctx->ch_layout.nb_channels < 1)
|
||||
return AVERROR(EINVAL);
|
||||
alac->channels = avctx->ch_layout.nb_channels;
|
||||
}
|
||||
if (alac->channels > ALAC_MAX_CHANNELS) {
|
||||
if (avctx->ch_layout.nb_channels > ALAC_MAX_CHANNELS || avctx->ch_layout.nb_channels <= 0 ) {
|
||||
avpriv_report_missing_feature(avctx, "Channel count %d",
|
||||
alac->channels);
|
||||
avctx->ch_layout.nb_channels);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
av_channel_layout_uninit(&avctx->ch_layout);
|
||||
|
||||
@@ -1027,7 +1027,7 @@ static int read_block(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
|
||||
*bd->shift_lsbs = 0;
|
||||
|
||||
if (get_bits_left(gb) < 7)
|
||||
if (get_bits_left(gb) < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
// read block type flag and read the samples accordingly
|
||||
@@ -1659,8 +1659,7 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
|
||||
|
||||
if (!sconf->mc_coding || ctx->js_switch) {
|
||||
int independent_bs = !sconf->joint_stereo;
|
||||
if (get_bits_left(gb) < 7*channels*ctx->num_blocks)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
for (c = 0; c < channels; c++) {
|
||||
js_blocks[0] = 0;
|
||||
js_blocks[1] = 0;
|
||||
|
||||
@@ -934,7 +934,7 @@ static av_always_inline int filter_3800(APEPredictor *p,
|
||||
p->coeffsB[filter][0] += (((d3 >> 29) & 4) - 2) * sign;
|
||||
p->coeffsB[filter][1] -= (((d4 >> 30) & 2) - 1) * sign;
|
||||
|
||||
p->filterB[filter] = p->lastA[filter] + (unsigned)(predictionB >> shift);
|
||||
p->filterB[filter] = p->lastA[filter] + (predictionB >> shift);
|
||||
p->filterA[filter] = p->filterB[filter] + (unsigned)((int)(p->filterA[filter] * 31U) >> 5);
|
||||
|
||||
return p->filterA[filter];
|
||||
|
||||
@@ -38,49 +38,49 @@ function ff_sbc_analyze_4_neon, export=1
|
||||
/* TODO: merge even and odd cases (or even merge all four calls to this
|
||||
* function) in order to have only aligned reads from 'in' array
|
||||
* and reduce number of load instructions */
|
||||
vld1.16 {d16, d17}, [r0, :64]!
|
||||
vld1.16 {d20, d21}, [r2, :128]!
|
||||
vld1.16 {d4, d5}, [r0, :64]!
|
||||
vld1.16 {d8, d9}, [r2, :128]!
|
||||
|
||||
vmull.s16 q0, d16, d20
|
||||
vld1.16 {d18, d19}, [r0, :64]!
|
||||
vmull.s16 q1, d17, d21
|
||||
vld1.16 {d22, d23}, [r2, :128]!
|
||||
vmull.s16 q0, d4, d8
|
||||
vld1.16 {d6, d7}, [r0, :64]!
|
||||
vmull.s16 q1, d5, d9
|
||||
vld1.16 {d10, d11}, [r2, :128]!
|
||||
|
||||
vmlal.s16 q0, d18, d22
|
||||
vld1.16 {d16, d17}, [r0, :64]!
|
||||
vmlal.s16 q1, d19, d23
|
||||
vld1.16 {d20, d21}, [r2, :128]!
|
||||
vmlal.s16 q0, d6, d10
|
||||
vld1.16 {d4, d5}, [r0, :64]!
|
||||
vmlal.s16 q1, d7, d11
|
||||
vld1.16 {d8, d9}, [r2, :128]!
|
||||
|
||||
vmlal.s16 q0, d16, d20
|
||||
vld1.16 {d18, d19}, [r0, :64]!
|
||||
vmlal.s16 q1, d17, d21
|
||||
vld1.16 {d22, d23}, [r2, :128]!
|
||||
vmlal.s16 q0, d4, d8
|
||||
vld1.16 {d6, d7}, [r0, :64]!
|
||||
vmlal.s16 q1, d5, d9
|
||||
vld1.16 {d10, d11}, [r2, :128]!
|
||||
|
||||
vmlal.s16 q0, d18, d22
|
||||
vld1.16 {d16, d17}, [r0, :64]!
|
||||
vmlal.s16 q1, d19, d23
|
||||
vld1.16 {d20, d21}, [r2, :128]!
|
||||
vmlal.s16 q0, d6, d10
|
||||
vld1.16 {d4, d5}, [r0, :64]!
|
||||
vmlal.s16 q1, d7, d11
|
||||
vld1.16 {d8, d9}, [r2, :128]!
|
||||
|
||||
vmlal.s16 q0, d16, d20
|
||||
vmlal.s16 q1, d17, d21
|
||||
vmlal.s16 q0, d4, d8
|
||||
vmlal.s16 q1, d5, d9
|
||||
|
||||
vpadd.s32 d0, d0, d1
|
||||
vpadd.s32 d1, d2, d3
|
||||
|
||||
vrshrn.s32 d0, q0, SBC_PROTO_FIXED_SCALE
|
||||
|
||||
vld1.16 {d16, d17, d18, d19}, [r2, :128]!
|
||||
vld1.16 {d2, d3, d4, d5}, [r2, :128]!
|
||||
|
||||
vdup.i32 d1, d0[1] /* TODO: can be eliminated */
|
||||
vdup.i32 d0, d0[0] /* TODO: can be eliminated */
|
||||
|
||||
vmull.s16 q10, d16, d0
|
||||
vmull.s16 q11, d17, d0
|
||||
vmlal.s16 q10, d18, d1
|
||||
vmlal.s16 q11, d19, d1
|
||||
vmull.s16 q3, d2, d0
|
||||
vmull.s16 q4, d3, d0
|
||||
vmlal.s16 q3, d4, d1
|
||||
vmlal.s16 q4, d5, d1
|
||||
|
||||
vpadd.s32 d0, d20, d21 /* TODO: can be eliminated */
|
||||
vpadd.s32 d1, d22, d23 /* TODO: can be eliminated */
|
||||
vpadd.s32 d0, d6, d7 /* TODO: can be eliminated */
|
||||
vpadd.s32 d1, d8, d9 /* TODO: can be eliminated */
|
||||
|
||||
vst1.32 {d0, d1}, [r1, :128]
|
||||
|
||||
@@ -91,57 +91,57 @@ function ff_sbc_analyze_8_neon, export=1
|
||||
/* TODO: merge even and odd cases (or even merge all four calls to this
|
||||
* function) in order to have only aligned reads from 'in' array
|
||||
* and reduce number of load instructions */
|
||||
vld1.16 {d16, d17}, [r0, :64]!
|
||||
vld1.16 {d20, d21}, [r2, :128]!
|
||||
vld1.16 {d4, d5}, [r0, :64]!
|
||||
vld1.16 {d8, d9}, [r2, :128]!
|
||||
|
||||
vmull.s16 q12, d16, d20
|
||||
vld1.16 {d18, d19}, [r0, :64]!
|
||||
vmull.s16 q13, d17, d21
|
||||
vld1.16 {d22, d23}, [r2, :128]!
|
||||
vmull.s16 q14, d18, d22
|
||||
vld1.16 {d16, d17}, [r0, :64]!
|
||||
vmull.s16 q15, d19, d23
|
||||
vld1.16 {d20, d21}, [r2, :128]!
|
||||
vmull.s16 q6, d4, d8
|
||||
vld1.16 {d6, d7}, [r0, :64]!
|
||||
vmull.s16 q7, d5, d9
|
||||
vld1.16 {d10, d11}, [r2, :128]!
|
||||
vmull.s16 q8, d6, d10
|
||||
vld1.16 {d4, d5}, [r0, :64]!
|
||||
vmull.s16 q9, d7, d11
|
||||
vld1.16 {d8, d9}, [r2, :128]!
|
||||
|
||||
vmlal.s16 q12, d16, d20
|
||||
vld1.16 {d18, d19}, [r0, :64]!
|
||||
vmlal.s16 q13, d17, d21
|
||||
vld1.16 {d22, d23}, [r2, :128]!
|
||||
vmlal.s16 q14, d18, d22
|
||||
vld1.16 {d16, d17}, [r0, :64]!
|
||||
vmlal.s16 q15, d19, d23
|
||||
vld1.16 {d20, d21}, [r2, :128]!
|
||||
vmlal.s16 q6, d4, d8
|
||||
vld1.16 {d6, d7}, [r0, :64]!
|
||||
vmlal.s16 q7, d5, d9
|
||||
vld1.16 {d10, d11}, [r2, :128]!
|
||||
vmlal.s16 q8, d6, d10
|
||||
vld1.16 {d4, d5}, [r0, :64]!
|
||||
vmlal.s16 q9, d7, d11
|
||||
vld1.16 {d8, d9}, [r2, :128]!
|
||||
|
||||
vmlal.s16 q12, d16, d20
|
||||
vld1.16 {d18, d19}, [r0, :64]!
|
||||
vmlal.s16 q13, d17, d21
|
||||
vld1.16 {d22, d23}, [r2, :128]!
|
||||
vmlal.s16 q14, d18, d22
|
||||
vld1.16 {d16, d17}, [r0, :64]!
|
||||
vmlal.s16 q15, d19, d23
|
||||
vld1.16 {d20, d21}, [r2, :128]!
|
||||
vmlal.s16 q6, d4, d8
|
||||
vld1.16 {d6, d7}, [r0, :64]!
|
||||
vmlal.s16 q7, d5, d9
|
||||
vld1.16 {d10, d11}, [r2, :128]!
|
||||
vmlal.s16 q8, d6, d10
|
||||
vld1.16 {d4, d5}, [r0, :64]!
|
||||
vmlal.s16 q9, d7, d11
|
||||
vld1.16 {d8, d9}, [r2, :128]!
|
||||
|
||||
vmlal.s16 q12, d16, d20
|
||||
vld1.16 {d18, d19}, [r0, :64]!
|
||||
vmlal.s16 q13, d17, d21
|
||||
vld1.16 {d22, d23}, [r2, :128]!
|
||||
vmlal.s16 q14, d18, d22
|
||||
vld1.16 {d16, d17}, [r0, :64]!
|
||||
vmlal.s16 q15, d19, d23
|
||||
vld1.16 {d20, d21}, [r2, :128]!
|
||||
vmlal.s16 q6, d4, d8
|
||||
vld1.16 {d6, d7}, [r0, :64]!
|
||||
vmlal.s16 q7, d5, d9
|
||||
vld1.16 {d10, d11}, [r2, :128]!
|
||||
vmlal.s16 q8, d6, d10
|
||||
vld1.16 {d4, d5}, [r0, :64]!
|
||||
vmlal.s16 q9, d7, d11
|
||||
vld1.16 {d8, d9}, [r2, :128]!
|
||||
|
||||
vmlal.s16 q12, d16, d20
|
||||
vld1.16 {d18, d19}, [r0, :64]!
|
||||
vmlal.s16 q13, d17, d21
|
||||
vld1.16 {d22, d23}, [r2, :128]!
|
||||
vmlal.s16 q6, d4, d8
|
||||
vld1.16 {d6, d7}, [r0, :64]!
|
||||
vmlal.s16 q7, d5, d9
|
||||
vld1.16 {d10, d11}, [r2, :128]!
|
||||
|
||||
vmlal.s16 q14, d18, d22
|
||||
vmlal.s16 q15, d19, d23
|
||||
vmlal.s16 q8, d6, d10
|
||||
vmlal.s16 q9, d7, d11
|
||||
|
||||
vpadd.s32 d0, d24, d25
|
||||
vpadd.s32 d1, d26, d27
|
||||
vpadd.s32 d2, d28, d29
|
||||
vpadd.s32 d3, d30, d31
|
||||
vpadd.s32 d0, d12, d13
|
||||
vpadd.s32 d1, d14, d15
|
||||
vpadd.s32 d2, d16, d17
|
||||
vpadd.s32 d3, d18, d19
|
||||
|
||||
vrshr.s32 q0, q0, SBC_PROTO_FIXED_SCALE
|
||||
vrshr.s32 q1, q1, SBC_PROTO_FIXED_SCALE
|
||||
@@ -153,38 +153,38 @@ function ff_sbc_analyze_8_neon, export=1
|
||||
vdup.i32 d1, d0[1] /* TODO: can be eliminated */
|
||||
vdup.i32 d0, d0[0] /* TODO: can be eliminated */
|
||||
|
||||
vld1.16 {d16, d17}, [r2, :128]!
|
||||
vmull.s16 q12, d16, d0
|
||||
vld1.16 {d18, d19}, [r2, :128]!
|
||||
vmull.s16 q13, d17, d0
|
||||
vmull.s16 q14, d18, d0
|
||||
vmull.s16 q15, d19, d0
|
||||
vld1.16 {d4, d5}, [r2, :128]!
|
||||
vmull.s16 q6, d4, d0
|
||||
vld1.16 {d6, d7}, [r2, :128]!
|
||||
vmull.s16 q7, d5, d0
|
||||
vmull.s16 q8, d6, d0
|
||||
vmull.s16 q9, d7, d0
|
||||
|
||||
vld1.16 {d16, d17}, [r2, :128]!
|
||||
vmlal.s16 q12, d16, d1
|
||||
vld1.16 {d18, d19}, [r2, :128]!
|
||||
vmlal.s16 q13, d17, d1
|
||||
vmlal.s16 q14, d18, d1
|
||||
vmlal.s16 q15, d19, d1
|
||||
vld1.16 {d4, d5}, [r2, :128]!
|
||||
vmlal.s16 q6, d4, d1
|
||||
vld1.16 {d6, d7}, [r2, :128]!
|
||||
vmlal.s16 q7, d5, d1
|
||||
vmlal.s16 q8, d6, d1
|
||||
vmlal.s16 q9, d7, d1
|
||||
|
||||
vld1.16 {d16, d17}, [r2, :128]!
|
||||
vmlal.s16 q12, d16, d2
|
||||
vld1.16 {d18, d19}, [r2, :128]!
|
||||
vmlal.s16 q13, d17, d2
|
||||
vmlal.s16 q14, d18, d2
|
||||
vmlal.s16 q15, d19, d2
|
||||
vld1.16 {d4, d5}, [r2, :128]!
|
||||
vmlal.s16 q6, d4, d2
|
||||
vld1.16 {d6, d7}, [r2, :128]!
|
||||
vmlal.s16 q7, d5, d2
|
||||
vmlal.s16 q8, d6, d2
|
||||
vmlal.s16 q9, d7, d2
|
||||
|
||||
vld1.16 {d16, d17}, [r2, :128]!
|
||||
vmlal.s16 q12, d16, d3
|
||||
vld1.16 {d18, d19}, [r2, :128]!
|
||||
vmlal.s16 q13, d17, d3
|
||||
vmlal.s16 q14, d18, d3
|
||||
vmlal.s16 q15, d19, d3
|
||||
vld1.16 {d4, d5}, [r2, :128]!
|
||||
vmlal.s16 q6, d4, d3
|
||||
vld1.16 {d6, d7}, [r2, :128]!
|
||||
vmlal.s16 q7, d5, d3
|
||||
vmlal.s16 q8, d6, d3
|
||||
vmlal.s16 q9, d7, d3
|
||||
|
||||
vpadd.s32 d0, d24, d25 /* TODO: can be eliminated */
|
||||
vpadd.s32 d1, d26, d27 /* TODO: can be eliminated */
|
||||
vpadd.s32 d2, d28, d29 /* TODO: can be eliminated */
|
||||
vpadd.s32 d3, d30, d31 /* TODO: can be eliminated */
|
||||
vpadd.s32 d0, d12, d13 /* TODO: can be eliminated */
|
||||
vpadd.s32 d1, d14, d15 /* TODO: can be eliminated */
|
||||
vpadd.s32 d2, d16, d17 /* TODO: can be eliminated */
|
||||
vpadd.s32 d3, d18, d19 /* TODO: can be eliminated */
|
||||
|
||||
vst1.32 {d0, d1, d2, d3}, [r1, :128]
|
||||
|
||||
|
||||
@@ -48,17 +48,6 @@
|
||||
#include "atrac.h"
|
||||
#include "atrac3plus.h"
|
||||
|
||||
static const uint8_t channel_map[8][8] = {
|
||||
{ 0, },
|
||||
{ 0, 1, },
|
||||
{ 0, 1, 2, },
|
||||
{ 0, 1, 2, 3, },
|
||||
{ 0, },
|
||||
{ 0, 1, 2, 4, 5, 3, },
|
||||
{ 0, 1, 2, 4, 5, 6, 3, },
|
||||
{ 0, 1, 2, 4, 5, 6, 7, 3, },
|
||||
};
|
||||
|
||||
typedef struct ATRAC3PContext {
|
||||
GetBitContext gb;
|
||||
AVFloatDSPContext *fdsp;
|
||||
@@ -76,7 +65,6 @@ typedef struct ATRAC3PContext {
|
||||
|
||||
int num_channel_blocks; ///< number of channel blocks
|
||||
uint8_t channel_blocks[5]; ///< channel configuration descriptor
|
||||
const uint8_t *channel_map; ///< channel layout map
|
||||
} ATRAC3PContext;
|
||||
|
||||
static av_cold int atrac3p_decode_close(AVCodecContext *avctx)
|
||||
@@ -155,8 +143,6 @@ static av_cold int set_channel_params(ATRAC3PContext *ctx,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
ctx->channel_map = channel_map[channels - 1];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -392,7 +378,7 @@ static int atrac3p_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
channels_to_process, avctx);
|
||||
|
||||
for (i = 0; i < channels_to_process; i++)
|
||||
memcpy(samples_p[ctx->channel_map[out_ch_index + i]], ctx->outp_buf[i],
|
||||
memcpy(samples_p[out_ch_index + i], ctx->outp_buf[i],
|
||||
ATRAC3P_FRAME_SAMPLES * sizeof(**samples_p));
|
||||
|
||||
ch_block++;
|
||||
|
||||
@@ -554,12 +554,13 @@ static int ffat_encode(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
avctx->frame_size,
|
||||
&avpkt->pts,
|
||||
&avpkt->duration);
|
||||
ret = 0;
|
||||
} else if (ret && ret != 1) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Encode error: %i\n", ret);
|
||||
return AVERROR_EXTERNAL;
|
||||
ret = AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static av_cold void ffat_encode_flush(AVCodecContext *avctx)
|
||||
|
||||
@@ -871,7 +871,7 @@ static int binkb_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
|
||||
|
||||
binkb_init_bundles(c);
|
||||
ref_start = frame->data[plane_idx];
|
||||
ref_end = frame->data[plane_idx] + ((bh - 1) * frame->linesize[plane_idx] + bw - 1) * 8;
|
||||
ref_end = frame->data[plane_idx] + (bh * frame->linesize[plane_idx] + bw) * 8;
|
||||
|
||||
for (i = 0; i < 64; i++)
|
||||
coordmap[i] = (i & 7) + (i >> 3) * stride;
|
||||
@@ -927,7 +927,7 @@ static int binkb_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
|
||||
xoff = binkb_get_value(c, BINKB_SRC_X_OFF);
|
||||
yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias;
|
||||
ref = dst + xoff + yoff * stride;
|
||||
if (ref < ref_start || ref > ref_end) {
|
||||
if (ref < ref_start || ref + 8*stride > ref_end) {
|
||||
av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
|
||||
} else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
|
||||
c->put_pixels_tab(dst, ref, stride, 8);
|
||||
@@ -943,7 +943,7 @@ static int binkb_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
|
||||
xoff = binkb_get_value(c, BINKB_SRC_X_OFF);
|
||||
yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias;
|
||||
ref = dst + xoff + yoff * stride;
|
||||
if (ref < ref_start || ref > ref_end) {
|
||||
if (ref < ref_start || ref + 8 * stride > ref_end) {
|
||||
av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
|
||||
} else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
|
||||
c->put_pixels_tab(dst, ref, stride, 8);
|
||||
@@ -975,7 +975,7 @@ static int binkb_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
|
||||
xoff = binkb_get_value(c, BINKB_SRC_X_OFF);
|
||||
yoff = binkb_get_value(c, BINKB_SRC_Y_OFF) + ybias;
|
||||
ref = dst + xoff + yoff * stride;
|
||||
if (ref < ref_start || ref > ref_end) {
|
||||
if (ref < ref_start || ref + 8 * stride > ref_end) {
|
||||
av_log(c->avctx, AV_LOG_WARNING, "Reference block is out of bounds\n");
|
||||
} else if (ref + 8*stride < dst || ref >= dst + 8*stride) {
|
||||
c->put_pixels_tab(dst, ref, stride, 8);
|
||||
@@ -1088,7 +1088,7 @@ static int bink_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
|
||||
for (bx = 0; bx < bw; bx++, dst += 8, prev += 8) {
|
||||
blk = get_value(c, BINK_SRC_BLOCK_TYPES);
|
||||
// 16x16 block type on odd line means part of the already decoded block, so skip it
|
||||
if (((by & 1) || (bx & 1)) && blk == SCALED_BLOCK) {
|
||||
if ((by & 1) && blk == SCALED_BLOCK) {
|
||||
bx++;
|
||||
dst += 8;
|
||||
prev += 8;
|
||||
|
||||
@@ -216,7 +216,7 @@ static uint8_t prob_dst_x_bit(int c)
|
||||
return (ff_reverse[c & 127] >> 1) + 1;
|
||||
}
|
||||
|
||||
static int build_filter(int16_t table[DST_MAX_ELEMENTS][16][256], const Table *fsets)
|
||||
static void build_filter(int16_t table[DST_MAX_ELEMENTS][16][256], const Table *fsets)
|
||||
{
|
||||
int i, j, k, l;
|
||||
|
||||
@@ -227,17 +227,14 @@ static int build_filter(int16_t table[DST_MAX_ELEMENTS][16][256], const Table *f
|
||||
int total = av_clip(length - j * 8, 0, 8);
|
||||
|
||||
for (k = 0; k < 256; k++) {
|
||||
int64_t v = 0;
|
||||
int v = 0;
|
||||
|
||||
for (l = 0; l < total; l++)
|
||||
v += (((k >> l) & 1) * 2 - 1) * fsets->coeff[i][j * 8 + l];
|
||||
if ((int16_t)v != v)
|
||||
return AVERROR_INVALIDDATA;
|
||||
table[i][j][k] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
@@ -332,9 +329,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
return AVERROR_INVALIDDATA;
|
||||
ac_init(ac, gb);
|
||||
|
||||
ret = build_filter(s->filter, &s->fsets);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
build_filter(s->filter, &s->fsets);
|
||||
|
||||
memset(s->status, 0xAA, sizeof(s->status));
|
||||
memset(dsd, 0, frame->nb_samples * 4 * channels);
|
||||
|
||||
@@ -138,11 +138,9 @@ static void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
|
||||
// spx_noise_blend and spx_signal_blend are both FP.23
|
||||
nscale *= 1.0 / (1<<23);
|
||||
sscale *= 1.0 / (1<<23);
|
||||
if (nscale < -1.0)
|
||||
nscale = -1.0;
|
||||
#endif
|
||||
for (i = 0; i < s->spx_band_sizes[bnd]; i++) {
|
||||
UINTFLOAT noise = (INTFLOAT)(nscale * (int32_t)av_lfg_get(&s->dith_state));
|
||||
float noise = nscale * (int32_t)av_lfg_get(&s->dith_state);
|
||||
s->transform_coeffs[ch][bin] *= sscale;
|
||||
s->transform_coeffs[ch][bin++] += noise;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ static av_cold int tgq_decode_init(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb)
|
||||
static void tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb)
|
||||
{
|
||||
uint8_t *perm = s->scantable.permutated;
|
||||
int i, j, value;
|
||||
@@ -70,8 +70,6 @@ static int tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb)
|
||||
for (i = 1; i < 64;) {
|
||||
switch (show_bits(gb, 3)) {
|
||||
case 4:
|
||||
if (i >= 63)
|
||||
return AVERROR_INVALIDDATA;
|
||||
block[perm[i++]] = 0;
|
||||
case 0:
|
||||
block[perm[i++]] = 0;
|
||||
@@ -81,8 +79,6 @@ static int tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb)
|
||||
case 1:
|
||||
skip_bits(gb, 2);
|
||||
value = get_bits(gb, 6);
|
||||
if (value > 64 - i)
|
||||
return AVERROR_INVALIDDATA;
|
||||
for (j = 0; j < value; j++)
|
||||
block[perm[i++]] = 0;
|
||||
break;
|
||||
@@ -110,7 +106,6 @@ static int tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb)
|
||||
}
|
||||
}
|
||||
block[0] += 128 << 4;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void tgq_idct_put_mb(TgqContext *s, int16_t (*block)[64], AVFrame *frame,
|
||||
@@ -170,11 +165,8 @@ static int tgq_decode_mb(TgqContext *s, AVFrame *frame, int mb_y, int mb_x)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
int ret = tgq_decode_block(s, s->block[i], &gb);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
for (i = 0; i < 6; i++)
|
||||
tgq_decode_block(s, s->block[i], &gb);
|
||||
tgq_idct_put_mb(s, s->block, frame, mb_x, mb_y);
|
||||
bytestream2_skip(&s->gb, mode);
|
||||
} else {
|
||||
|
||||
@@ -89,6 +89,11 @@ static CodeBook unpack_codebook(GetBitContext* gb, unsigned depth,
|
||||
unsigned i, j;
|
||||
CodeBook cb = { 0 };
|
||||
|
||||
if (size >= INT_MAX / 34 || get_bits_left(gb) < size * 34)
|
||||
return cb;
|
||||
|
||||
if (size >= INT_MAX / sizeof(MacroBlock))
|
||||
return cb;
|
||||
cb.blocks = av_malloc(size ? size * sizeof(MacroBlock) : 1);
|
||||
if (!cb.blocks)
|
||||
return cb;
|
||||
@@ -220,7 +225,7 @@ static int escape124_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
// represent a lower bound of the space needed for skipped superblocks. Non
|
||||
// skipped SBs need more space.
|
||||
if (get_bits_left(&gb) < 64 + s->num_superblocks * 23LL / 4320)
|
||||
return AVERROR_INVALIDDATA;
|
||||
return -1;
|
||||
|
||||
frame_flags = get_bits_long(&gb, 32);
|
||||
frame_size = get_bits_long(&gb, 32);
|
||||
@@ -271,14 +276,9 @@ static int escape124_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
}
|
||||
|
||||
av_freep(&s->codebooks[i].blocks);
|
||||
if (cb_size >= INT_MAX / 34 || get_bits_left(&gb) < (int)cb_size * 34)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (cb_size >= INT_MAX / sizeof(MacroBlock))
|
||||
return AVERROR_INVALIDDATA;
|
||||
s->codebooks[i] = unpack_codebook(&gb, cb_depth, cb_size);
|
||||
if (!s->codebooks[i].blocks)
|
||||
return AVERROR(ENOMEM);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1241,8 +1241,7 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
|
||||
td->ysize = FFMIN(s->tile_attr.ySize, s->ydelta - tile_y * s->tile_attr.ySize);
|
||||
td->xsize = FFMIN(s->tile_attr.xSize, s->xdelta - tile_x * s->tile_attr.xSize);
|
||||
|
||||
if (td->xsize * (uint64_t)s->current_channel_offset > INT_MAX ||
|
||||
av_image_check_size2(td->xsize, td->ysize, s->avctx->max_pixels, AV_PIX_FMT_NONE, 0, s->avctx) < 0)
|
||||
if (td->xsize * (uint64_t)s->current_channel_offset > INT_MAX)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
td->channel_line_size = td->xsize * s->current_channel_offset;/* uncompress size of one line */
|
||||
@@ -1266,8 +1265,7 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
|
||||
td->ysize = FFMIN(s->scan_lines_per_block, s->ymax - line + 1); /* s->ydelta - line ?? */
|
||||
td->xsize = s->xdelta;
|
||||
|
||||
if (td->xsize * (uint64_t)s->current_channel_offset > INT_MAX ||
|
||||
av_image_check_size2(td->xsize, td->ysize, s->avctx->max_pixels, AV_PIX_FMT_NONE, 0, s->avctx) < 0)
|
||||
if (td->xsize * (uint64_t)s->current_channel_offset > INT_MAX)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
td->channel_line_size = td->xsize * s->current_channel_offset;/* uncompress size of one line */
|
||||
@@ -1951,12 +1949,9 @@ static int decode_header(EXRContext *s, AVFrame *frame)
|
||||
"preview", 16)) >= 0) {
|
||||
uint32_t pw = bytestream2_get_le32(gb);
|
||||
uint32_t ph = bytestream2_get_le32(gb);
|
||||
uint64_t psize = pw * ph;
|
||||
if (psize > INT64_MAX / 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
psize *= 4;
|
||||
int64_t psize = 4LL * pw * ph;
|
||||
|
||||
if ((int64_t)psize >= bytestream2_get_bytes_left(gb))
|
||||
if (psize >= bytestream2_get_bytes_left(gb))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
bytestream2_skip(gb, psize);
|
||||
|
||||
@@ -168,31 +168,24 @@ static int decode_slice_header(const FFV1Context *f, FFV1Context *fs)
|
||||
RangeCoder *c = &fs->c;
|
||||
uint8_t state[CONTEXT_SIZE];
|
||||
unsigned ps, i, context_count;
|
||||
int sx, sy, sw, sh;
|
||||
|
||||
memset(state, 128, sizeof(state));
|
||||
sx = get_symbol(c, state, 0);
|
||||
sy = get_symbol(c, state, 0);
|
||||
sw = get_symbol(c, state, 0) + 1U;
|
||||
sh = get_symbol(c, state, 0) + 1U;
|
||||
|
||||
av_assert0(f->version > 2);
|
||||
|
||||
fs->slice_x = get_symbol(c, state, 0) * f->width ;
|
||||
fs->slice_y = get_symbol(c, state, 0) * f->height;
|
||||
fs->slice_width = (get_symbol(c, state, 0) + 1) * f->width + fs->slice_x;
|
||||
fs->slice_height = (get_symbol(c, state, 0) + 1) * f->height + fs->slice_y;
|
||||
|
||||
if (sx < 0 || sy < 0 || sw <= 0 || sh <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (sx > f->num_h_slices - sw || sy > f->num_v_slices - sh)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
fs->slice_x = sx * (int64_t)f->width / f->num_h_slices;
|
||||
fs->slice_y = sy * (int64_t)f->height / f->num_v_slices;
|
||||
fs->slice_width = (sx + sw) * (int64_t)f->width / f->num_h_slices - fs->slice_x;
|
||||
fs->slice_height = (sy + sh) * (int64_t)f->height / f->num_v_slices - fs->slice_y;
|
||||
|
||||
av_assert0((unsigned)fs->slice_width <= f->width &&
|
||||
(unsigned)fs->slice_height <= f->height);
|
||||
av_assert0 ( (unsigned)fs->slice_x + (uint64_t)fs->slice_width <= f->width
|
||||
&& (unsigned)fs->slice_y + (uint64_t)fs->slice_height <= f->height);
|
||||
fs->slice_x /= f->num_h_slices;
|
||||
fs->slice_y /= f->num_v_slices;
|
||||
fs->slice_width = fs->slice_width /f->num_h_slices - fs->slice_x;
|
||||
fs->slice_height = fs->slice_height/f->num_v_slices - fs->slice_y;
|
||||
if ((unsigned)fs->slice_width > f->width || (unsigned)fs->slice_height > f->height)
|
||||
return -1;
|
||||
if ( (unsigned)fs->slice_x + (uint64_t)fs->slice_width > f->width
|
||||
|| (unsigned)fs->slice_y + (uint64_t)fs->slice_height > f->height)
|
||||
return -1;
|
||||
|
||||
if (fs->ac == AC_GOLOMB_RICE && fs->slice_width >= (1<<23))
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -310,11 +303,8 @@ static int decode_slice(AVCodecContext *c, void *arg)
|
||||
}
|
||||
if ((ret = ff_ffv1_init_slice_state(f, fs)) < 0)
|
||||
return ret;
|
||||
if (f->cur->key_frame || fs->slice_reset_contexts) {
|
||||
if (f->cur->key_frame || fs->slice_reset_contexts)
|
||||
ff_ffv1_clear_slice_state(f, fs);
|
||||
} else if (fs->slice_damaged) {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
width = fs->slice_width;
|
||||
height = fs->slice_height;
|
||||
@@ -477,11 +467,6 @@ static int read_extra_header(FFV1Context *f)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (f->num_h_slices > MAX_SLICES / f->num_v_slices) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "slice count unsupported\n");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
f->quant_table_count = get_symbol(c, state, 0);
|
||||
if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || !f->quant_table_count) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "quant table count %d is invalid\n", f->quant_table_count);
|
||||
@@ -784,25 +769,21 @@ static int read_header(FFV1Context *f)
|
||||
fs->slice_damaged = 0;
|
||||
|
||||
if (f->version == 2) {
|
||||
int sx = get_symbol(c, state, 0);
|
||||
int sy = get_symbol(c, state, 0);
|
||||
int sw = get_symbol(c, state, 0) + 1U;
|
||||
int sh = get_symbol(c, state, 0) + 1U;
|
||||
fs->slice_x = get_symbol(c, state, 0) * f->width ;
|
||||
fs->slice_y = get_symbol(c, state, 0) * f->height;
|
||||
fs->slice_width = (get_symbol(c, state, 0) + 1) * f->width + fs->slice_x;
|
||||
fs->slice_height = (get_symbol(c, state, 0) + 1) * f->height + fs->slice_y;
|
||||
|
||||
if (sx < 0 || sy < 0 || sw <= 0 || sh <= 0)
|
||||
fs->slice_x /= f->num_h_slices;
|
||||
fs->slice_y /= f->num_v_slices;
|
||||
fs->slice_width = fs->slice_width / f->num_h_slices - fs->slice_x;
|
||||
fs->slice_height = fs->slice_height / f->num_v_slices - fs->slice_y;
|
||||
if ((unsigned)fs->slice_width > f->width ||
|
||||
(unsigned)fs->slice_height > f->height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (sx > f->num_h_slices - sw || sy > f->num_v_slices - sh)
|
||||
if ( (unsigned)fs->slice_x + (uint64_t)fs->slice_width > f->width
|
||||
|| (unsigned)fs->slice_y + (uint64_t)fs->slice_height > f->height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
fs->slice_x = sx * (int64_t)f->width / f->num_h_slices;
|
||||
fs->slice_y = sy * (int64_t)f->height / f->num_v_slices;
|
||||
fs->slice_width = (sx + sw) * (int64_t)f->width / f->num_h_slices - fs->slice_x;
|
||||
fs->slice_height = (sy + sh) * (int64_t)f->height / f->num_v_slices - fs->slice_y;
|
||||
|
||||
av_assert0((unsigned)fs->slice_width <= f->width &&
|
||||
(unsigned)fs->slice_height <= f->height);
|
||||
av_assert0 ( (unsigned)fs->slice_x + (uint64_t)fs->slice_width <= f->width
|
||||
&& (unsigned)fs->slice_y + (uint64_t)fs->slice_height <= f->height);
|
||||
}
|
||||
|
||||
for (i = 0; i < f->plane_count; i++) {
|
||||
@@ -902,14 +883,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
|
||||
if (buf_size < avctx->width * avctx->height / (128*8))
|
||||
return AVERROR_INVALIDDATA;
|
||||
} else {
|
||||
int w = avctx->width;
|
||||
int s = 1 + w / (1<<23);
|
||||
|
||||
w /= s;
|
||||
|
||||
for (i = 0; w > (1<<ff_log2_run[i]); i++)
|
||||
w -= ff_log2_run[i];
|
||||
if (buf_size < (avctx->height + i + 6) / 8 * s)
|
||||
if (buf_size < avctx->height / 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
|
||||
@@ -401,17 +401,20 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
GetByteContext *gb = &s->gb;
|
||||
PutByteContext *pb = &s->pb;
|
||||
int ret, y, x;
|
||||
int key_frame;
|
||||
|
||||
if (avpkt->size < 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
bytestream2_init(gb, avpkt->data, avpkt->size);
|
||||
bytestream2_skip(gb, 2);
|
||||
|
||||
key_frame = !!bytestream2_get_le16(gb);
|
||||
frame->key_frame = !!bytestream2_get_le16(gb);
|
||||
frame->pict_type = frame->key_frame ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
|
||||
|
||||
if (key_frame) {
|
||||
if (frame->key_frame) {
|
||||
const uint8_t *src;
|
||||
unsigned type, size;
|
||||
uint8_t *dst;
|
||||
@@ -431,12 +434,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
frame->key_frame = 1;
|
||||
frame->pict_type = AV_PICTURE_TYPE_I;
|
||||
|
||||
src = s->buffer;
|
||||
dst = frame->data[0] + (avctx->height - 1) * frame->linesize[0];
|
||||
for (y = 0; y < avctx->height; y++) {
|
||||
@@ -517,12 +514,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
dst = &rect[block_h * s->stride];
|
||||
}
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
frame->key_frame = 0;
|
||||
frame->pict_type = AV_PICTURE_TYPE_P;
|
||||
|
||||
ssrc = s->buffer;
|
||||
ddst = frame->data[0] + (avctx->height - 1) * frame->linesize[0];
|
||||
for (y = 0; y < avctx->height; y++) {
|
||||
|
||||
@@ -552,8 +552,6 @@ retry:
|
||||
avctx->has_b_frames = !s->low_delay;
|
||||
|
||||
if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) {
|
||||
if (s->pict_type != AV_PICTURE_TYPE_B && s->mb_num/2 > get_bits_left(&s->gb))
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (ff_mpeg4_workaround_bugs(avctx) == 1)
|
||||
goto retry;
|
||||
if (s->studio_profile != (s->idsp.idct == NULL))
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#ifndef AVCODEC_H274_H
|
||||
#define AVCODEC_H274_H
|
||||
|
||||
#include "libavutil/film_grain_params.h"
|
||||
#include <libavutil/film_grain_params.h>
|
||||
|
||||
// Must be initialized to {0} prior to first usage
|
||||
typedef struct H274FilmGrainDatabase {
|
||||
|
||||
@@ -143,22 +143,11 @@ static void copy_CTB(uint8_t *dst, const uint8_t *src, int width, int height,
|
||||
|
||||
if (((intptr_t)dst | (intptr_t)src | stride_dst | stride_src) & 15) {
|
||||
for (i = 0; i < height; i++) {
|
||||
for (j = 0; j < width - 7; j+=8)
|
||||
for (j = 0; j < width; j+=8)
|
||||
AV_COPY64U(dst+j, src+j);
|
||||
dst += stride_dst;
|
||||
src += stride_src;
|
||||
}
|
||||
if (width&7) {
|
||||
dst += ((width>>3)<<3) - stride_dst * height;
|
||||
src += ((width>>3)<<3) - stride_src * height;
|
||||
width &= 7;
|
||||
for (i = 0; i < height; i++) {
|
||||
for (j = 0; j < width; j++)
|
||||
dst[j] = src[j];
|
||||
dst += stride_dst;
|
||||
src += stride_src;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < height; i++) {
|
||||
for (j = 0; j < width; j+=16)
|
||||
|
||||
@@ -3516,7 +3516,7 @@ static int hevc_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
|
||||
}
|
||||
} else {
|
||||
/* verify the SEI checksum */
|
||||
if (avctx->err_recognition & AV_EF_CRCCHECK && s->ref && s->is_decoded &&
|
||||
if (avctx->err_recognition & AV_EF_CRCCHECK && s->is_decoded &&
|
||||
s->sei.picture_hash.is_md5) {
|
||||
ret = verify_md5(s, s->ref->frame);
|
||||
if (ret < 0 && avctx->err_recognition & AV_EF_EXPLODE) {
|
||||
|
||||
@@ -409,9 +409,6 @@ output_zeros:
|
||||
if (zero_run) {
|
||||
zero_run = 0;
|
||||
i += esc_count;
|
||||
if (i > end - dst ||
|
||||
i >= src_end - src)
|
||||
return AVERROR_INVALIDDATA;
|
||||
memcpy(dst, src, i);
|
||||
dst += i;
|
||||
l->zeros_rem = lag_calc_zero_run(src[i]);
|
||||
|
||||
@@ -167,9 +167,9 @@ static enum AVColorTransferCharacteristic libjxl_get_trc(void *avctx, const JxlC
|
||||
case JXL_TRANSFER_FUNCTION_DCI: return AVCOL_TRC_SMPTE428;
|
||||
case JXL_TRANSFER_FUNCTION_HLG: return AVCOL_TRC_ARIB_STD_B67;
|
||||
case JXL_TRANSFER_FUNCTION_GAMMA:
|
||||
if (jxl_color->gamma > 0.45355 && jxl_color->gamma < 0.45555)
|
||||
if (jxl_color->gamma > 2.199 && jxl_color->gamma < 2.201)
|
||||
return AVCOL_TRC_GAMMA22;
|
||||
else if (jxl_color->gamma > 0.35614 && jxl_color->gamma < 0.35814)
|
||||
else if (jxl_color->gamma > 2.799 && jxl_color->gamma < 2.801)
|
||||
return AVCOL_TRC_GAMMA28;
|
||||
else
|
||||
av_log(avctx, AV_LOG_WARNING, "Unsupported gamma transfer: %f\n", jxl_color->gamma);
|
||||
|
||||
@@ -190,7 +190,7 @@ static av_cold int libjxl_encode_init(AVCodecContext *avctx)
|
||||
* Populate a JxlColorEncoding with the given enum AVColorPrimaries.
|
||||
* @return < 0 upon failure, >= 0 upon success
|
||||
*/
|
||||
static int libjxl_populate_primaries(void *avctx, JxlColorEncoding *jxl_color, enum AVColorPrimaries prm)
|
||||
static int libjxl_populate_primaries(JxlColorEncoding *jxl_color, enum AVColorPrimaries prm)
|
||||
{
|
||||
const AVColorPrimariesDesc *desc;
|
||||
|
||||
@@ -211,11 +211,6 @@ static int libjxl_populate_primaries(void *avctx, JxlColorEncoding *jxl_color, e
|
||||
jxl_color->primaries = JXL_PRIMARIES_P3;
|
||||
jxl_color->white_point = JXL_WHITE_POINT_D65;
|
||||
return 0;
|
||||
case AVCOL_PRI_UNSPECIFIED:
|
||||
av_log(avctx, AV_LOG_WARNING, "Unknown primaries, assuming BT.709/sRGB. Colors may be wrong.\n");
|
||||
jxl_color->primaries = JXL_PRIMARIES_SRGB;
|
||||
jxl_color->white_point = JXL_WHITE_POINT_D65;
|
||||
return 0;
|
||||
}
|
||||
|
||||
desc = av_csp_primaries_desc_from_id(prm);
|
||||
@@ -345,7 +340,7 @@ static int libjxl_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFra
|
||||
else
|
||||
jxl_color.color_space = JXL_COLOR_SPACE_RGB;
|
||||
|
||||
ret = libjxl_populate_primaries(avctx, &jxl_color,
|
||||
ret = libjxl_populate_primaries(&jxl_color,
|
||||
frame->color_primaries && frame->color_primaries != AVCOL_PRI_UNSPECIFIED
|
||||
? frame->color_primaries : avctx->color_primaries);
|
||||
if (ret < 0)
|
||||
|
||||
@@ -43,7 +43,7 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
|
||||
LibSpeexContext *s = avctx->priv_data;
|
||||
const SpeexMode *mode;
|
||||
SpeexHeader *header = NULL;
|
||||
int spx_mode, channels = avctx->ch_layout.nb_channels;
|
||||
int spx_mode, channels;
|
||||
|
||||
if (avctx->extradata && avctx->extradata_size >= 80) {
|
||||
header = speex_packet_to_header(avctx->extradata,
|
||||
|
||||
@@ -424,8 +424,11 @@ static int eb_send_frame(AVCodecContext *avctx, const AVFrame *frame)
|
||||
if (svt_enc->eos_flag == EOS_SENT)
|
||||
return 0;
|
||||
|
||||
memset(&headerPtrLast, 0, sizeof(headerPtrLast));
|
||||
headerPtrLast.pic_type = EB_AV1_INVALID_PICTURE;
|
||||
headerPtrLast.n_alloc_len = 0;
|
||||
headerPtrLast.n_filled_len = 0;
|
||||
headerPtrLast.n_tick_count = 0;
|
||||
headerPtrLast.p_app_private = NULL;
|
||||
headerPtrLast.p_buffer = NULL;
|
||||
headerPtrLast.flags = EB_BUFFERFLAG_EOS;
|
||||
|
||||
svt_av1_enc_send_picture(svt_enc->svt_handle, &headerPtrLast);
|
||||
|
||||
@@ -56,6 +56,8 @@
|
||||
struct FrameListData {
|
||||
void *buf; /**< compressed data buffer */
|
||||
size_t sz; /**< length of compressed data */
|
||||
void *buf_alpha;
|
||||
size_t sz_alpha;
|
||||
int64_t pts; /**< time stamp to show frame
|
||||
(in timebase units) */
|
||||
unsigned long duration; /**< duration to show frame
|
||||
@@ -85,7 +87,6 @@ typedef struct VPxEncoderContext {
|
||||
int have_sse; /**< true if we have pending sse[] */
|
||||
uint64_t frame_number;
|
||||
struct FrameListData *coded_frame_list;
|
||||
struct FrameListData *alpha_coded_frame_list;
|
||||
|
||||
int cpu_used;
|
||||
int sharpness;
|
||||
@@ -310,6 +311,8 @@ static void coded_frame_add(void *list, struct FrameListData *cx_frame)
|
||||
static av_cold void free_coded_frame(struct FrameListData *cx_frame)
|
||||
{
|
||||
av_freep(&cx_frame->buf);
|
||||
if (cx_frame->buf_alpha)
|
||||
av_freep(&cx_frame->buf_alpha);
|
||||
av_freep(&cx_frame);
|
||||
}
|
||||
|
||||
@@ -443,7 +446,6 @@ static av_cold int vpx_free(AVCodecContext *avctx)
|
||||
av_freep(&ctx->twopass_stats.buf);
|
||||
av_freep(&avctx->stats_out);
|
||||
free_frame_list(ctx->coded_frame_list);
|
||||
free_frame_list(ctx->alpha_coded_frame_list);
|
||||
if (ctx->hdr10_plus_fifo)
|
||||
free_hdr10_plus_fifo(&ctx->hdr10_plus_fifo);
|
||||
return 0;
|
||||
@@ -1203,6 +1205,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
|
||||
|
||||
static inline void cx_pktcpy(struct FrameListData *dst,
|
||||
const struct vpx_codec_cx_pkt *src,
|
||||
const struct vpx_codec_cx_pkt *src_alpha,
|
||||
VPxContext *ctx)
|
||||
{
|
||||
dst->pts = src->data.frame.pts;
|
||||
@@ -1226,6 +1229,13 @@ static inline void cx_pktcpy(struct FrameListData *dst,
|
||||
} else {
|
||||
dst->frame_number = -1; /* sanity marker */
|
||||
}
|
||||
if (src_alpha) {
|
||||
dst->buf_alpha = src_alpha->data.frame.buf;
|
||||
dst->sz_alpha = src_alpha->data.frame.sz;
|
||||
} else {
|
||||
dst->buf_alpha = NULL;
|
||||
dst->sz_alpha = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1236,7 +1246,7 @@ static inline void cx_pktcpy(struct FrameListData *dst,
|
||||
* @return a negative AVERROR on error
|
||||
*/
|
||||
static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
|
||||
struct FrameListData *alpha_cx_frame, AVPacket *pkt)
|
||||
AVPacket *pkt)
|
||||
{
|
||||
VPxContext *ctx = avctx->priv_data;
|
||||
int ret = ff_get_encode_buffer(avctx, pkt, cx_frame->sz, 0);
|
||||
@@ -1269,16 +1279,16 @@ static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
|
||||
avctx->error[i] += cx_frame->sse[i + 1];
|
||||
cx_frame->have_sse = 0;
|
||||
}
|
||||
if (alpha_cx_frame) {
|
||||
if (cx_frame->sz_alpha > 0) {
|
||||
side_data = av_packet_new_side_data(pkt,
|
||||
AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
|
||||
alpha_cx_frame->sz + 8);
|
||||
cx_frame->sz_alpha + 8);
|
||||
if (!side_data) {
|
||||
av_packet_unref(pkt);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
AV_WB64(side_data, 1);
|
||||
memcpy(side_data + 8, alpha_cx_frame->buf, alpha_cx_frame->sz);
|
||||
memcpy(side_data + 8, cx_frame->buf_alpha, cx_frame->sz_alpha);
|
||||
}
|
||||
if (cx_frame->frame_number != -1) {
|
||||
if (ctx->hdr10_plus_fifo) {
|
||||
@@ -1299,37 +1309,40 @@ static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
|
||||
* @return AVERROR(EINVAL) on output size error
|
||||
* @return AVERROR(ENOMEM) on coded frame queue data allocation error
|
||||
*/
|
||||
static int queue_frames(AVCodecContext *avctx, struct vpx_codec_ctx *encoder,
|
||||
struct FrameListData **frame_list, AVPacket *pkt_out)
|
||||
static int queue_frames(AVCodecContext *avctx, AVPacket *pkt_out)
|
||||
{
|
||||
VPxContext *ctx = avctx->priv_data;
|
||||
const struct vpx_codec_cx_pkt *pkt;
|
||||
const struct vpx_codec_cx_pkt *pkt_alpha = NULL;
|
||||
const void *iter = NULL;
|
||||
const void *iter_alpha = NULL;
|
||||
int size = 0;
|
||||
|
||||
if (!ctx->is_alpha && *frame_list) {
|
||||
struct FrameListData *cx_frame = *frame_list;
|
||||
if (ctx->coded_frame_list) {
|
||||
struct FrameListData *cx_frame = ctx->coded_frame_list;
|
||||
/* return the leading frame if we've already begun queueing */
|
||||
size = storeframe(avctx, cx_frame, NULL, pkt_out);
|
||||
size = storeframe(avctx, cx_frame, pkt_out);
|
||||
if (size < 0)
|
||||
return size;
|
||||
*frame_list = cx_frame->next;
|
||||
ctx->coded_frame_list = cx_frame->next;
|
||||
free_coded_frame(cx_frame);
|
||||
}
|
||||
|
||||
/* consume all available output from the encoder before returning. buffers
|
||||
are only good through the next vpx_codec call */
|
||||
while (pkt = vpx_codec_get_cx_data(encoder, &iter)) {
|
||||
while ((pkt = vpx_codec_get_cx_data(&ctx->encoder, &iter)) &&
|
||||
(!ctx->is_alpha ||
|
||||
(pkt_alpha = vpx_codec_get_cx_data(&ctx->encoder_alpha, &iter_alpha)))) {
|
||||
switch (pkt->kind) {
|
||||
case VPX_CODEC_CX_FRAME_PKT:
|
||||
if (!ctx->is_alpha && !size) {
|
||||
if (!size) {
|
||||
struct FrameListData cx_frame;
|
||||
|
||||
/* avoid storing the frame when the list is empty and we haven't yet
|
||||
provided a frame for output */
|
||||
av_assert0(!ctx->coded_frame_list);
|
||||
cx_pktcpy(&cx_frame, pkt, ctx);
|
||||
size = storeframe(avctx, &cx_frame, NULL, pkt_out);
|
||||
cx_pktcpy(&cx_frame, pkt, pkt_alpha, ctx);
|
||||
size = storeframe(avctx, &cx_frame, pkt_out);
|
||||
if (size < 0)
|
||||
return size;
|
||||
} else {
|
||||
@@ -1340,7 +1353,7 @@ static int queue_frames(AVCodecContext *avctx, struct vpx_codec_ctx *encoder,
|
||||
"Frame queue element alloc failed\n");
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
cx_pktcpy(cx_frame, pkt, ctx);
|
||||
cx_pktcpy(cx_frame, pkt, pkt_alpha, ctx);
|
||||
cx_frame->buf = av_malloc(cx_frame->sz);
|
||||
|
||||
if (!cx_frame->buf) {
|
||||
@@ -1351,14 +1364,23 @@ static int queue_frames(AVCodecContext *avctx, struct vpx_codec_ctx *encoder,
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
memcpy(cx_frame->buf, pkt->data.frame.buf, pkt->data.frame.sz);
|
||||
coded_frame_add(frame_list, cx_frame);
|
||||
if (ctx->is_alpha) {
|
||||
cx_frame->buf_alpha = av_malloc(cx_frame->sz_alpha);
|
||||
if (!cx_frame->buf_alpha) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Data buffer alloc (%"SIZE_SPECIFIER" bytes) failed\n",
|
||||
cx_frame->sz_alpha);
|
||||
av_free(cx_frame);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
memcpy(cx_frame->buf_alpha, pkt_alpha->data.frame.buf, pkt_alpha->data.frame.sz);
|
||||
}
|
||||
coded_frame_add(&ctx->coded_frame_list, cx_frame);
|
||||
}
|
||||
break;
|
||||
case VPX_CODEC_STATS_PKT: {
|
||||
struct vpx_fixed_buf *stats = &ctx->twopass_stats;
|
||||
int err;
|
||||
if (!pkt_out)
|
||||
break;
|
||||
if ((err = av_reallocp(&stats->buf,
|
||||
stats->sz +
|
||||
pkt->data.twopass_stats.sz)) < 0) {
|
||||
@@ -1372,8 +1394,6 @@ static int queue_frames(AVCodecContext *avctx, struct vpx_codec_ctx *encoder,
|
||||
break;
|
||||
}
|
||||
case VPX_CODEC_PSNR_PKT:
|
||||
if (!pkt_out)
|
||||
break;
|
||||
av_assert0(!ctx->have_sse);
|
||||
ctx->sse[0] = pkt->data.psnr.sse[0];
|
||||
ctx->sse[1] = pkt->data.psnr.sse[1];
|
||||
@@ -1768,24 +1788,7 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt,
|
||||
}
|
||||
}
|
||||
|
||||
coded_size = queue_frames(avctx, &ctx->encoder, &ctx->coded_frame_list, pkt);
|
||||
if (ctx->is_alpha) {
|
||||
queue_frames(avctx, &ctx->encoder_alpha, &ctx->alpha_coded_frame_list, NULL);
|
||||
|
||||
if (ctx->coded_frame_list && ctx->alpha_coded_frame_list) {
|
||||
struct FrameListData *cx_frame = ctx->coded_frame_list;
|
||||
struct FrameListData *alpha_cx_frame = ctx->alpha_coded_frame_list;
|
||||
av_assert0(!coded_size);
|
||||
/* return the leading frame if we've already begun queueing */
|
||||
coded_size = storeframe(avctx, cx_frame, alpha_cx_frame, pkt);
|
||||
if (coded_size < 0)
|
||||
return coded_size;
|
||||
ctx->coded_frame_list = cx_frame->next;
|
||||
ctx->alpha_coded_frame_list = alpha_cx_frame->next;
|
||||
free_coded_frame(cx_frame);
|
||||
free_coded_frame(alpha_cx_frame);
|
||||
}
|
||||
}
|
||||
coded_size = queue_frames(avctx, pkt);
|
||||
|
||||
if (!frame && avctx->flags & AV_CODEC_FLAG_PASS1) {
|
||||
unsigned int b64_size = AV_BASE64_SIZE(ctx->twopass_stats.sz);
|
||||
|
||||
@@ -203,7 +203,12 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
|
||||
bytestream2_skip(gb, 8);
|
||||
uncompressed = bytestream2_get_le32(gb);
|
||||
|
||||
if (!uncompressed) {
|
||||
if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
if (uncompressed) {
|
||||
ret = decode_mvdv(s, avctx, frame);
|
||||
} else {
|
||||
av_fast_padded_malloc(&s->uncompressed, &s->uncompressed_size, 16LL * (avpkt->size - 12));
|
||||
if (!s->uncompressed)
|
||||
return AVERROR(ENOMEM);
|
||||
@@ -212,13 +217,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
bytestream2_init(gb, s->uncompressed, ret);
|
||||
ret = decode_mvdv(s, avctx, frame);
|
||||
}
|
||||
|
||||
if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
ret = decode_mvdv(s, avctx, frame);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
key = ret;
|
||||
|
||||
@@ -1092,10 +1092,6 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (s->v_max != 1 || s->h_max != 1 || !s->lossless)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (s->bayer) {
|
||||
if (s->rct || s->pegasus_rct)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
|
||||
s->restart_count = s->restart_interval;
|
||||
@@ -1212,8 +1208,6 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
|
||||
ptr[3*mb_x + 2] = buffer[mb_x][2] + ptr[3*mb_x + 1];
|
||||
}
|
||||
} else if (s->bayer) {
|
||||
if (s->bits <= 8)
|
||||
return AVERROR_PATCHWELCOME;
|
||||
if (nb_components == 1) {
|
||||
/* Leave decoding to the TIFF/DNG decoder (see comment in ff_mjpeg_decode_sof) */
|
||||
for (mb_x = 0; mb_x < width; mb_x++)
|
||||
@@ -1948,8 +1942,6 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
|
||||
}
|
||||
|
||||
len -= 9;
|
||||
if (s->bayer)
|
||||
goto out;
|
||||
if (s->got_picture)
|
||||
if (rgb != s->rgb || pegasus_rct != s->pegasus_rct) {
|
||||
av_log(s->avctx, AV_LOG_WARNING, "Mismatching LJIF tag\n");
|
||||
|
||||
@@ -309,7 +309,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
|
||||
default: av_assert0(0);
|
||||
}
|
||||
|
||||
put_bits(pb, 16, 8 + 3 * components);
|
||||
put_bits(pb, 16, 17);
|
||||
if (lossless && ( avctx->pix_fmt == AV_PIX_FMT_BGR0
|
||||
|| avctx->pix_fmt == AV_PIX_FMT_BGRA
|
||||
|| avctx->pix_fmt == AV_PIX_FMT_BGR24))
|
||||
|
||||
@@ -549,7 +549,7 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
|
||||
|
||||
/* This should happen for TrueHD streams with >6 channels and MLP's noise
|
||||
* type. It is not yet known if this is allowed. */
|
||||
if (max_matrix_channel > MAX_MATRIX_CHANNEL_MLP && !noise_type) {
|
||||
if (max_channel > MAX_MATRIX_CHANNEL_MLP && !noise_type) {
|
||||
avpriv_request_sample(m->avctx,
|
||||
"%d channels (more than the "
|
||||
"maximum supported by the decoder)",
|
||||
|
||||
@@ -330,7 +330,7 @@ static av_cold int mobiclip_init(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int setup_qtables(AVCodecContext *avctx, int64_t quantizer)
|
||||
static int setup_qtables(AVCodecContext *avctx, int quantizer)
|
||||
{
|
||||
MobiClipContext *s = avctx->priv_data;
|
||||
int qx, qy;
|
||||
@@ -1256,7 +1256,7 @@ static int mobiclip_decode(AVCodecContext *avctx, AVFrame *rframe,
|
||||
frame->key_frame = 0;
|
||||
s->dct_tab_idx = 0;
|
||||
|
||||
ret = setup_qtables(avctx, s->quantizer + (int64_t)get_se_golomb(gb));
|
||||
ret = setup_qtables(avctx, s->quantizer + get_se_golomb(gb));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ static YuvPixel mp_get_yuv_from_rgb(MotionPixelsContext *mp, int x, int y)
|
||||
int color;
|
||||
|
||||
color = *(uint16_t *)&mp->frame->data[0][y * mp->frame->linesize[0] + x * 2];
|
||||
return mp_rgb_yuv_table[color & 0x7FFF];
|
||||
return mp_rgb_yuv_table[color];
|
||||
}
|
||||
|
||||
static void mp_set_rgb_from_yuv(MotionPixelsContext *mp, int x, int y, const YuvPixel *p)
|
||||
|
||||
@@ -2553,9 +2553,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture,
|
||||
}
|
||||
break;
|
||||
case EXT_START_CODE:
|
||||
ret = init_get_bits8(&s2->gb, buf_ptr, input_size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
init_get_bits(&s2->gb, buf_ptr, input_size * 8);
|
||||
|
||||
switch (get_bits(&s2->gb, 4)) {
|
||||
case 0x1:
|
||||
@@ -2978,10 +2976,6 @@ static int ipu_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
GetBitContext *gb = &m->gb;
|
||||
int ret;
|
||||
|
||||
// Check for minimal intra MB size (considering mb header, luma & chroma dc VLC, ac EOB VLC)
|
||||
if (avpkt->size*8LL < (avctx->width+15)/16 * ((avctx->height+15)/16) * (2 + 3*4 + 2*2 + 2*6))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
ret = ff_get_buffer(avctx, frame, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -374,7 +374,7 @@ static int handle_crc(MPADecodeContext *s, int sec_len)
|
||||
crc_val = av_crc(crc_tab, crc_val, &buf[6], sec_byte_len);
|
||||
|
||||
AV_WB32(tmp_buf,
|
||||
((buf[6 + sec_byte_len] & (0xFF00U >> sec_rem_bits)) << 24) +
|
||||
((buf[6 + sec_byte_len] & (0xFF00 >> sec_rem_bits)) << 24) +
|
||||
((s->crc << 16) >> sec_rem_bits));
|
||||
|
||||
crc_val = av_crc(crc_tab, crc_val, tmp_buf, 3);
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
*/
|
||||
|
||||
#include "libavutil/thread.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "bytestream.h"
|
||||
@@ -478,9 +477,6 @@ static int mss4_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
|
||||
width, height);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (av_image_check_size2(width, height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (quality < 1 || quality > 100) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid quality setting %d\n", quality);
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -1083,9 +1083,8 @@ static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx)
|
||||
|
||||
av_log(avctx, AV_LOG_VERBOSE, "CQ(%d) mode enabled.\n", tmp_quality);
|
||||
|
||||
// CQ mode shall discard avg bitrate/vbv buffer size and honor only max bitrate
|
||||
//CQ mode shall discard avg bitrate & honor max bitrate;
|
||||
ctx->encode_config.rcParams.averageBitRate = avctx->bit_rate = 0;
|
||||
ctx->encode_config.rcParams.vbvBufferSize = avctx->rc_buffer_size = 0;
|
||||
ctx->encode_config.rcParams.maxBitRate = avctx->rc_max_rate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,6 +243,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
run = bytestream2_get_le16(&s->g);
|
||||
val = bytestream2_get_byte(&s->g);
|
||||
}
|
||||
if (!bytestream2_get_bytes_left(&s->g))
|
||||
break;
|
||||
|
||||
if (bits_per_plane == 8) {
|
||||
picmemset_8bpp(s, frame, val, run, &x, &y);
|
||||
|
||||
@@ -78,8 +78,11 @@ typedef struct PNGDecContext {
|
||||
enum PNGImageState pic_state;
|
||||
int width, height;
|
||||
int cur_w, cur_h;
|
||||
int last_w, last_h;
|
||||
int x_offset, y_offset;
|
||||
int last_x_offset, last_y_offset;
|
||||
uint8_t dispose_op, blend_op;
|
||||
uint8_t last_dispose_op;
|
||||
int bit_depth;
|
||||
int color_type;
|
||||
int compression_type;
|
||||
@@ -91,6 +94,8 @@ typedef struct PNGDecContext {
|
||||
int has_trns;
|
||||
uint8_t transparent_color_be[6];
|
||||
|
||||
uint8_t *background_buf;
|
||||
unsigned background_buf_allocated;
|
||||
uint32_t palette[256];
|
||||
uint8_t *crow_buf;
|
||||
uint8_t *last_row;
|
||||
@@ -322,7 +327,7 @@ void ff_png_filter_row(PNGDSPContext *dsp, uint8_t *dst, int filter_type,
|
||||
static void deloco_ ## NAME(TYPE *dst, int size, int alpha) \
|
||||
{ \
|
||||
int i; \
|
||||
for (i = 0; i < size - 2; i += 3 + alpha) { \
|
||||
for (i = 0; i < size; i += 3 + alpha) { \
|
||||
int g = dst [i + 1]; \
|
||||
dst[i + 0] += g; \
|
||||
dst[i + 2] += g; \
|
||||
@@ -720,30 +725,9 @@ static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s,
|
||||
}
|
||||
|
||||
ff_thread_release_ext_buffer(avctx, &s->picture);
|
||||
if (s->dispose_op == APNG_DISPOSE_OP_PREVIOUS) {
|
||||
/* We only need a buffer for the current picture. */
|
||||
ret = ff_thread_get_buffer(avctx, p, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else if (s->dispose_op == APNG_DISPOSE_OP_BACKGROUND) {
|
||||
/* We need a buffer for the current picture as well as
|
||||
* a buffer for the reference to retain. */
|
||||
ret = ff_thread_get_ext_buffer(avctx, &s->picture,
|
||||
AV_GET_BUFFER_FLAG_REF);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = ff_thread_get_buffer(avctx, p, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else {
|
||||
/* The picture output this time and the reference to retain coincide. */
|
||||
if ((ret = ff_thread_get_ext_buffer(avctx, &s->picture,
|
||||
AV_GET_BUFFER_FLAG_REF)) < 0)
|
||||
return ret;
|
||||
ret = av_frame_ref(p, s->picture.f);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
if ((ret = ff_thread_get_ext_buffer(avctx, &s->picture,
|
||||
AV_GET_BUFFER_FLAG_REF)) < 0)
|
||||
return ret;
|
||||
|
||||
p->pict_type = AV_PICTURE_TYPE_I;
|
||||
p->key_frame = 1;
|
||||
@@ -1001,6 +985,12 @@ static int decode_fctl_chunk(AVCodecContext *avctx, PNGDecContext *s,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
s->last_w = s->cur_w;
|
||||
s->last_h = s->cur_h;
|
||||
s->last_x_offset = s->x_offset;
|
||||
s->last_y_offset = s->y_offset;
|
||||
s->last_dispose_op = s->dispose_op;
|
||||
|
||||
sequence_number = bytestream2_get_be32(gb);
|
||||
cur_w = bytestream2_get_be32(gb);
|
||||
cur_h = bytestream2_get_be32(gb);
|
||||
@@ -1096,6 +1086,23 @@ static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s,
|
||||
|
||||
ff_thread_await_progress(&s->last_picture, INT_MAX, 0);
|
||||
|
||||
// need to reset a rectangle to background:
|
||||
if (s->last_dispose_op == APNG_DISPOSE_OP_BACKGROUND) {
|
||||
av_fast_malloc(&s->background_buf, &s->background_buf_allocated,
|
||||
src_stride * p->height);
|
||||
if (!s->background_buf)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
memcpy(s->background_buf, src, src_stride * p->height);
|
||||
|
||||
for (y = s->last_y_offset; y < s->last_y_offset + s->last_h; y++) {
|
||||
memset(s->background_buf + src_stride * y +
|
||||
bpp * s->last_x_offset, 0, bpp * s->last_w);
|
||||
}
|
||||
|
||||
src = s->background_buf;
|
||||
}
|
||||
|
||||
// copy unchanged rectangles from the last frame
|
||||
for (y = 0; y < s->y_offset; y++)
|
||||
memcpy(dst + y * dst_stride, src + y * src_stride, p->width * bpp);
|
||||
@@ -1164,22 +1171,6 @@ static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void apng_reset_background(PNGDecContext *s, const AVFrame *p)
|
||||
{
|
||||
// need to reset a rectangle to black
|
||||
av_unused int ret = av_frame_copy(s->picture.f, p);
|
||||
const int bpp = s->color_type == PNG_COLOR_TYPE_PALETTE ? 4 : s->bpp;
|
||||
const ptrdiff_t dst_stride = s->picture.f->linesize[0];
|
||||
uint8_t *dst = s->picture.f->data[0] + s->y_offset * dst_stride + bpp * s->x_offset;
|
||||
|
||||
av_assert1(ret >= 0);
|
||||
|
||||
for (size_t y = 0; y < s->cur_h; y++) {
|
||||
memset(dst, 0, bpp * s->cur_w);
|
||||
dst += dst_stride;
|
||||
}
|
||||
}
|
||||
|
||||
static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
|
||||
AVFrame *p, const AVPacket *avpkt)
|
||||
{
|
||||
@@ -1231,7 +1222,6 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
|
||||
}
|
||||
av_log(avctx, AV_LOG_ERROR, ", skipping\n");
|
||||
bytestream2_skip(&s->gb, length + 8); /* tag */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
tag = bytestream2_get_le32(&s->gb);
|
||||
@@ -1444,9 +1434,6 @@ exit_loop:
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
if (CONFIG_APNG_DECODER && s->dispose_op == APNG_DISPOSE_OP_BACKGROUND)
|
||||
apng_reset_background(s, p);
|
||||
|
||||
ff_thread_report_progress(&s->picture, INT_MAX, 0);
|
||||
|
||||
return 0;
|
||||
@@ -1469,10 +1456,15 @@ static void clear_frame_metadata(PNGDecContext *s)
|
||||
av_dict_free(&s->frame_metadata);
|
||||
}
|
||||
|
||||
static int output_frame(PNGDecContext *s, AVFrame *f)
|
||||
static int output_frame(PNGDecContext *s, AVFrame *f,
|
||||
const AVFrame *src)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = av_frame_ref(f, src);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (s->iccp_data) {
|
||||
AVFrameSideData *sd = av_frame_new_side_data(f, AV_FRAME_DATA_ICC_PROFILE, s->iccp_data_len);
|
||||
if (!sd) {
|
||||
@@ -1523,12 +1515,13 @@ fail:
|
||||
}
|
||||
|
||||
#if CONFIG_PNG_DECODER
|
||||
static int decode_frame_png(AVCodecContext *avctx, AVFrame *p,
|
||||
static int decode_frame_png(AVCodecContext *avctx, AVFrame *dst_frame,
|
||||
int *got_frame, AVPacket *avpkt)
|
||||
{
|
||||
PNGDecContext *const s = avctx->priv_data;
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
AVFrame *p = s->picture.f;
|
||||
int64_t sig;
|
||||
int ret;
|
||||
|
||||
@@ -1562,7 +1555,7 @@ static int decode_frame_png(AVCodecContext *avctx, AVFrame *p,
|
||||
goto the_end;
|
||||
}
|
||||
|
||||
ret = output_frame(s, p);
|
||||
ret = output_frame(s, dst_frame, s->picture.f);
|
||||
if (ret < 0)
|
||||
goto the_end;
|
||||
|
||||
@@ -1581,11 +1574,12 @@ the_end:
|
||||
#endif
|
||||
|
||||
#if CONFIG_APNG_DECODER
|
||||
static int decode_frame_apng(AVCodecContext *avctx, AVFrame *p,
|
||||
static int decode_frame_apng(AVCodecContext *avctx, AVFrame *dst_frame,
|
||||
int *got_frame, AVPacket *avpkt)
|
||||
{
|
||||
PNGDecContext *const s = avctx->priv_data;
|
||||
int ret;
|
||||
AVFrame *p = s->picture.f;
|
||||
|
||||
clear_frame_metadata(s);
|
||||
|
||||
@@ -1614,7 +1608,7 @@ static int decode_frame_apng(AVCodecContext *avctx, AVFrame *p,
|
||||
if (!(s->pic_state & (PNG_ALLIMAGE|PNG_IDAT)))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
ret = output_frame(s, p);
|
||||
ret = output_frame(s, dst_frame, s->picture.f);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -1652,9 +1646,15 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
|
||||
pdst->compression_type = psrc->compression_type;
|
||||
pdst->interlace_type = psrc->interlace_type;
|
||||
pdst->filter_type = psrc->filter_type;
|
||||
pdst->cur_w = psrc->cur_w;
|
||||
pdst->cur_h = psrc->cur_h;
|
||||
pdst->x_offset = psrc->x_offset;
|
||||
pdst->y_offset = psrc->y_offset;
|
||||
pdst->has_trns = psrc->has_trns;
|
||||
memcpy(pdst->transparent_color_be, psrc->transparent_color_be, sizeof(pdst->transparent_color_be));
|
||||
|
||||
pdst->dispose_op = psrc->dispose_op;
|
||||
|
||||
memcpy(pdst->palette, psrc->palette, sizeof(pdst->palette));
|
||||
|
||||
pdst->hdr_state |= psrc->hdr_state;
|
||||
@@ -1705,6 +1705,7 @@ static av_cold int png_dec_end(AVCodecContext *avctx)
|
||||
s->last_row_size = 0;
|
||||
av_freep(&s->tmp_row);
|
||||
s->tmp_row_size = 0;
|
||||
av_freep(&s->background_buf);
|
||||
|
||||
av_freep(&s->iccp_data);
|
||||
av_dict_free(&s->frame_metadata);
|
||||
|
||||
@@ -147,12 +147,6 @@ typedef struct FrameThreadContext {
|
||||
* Set for the first N packets, where N is the number of threads.
|
||||
* While it is set, ff_thread_en/decode_frame won't return any results.
|
||||
*/
|
||||
|
||||
/* hwaccel state is temporarily stored here in order to transfer its ownership
|
||||
* to the next decoding thread without the need for extra synchronization */
|
||||
const AVHWAccel *stash_hwaccel;
|
||||
void *stash_hwaccel_context;
|
||||
void *stash_hwaccel_priv;
|
||||
} FrameThreadContext;
|
||||
|
||||
#if FF_API_THREAD_SAFE_CALLBACKS
|
||||
@@ -233,17 +227,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
ff_thread_finish_setup(avctx);
|
||||
|
||||
if (p->hwaccel_serializing) {
|
||||
/* wipe hwaccel state to avoid stale pointers lying around;
|
||||
* the state was transferred to FrameThreadContext in
|
||||
* ff_thread_finish_setup(), so nothing is leaked */
|
||||
avctx->hwaccel = NULL;
|
||||
avctx->hwaccel_context = NULL;
|
||||
avctx->internal->hwaccel_priv_data = NULL;
|
||||
|
||||
p->hwaccel_serializing = 0;
|
||||
pthread_mutex_unlock(&p->parent->hwaccel_mutex);
|
||||
}
|
||||
av_assert0(!avctx->hwaccel);
|
||||
|
||||
if (p->async_serializing) {
|
||||
p->async_serializing = 0;
|
||||
@@ -307,6 +293,9 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src,
|
||||
dst->color_range = src->color_range;
|
||||
dst->chroma_sample_location = src->chroma_sample_location;
|
||||
|
||||
dst->hwaccel = src->hwaccel;
|
||||
dst->hwaccel_context = src->hwaccel_context;
|
||||
|
||||
dst->sample_rate = src->sample_rate;
|
||||
dst->sample_fmt = src->sample_fmt;
|
||||
#if FF_API_OLD_CHANNEL_LAYOUT
|
||||
@@ -319,6 +308,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
dst->internal->hwaccel_priv_data = src->internal->hwaccel_priv_data;
|
||||
|
||||
if (!!dst->hw_frames_ctx != !!src->hw_frames_ctx ||
|
||||
(dst->hw_frames_ctx && dst->hw_frames_ctx->data != src->hw_frames_ctx->data)) {
|
||||
av_buffer_unref(&dst->hw_frames_ctx);
|
||||
@@ -460,12 +451,6 @@ static int submit_packet(PerThreadContext *p, AVCodecContext *user_avctx,
|
||||
}
|
||||
}
|
||||
|
||||
/* transfer the stashed hwaccel state, if any */
|
||||
av_assert0(!p->avctx->hwaccel);
|
||||
FFSWAP(const AVHWAccel*, p->avctx->hwaccel, fctx->stash_hwaccel);
|
||||
FFSWAP(void*, p->avctx->hwaccel_context, fctx->stash_hwaccel_context);
|
||||
FFSWAP(void*, p->avctx->internal->hwaccel_priv_data, fctx->stash_hwaccel_priv);
|
||||
|
||||
av_packet_unref(p->avpkt);
|
||||
ret = av_packet_ref(p->avpkt, avpkt);
|
||||
if (ret < 0) {
|
||||
@@ -669,14 +654,6 @@ void ff_thread_finish_setup(AVCodecContext *avctx) {
|
||||
async_lock(p->parent);
|
||||
}
|
||||
|
||||
/* save hwaccel state for passing to the next thread;
|
||||
* this is done here so that this worker thread can wipe its own hwaccel
|
||||
* state after decoding, without requiring synchronization */
|
||||
av_assert0(!p->parent->stash_hwaccel);
|
||||
p->parent->stash_hwaccel = avctx->hwaccel;
|
||||
p->parent->stash_hwaccel_context = avctx->hwaccel_context;
|
||||
p->parent->stash_hwaccel_priv = avctx->internal->hwaccel_priv_data;
|
||||
|
||||
pthread_mutex_lock(&p->progress_mutex);
|
||||
if(atomic_load(&p->state) == STATE_SETUP_FINISHED){
|
||||
av_log(avctx, AV_LOG_WARNING, "Multiple ff_thread_finish_setup() calls\n");
|
||||
@@ -730,6 +707,13 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
|
||||
|
||||
park_frame_worker_threads(fctx, thread_count);
|
||||
|
||||
if (fctx->prev_thread && avctx->internal->hwaccel_priv_data !=
|
||||
fctx->prev_thread->avctx->internal->hwaccel_priv_data) {
|
||||
if (update_context_from_thread(avctx, fctx->prev_thread->avctx, 1) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Failed to update user thread.\n");
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < thread_count; i++) {
|
||||
PerThreadContext *p = &fctx->threads[i];
|
||||
AVCodecContext *ctx = p->avctx;
|
||||
@@ -776,13 +760,6 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
|
||||
av_freep(&fctx->threads);
|
||||
ff_pthread_free(fctx, thread_ctx_offsets);
|
||||
|
||||
/* if we have stashed hwaccel state, move it to the user-facing context,
|
||||
* so it will be freed in avcodec_close() */
|
||||
av_assert0(!avctx->hwaccel);
|
||||
FFSWAP(const AVHWAccel*, avctx->hwaccel, fctx->stash_hwaccel);
|
||||
FFSWAP(void*, avctx->hwaccel_context, fctx->stash_hwaccel_context);
|
||||
FFSWAP(void*, avctx->internal->hwaccel_priv_data, fctx->stash_hwaccel_priv);
|
||||
|
||||
av_freep(&avctx->internal->thread_ctx);
|
||||
}
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ static void get_max_component_diff(BlockInfo *bi, uint16_t *block_ptr,
|
||||
|
||||
// loop thru and compare pixels
|
||||
for (y = 0; y < bi->block_height; y++) {
|
||||
for (x = 0; x < bi->block_width; x++) {
|
||||
for (x = 0; x < bi->block_width; x++){
|
||||
// TODO: optimize
|
||||
min_r = FFMIN(R(block_ptr[x]), min_r);
|
||||
min_g = FFMIN(G(block_ptr[x]), min_g);
|
||||
@@ -277,7 +277,7 @@ static int leastsquares(uint16_t *block_ptr, BlockInfo *bi,
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < bi->block_height; i++) {
|
||||
for (j = 0; j < bi->block_width; j++) {
|
||||
for (j = 0; j < bi->block_width; j++){
|
||||
x = GET_CHAN(block_ptr[j], xchannel);
|
||||
y = GET_CHAN(block_ptr[j], ychannel);
|
||||
sumx += x;
|
||||
@@ -324,7 +324,7 @@ static int calc_lsq_max_fit_error(uint16_t *block_ptr, BlockInfo *bi,
|
||||
int max_err = 0;
|
||||
|
||||
for (i = 0; i < bi->block_height; i++) {
|
||||
for (j = 0; j < bi->block_width; j++) {
|
||||
for (j = 0; j < bi->block_width; j++){
|
||||
int x_inc, lin_y, lin_x;
|
||||
x = GET_CHAN(block_ptr[j], xchannel);
|
||||
y = GET_CHAN(block_ptr[j], ychannel);
|
||||
@@ -419,9 +419,7 @@ static void update_block_in_prev_frame(const uint16_t *src_pixels,
|
||||
uint16_t *dest_pixels,
|
||||
const BlockInfo *bi, int block_counter)
|
||||
{
|
||||
const int y_size = FFMIN(4, bi->image_height - bi->row * 4);
|
||||
|
||||
for (int y = 0; y < y_size; y++) {
|
||||
for (int y = 0; y < 4; y++) {
|
||||
memcpy(dest_pixels, src_pixels, 8);
|
||||
dest_pixels += bi->rowstride;
|
||||
src_pixels += bi->rowstride;
|
||||
@@ -731,15 +729,14 @@ post_skip :
|
||||
|
||||
if (err > s->sixteen_color_thresh) { // DO SIXTEEN COLOR BLOCK
|
||||
uint16_t *row_ptr;
|
||||
int y_size, rgb555;
|
||||
int rgb555;
|
||||
|
||||
block_offset = get_block_info(&bi, block_counter);
|
||||
|
||||
row_ptr = &src_pixels[block_offset];
|
||||
y_size = FFMIN(4, bi.image_height - bi.row * 4);
|
||||
|
||||
for (int y = 0; y < y_size; y++) {
|
||||
for (int x = 0; x < 4; x++) {
|
||||
for (int y = 0; y < 4; y++) {
|
||||
for (int x = 0; x < 4; x++){
|
||||
rgb555 = row_ptr[x] & ~0x8000;
|
||||
|
||||
put_bits(&s->pb, 16, rgb555);
|
||||
@@ -747,11 +744,6 @@ post_skip :
|
||||
row_ptr += bi.rowstride;
|
||||
}
|
||||
|
||||
for (int y = y_size; y < 4; y++) {
|
||||
for (int x = 0; x < 4; x++)
|
||||
put_bits(&s->pb, 16, 0);
|
||||
}
|
||||
|
||||
block_counter++;
|
||||
} else { // FOUR COLOR BLOCK
|
||||
block_counter += encode_four_color_block(min_color, max_color,
|
||||
|
||||
@@ -460,9 +460,6 @@ static int decompress_p(AVCodecContext *avctx,
|
||||
int run, bx = x * 16 + sx1, by = y * 16 + sy1;
|
||||
uint32_t r, g, b, clr, ptype = 0;
|
||||
|
||||
if (bx >= avctx->width)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
for (; by < y * 16 + sy2 && by < avctx->height;) {
|
||||
ret = decode_value(s, s->op_model[ptype], 6, 1000, &ptype);
|
||||
if (ret < 0)
|
||||
|
||||
@@ -1168,9 +1168,6 @@ static int decompress_p3(AVCodecContext *avctx,
|
||||
int run, bx = x * 16 + sx1, by = y * 16 + sy1;
|
||||
uint32_t clr, ptype = 0, r, g, b;
|
||||
|
||||
if (bx >= avctx->width)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
for (; by < y * 16 + sy2 && by < avctx->height;) {
|
||||
ret = decode_value3(s, 5, &s->op_model3[ptype].cntsum,
|
||||
s->op_model3[ptype].freqs[0],
|
||||
|
||||
@@ -61,7 +61,6 @@ typedef struct SMCContext {
|
||||
{ \
|
||||
row_ptr += stride * 4; \
|
||||
pixel_ptr = row_ptr; \
|
||||
cur_y += 4; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
@@ -118,7 +117,6 @@ static void smc_encode_stream(SMCContext *s, const AVFrame *frame,
|
||||
const uint8_t *prev_pixels = (const uint8_t *)s->prev_frame->data[0];
|
||||
uint8_t *distinct_values = s->distinct_values;
|
||||
const uint8_t *pixel_ptr, *row_ptr;
|
||||
const int height = frame->height;
|
||||
const int width = frame->width;
|
||||
uint8_t block_values[16];
|
||||
int block_counter = 0;
|
||||
@@ -127,14 +125,13 @@ static void smc_encode_stream(SMCContext *s, const AVFrame *frame,
|
||||
int color_octet_index = 0;
|
||||
int color_table_index; /* indexes to color pair, quad, or octet tables */
|
||||
int total_blocks;
|
||||
int cur_y = 0;
|
||||
|
||||
memset(s->color_pairs, 0, sizeof(s->color_pairs));
|
||||
memset(s->color_quads, 0, sizeof(s->color_quads));
|
||||
memset(s->color_octets, 0, sizeof(s->color_octets));
|
||||
|
||||
/* Number of 4x4 blocks in frame. */
|
||||
total_blocks = ((width + 3) / 4) * ((height + 3) / 4);
|
||||
total_blocks = ((frame->width + 3) / 4) * ((frame->height + 3) / 4);
|
||||
|
||||
pixel_ptr = row_ptr = src_pixels;
|
||||
|
||||
@@ -148,13 +145,11 @@ static void smc_encode_stream(SMCContext *s, const AVFrame *frame,
|
||||
int cache_index;
|
||||
int distinct = 0;
|
||||
int blocks = 0;
|
||||
int frame_y = cur_y;
|
||||
|
||||
while (prev_pixels && s->key_frame == 0 && block_counter + inter_skip_blocks < total_blocks) {
|
||||
const int y_size = FFMIN(4, height - cur_y);
|
||||
int compare = 0;
|
||||
|
||||
for (int y = 0; y < y_size; y++) {
|
||||
for (int y = 0; y < 4; y++) {
|
||||
const ptrdiff_t offset = pixel_ptr - src_pixels;
|
||||
const uint8_t *prev_pixel_ptr = prev_pixels + offset;
|
||||
|
||||
@@ -175,10 +170,8 @@ static void smc_encode_stream(SMCContext *s, const AVFrame *frame,
|
||||
|
||||
pixel_ptr = xpixel_ptr;
|
||||
row_ptr = xrow_ptr;
|
||||
cur_y = frame_y;
|
||||
|
||||
while (block_counter > 0 && block_counter + intra_skip_blocks < total_blocks) {
|
||||
const int y_size = FFMIN(4, height - cur_y);
|
||||
const ptrdiff_t offset = pixel_ptr - src_pixels;
|
||||
const int sy = offset / stride;
|
||||
const int sx = offset % stride;
|
||||
@@ -187,7 +180,7 @@ static void smc_encode_stream(SMCContext *s, const AVFrame *frame,
|
||||
const uint8_t *old_pixel_ptr = src_pixels + nx + ny * stride;
|
||||
int compare = 0;
|
||||
|
||||
for (int y = 0; y < y_size; y++) {
|
||||
for (int y = 0; y < 4; y++) {
|
||||
compare |= memcmp(old_pixel_ptr + y * stride, pixel_ptr + y * stride, 4);
|
||||
if (compare)
|
||||
break;
|
||||
@@ -204,11 +197,9 @@ static void smc_encode_stream(SMCContext *s, const AVFrame *frame,
|
||||
|
||||
pixel_ptr = xpixel_ptr;
|
||||
row_ptr = xrow_ptr;
|
||||
cur_y = frame_y;
|
||||
|
||||
while (block_counter + coded_blocks < total_blocks && coded_blocks < 256) {
|
||||
const int y_size = FFMIN(4, height - cur_y);
|
||||
for (int y = 0; y < y_size; y++)
|
||||
for (int y = 0; y < 4; y++)
|
||||
memcpy(block_values + y * 4, pixel_ptr + y * stride, 4);
|
||||
|
||||
qsort(block_values, 16, sizeof(block_values[0]), smc_cmp_values);
|
||||
@@ -233,7 +224,6 @@ static void smc_encode_stream(SMCContext *s, const AVFrame *frame,
|
||||
|
||||
pixel_ptr = xpixel_ptr;
|
||||
row_ptr = xrow_ptr;
|
||||
cur_y = frame_y;
|
||||
|
||||
blocks = coded_blocks;
|
||||
distinct = coded_distinct;
|
||||
|
||||
@@ -1533,10 +1533,10 @@ static void calculate_visual_weight(SnowContext *s, Plane *p){
|
||||
int level, orientation, x, y;
|
||||
|
||||
for(level=0; level<s->spatial_decomposition_count; level++){
|
||||
int64_t error=0;
|
||||
for(orientation=level ? 1 : 0; orientation<4; orientation++){
|
||||
SubBand *b= &p->band[level][orientation];
|
||||
IDWTELEM *ibuf= b->ibuf;
|
||||
int64_t error=0;
|
||||
|
||||
memset(s->spatial_idwt_buffer, 0, sizeof(*s->spatial_idwt_buffer)*width*height);
|
||||
ibuf[b->width/2 + b->height/2*b->stride]= 256*16;
|
||||
@@ -1547,13 +1547,9 @@ static void calculate_visual_weight(SnowContext *s, Plane *p){
|
||||
error += d*d;
|
||||
}
|
||||
}
|
||||
if (orientation == 2)
|
||||
error /= 2;
|
||||
|
||||
b->qlog= (int)(QROOT * log2(352256.0/sqrt(error)) + 0.5);
|
||||
if (orientation != 1)
|
||||
error = 0;
|
||||
}
|
||||
p->band[level][1].qlog = p->band[level][2].qlog;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -499,9 +499,7 @@ static int speedhq_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
uint32_t second_field_offset;
|
||||
int ret;
|
||||
|
||||
if (buf_size < 4 || avctx->width < 8 || avctx->width % 8 != 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (buf_size < avctx->width*avctx->height / 64 / 4)
|
||||
if (buf_size < 4 || avctx->width < 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
quality = buf[0];
|
||||
|
||||
@@ -1452,7 +1452,7 @@ static av_cold int speex_decode_init(AVCodecContext *avctx)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
s->nb_channels = avctx->ch_layout.nb_channels;
|
||||
if (s->nb_channels <= 0 || s->nb_channels > 2)
|
||||
if (s->nb_channels <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
switch (s->rate) {
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
@@ -76,12 +75,6 @@ static int sunrast_decode_frame(AVCodecContext *avctx, AVFrame *p,
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
if (maplength > 768) {
|
||||
av_log(avctx, AV_LOG_WARNING, "invalid colormap length\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
// This also checks depth to be valid
|
||||
switch (depth) {
|
||||
case 1:
|
||||
avctx->pix_fmt = maplength ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_MONOWHITE;
|
||||
@@ -103,23 +96,15 @@ static int sunrast_decode_frame(AVCodecContext *avctx, AVFrame *p,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
// This checks w and h to be valid in the sense that bytes of a padded bitmap are addressable with 32bit int
|
||||
ret = ff_set_dimensions(avctx, w, h);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
// ensured by ff_set_dimensions()
|
||||
av_assert0(w <= (INT32_MAX - 7) / depth);
|
||||
|
||||
/* scanlines are aligned on 16 bit boundaries */
|
||||
len = (depth * w + 7) >> 3;
|
||||
alen = len + (len & 1);
|
||||
|
||||
// ensured by ff_set_dimensions()
|
||||
av_assert0(h <= INT32_MAX / (3 * len));
|
||||
|
||||
// maplength is limited to 768 and the right term is limited to INT32_MAX / 256 so the add needs no check
|
||||
if (buf_end - buf < (uint64_t)maplength + (len * h) * 3 / 256)
|
||||
if (buf_end - buf < maplength + (len * h) * 3 / 256)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
|
||||
@@ -133,7 +118,7 @@ static int sunrast_decode_frame(AVCodecContext *avctx, AVFrame *p,
|
||||
} else if (maplength) {
|
||||
unsigned int len = maplength / 3;
|
||||
|
||||
if (maplength % 3) {
|
||||
if (maplength % 3 || maplength > 768) {
|
||||
av_log(avctx, AV_LOG_WARNING, "invalid colormap length\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@@ -31,13 +31,11 @@ int main(void){
|
||||
#define width 256
|
||||
#define height 256
|
||||
int buffer[2][width*height];
|
||||
short obuffer[width*height];
|
||||
SnowContext s;
|
||||
int i;
|
||||
AVLFG prng;
|
||||
s.spatial_decomposition_count=6;
|
||||
s.spatial_decomposition_type=1;
|
||||
int ret = 0;
|
||||
|
||||
s.temp_dwt_buffer = av_calloc(width, sizeof(*s.temp_dwt_buffer));
|
||||
s.temp_idwt_buffer = av_calloc(width, sizeof(*s.temp_idwt_buffer));
|
||||
@@ -51,34 +49,24 @@ int main(void){
|
||||
|
||||
printf("testing 5/3 DWT\n");
|
||||
for(i=0; i<width*height; i++)
|
||||
buffer[0][i] = buffer[1][i] = av_lfg_get(&prng) % 19000 - 9000;
|
||||
buffer[0][i] = buffer[1][i] = av_lfg_get(&prng) % 54321 - 12345;
|
||||
|
||||
ff_spatial_dwt(buffer[0], s.temp_dwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
|
||||
for(i=0; i<width*height; i++)
|
||||
obuffer[i] = buffer[0][i];
|
||||
ff_spatial_idwt(obuffer, s.temp_idwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
|
||||
ff_spatial_idwt((IDWTELEM*)buffer[0], s.temp_idwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
|
||||
|
||||
for(i=0; i<width*height; i++)
|
||||
if(buffer[1][i]!= obuffer[i]) {
|
||||
printf("fsck: %4dx%4dx %12d %7d\n",i%width, i/width, buffer[1][i], obuffer[i]);
|
||||
ret = 1;
|
||||
}
|
||||
if(buffer[0][i]!= buffer[1][i]) printf("fsck: %6d %12d %7d\n",i, buffer[0][i], buffer[1][i]);
|
||||
|
||||
printf("testing 9/7 DWT\n");
|
||||
s.spatial_decomposition_type=0;
|
||||
for(i=0; i<width*height; i++)
|
||||
buffer[0][i] = buffer[1][i] = av_lfg_get(&prng) % 11000 - 5000;
|
||||
buffer[0][i] = buffer[1][i] = av_lfg_get(&prng) % 54321 - 12345;
|
||||
|
||||
ff_spatial_dwt(buffer[0], s.temp_dwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
|
||||
for(i=0; i<width*height; i++)
|
||||
obuffer[i] = buffer[0][i];
|
||||
ff_spatial_idwt(obuffer, s.temp_idwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
|
||||
ff_spatial_idwt((IDWTELEM*)buffer[0], s.temp_idwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
|
||||
|
||||
for(i=0; i<width*height; i++)
|
||||
if(FFABS(buffer[1][i] - obuffer[i])>20) {
|
||||
printf("fsck: %4dx%4d %12d %7d\n",i%width, i/width, buffer[1][i], obuffer[i]);
|
||||
ret = 1;
|
||||
}
|
||||
if(FFABS(buffer[0][i] - buffer[1][i])>20) printf("fsck: %6d %12d %7d\n",i, buffer[0][i], buffer[1][i]);
|
||||
|
||||
{
|
||||
int level, orientation, x, y;
|
||||
@@ -93,18 +81,18 @@ int main(void){
|
||||
int w= width >> (s.spatial_decomposition_count-level);
|
||||
int h= height >> (s.spatial_decomposition_count-level);
|
||||
int stride= width << (s.spatial_decomposition_count-level);
|
||||
IDWTELEM *buf= obuffer;
|
||||
DWTELEM *buf= buffer[0];
|
||||
int64_t error=0;
|
||||
|
||||
if(orientation&1) buf+=w;
|
||||
if(orientation>1) buf+=stride>>1;
|
||||
|
||||
memset(obuffer, 0, sizeof(short)*width*height);
|
||||
buf[w/2 + h/2*stride]= 8*256;
|
||||
ff_spatial_idwt(obuffer, s.temp_idwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
|
||||
memset(buffer[0], 0, sizeof(int)*width*height);
|
||||
buf[w/2 + h/2*stride]= 256*256;
|
||||
ff_spatial_idwt((IDWTELEM*)buffer[0], s.temp_idwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
|
||||
for(y=0; y<height; y++){
|
||||
for(x=0; x<width; x++){
|
||||
int64_t d= obuffer[x + y*width];
|
||||
int64_t d= buffer[0][x + y*width];
|
||||
error += d*d;
|
||||
if(FFABS(width/2-x)<9 && FFABS(height/2-y)<9 && level==2) printf("%8"PRId64" ", d);
|
||||
}
|
||||
@@ -144,5 +132,5 @@ int main(void){
|
||||
}
|
||||
|
||||
}
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@ typedef struct TiffContext {
|
||||
int is_tiled;
|
||||
int tile_byte_counts_offset, tile_offsets_offset;
|
||||
int tile_width, tile_length;
|
||||
int tile_count;
|
||||
|
||||
int is_jpeg;
|
||||
|
||||
@@ -964,9 +965,6 @@ static int dng_decode_tiles(AVCodecContext *avctx, AVFrame *frame,
|
||||
int pos_x = 0, pos_y = 0;
|
||||
int ret;
|
||||
|
||||
if (s->tile_width <= 0 || s->tile_length <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
has_width_leftover = (s->width % s->tile_width != 0);
|
||||
has_height_leftover = (s->height % s->tile_length != 0);
|
||||
|
||||
@@ -975,7 +973,7 @@ static int dng_decode_tiles(AVCodecContext *avctx, AVFrame *frame,
|
||||
tile_count_y = (s->height + s->tile_length - 1) / s->tile_length;
|
||||
|
||||
/* Iterate over the number of tiles */
|
||||
for (tile_idx = 0; tile_idx < tile_count_x * tile_count_y; tile_idx++) {
|
||||
for (tile_idx = 0; tile_idx < s->tile_count; tile_idx++) {
|
||||
tile_x = tile_idx % tile_count_x;
|
||||
tile_y = tile_idx / tile_count_x;
|
||||
|
||||
@@ -1395,6 +1393,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
|
||||
break;
|
||||
case TIFF_TILE_OFFSETS:
|
||||
s->tile_offsets_offset = off;
|
||||
s->tile_count = count;
|
||||
s->is_tiled = 1;
|
||||
break;
|
||||
case TIFF_TILE_BYTE_COUNTS:
|
||||
@@ -1748,7 +1747,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
|
||||
int *got_frame, AVPacket *avpkt)
|
||||
{
|
||||
TiffContext *const s = avctx->priv_data;
|
||||
unsigned off, last_off = 0;
|
||||
unsigned off, last_off;
|
||||
int le, ret, plane, planes;
|
||||
int i, j, entries, stride;
|
||||
unsigned soff, ssize;
|
||||
@@ -1813,6 +1812,7 @@ again:
|
||||
/** whether we should process this multi-page IFD's next page */
|
||||
retry_for_page = s->get_page && s->cur_page + 1 < s->get_page; // get_page is 1-indexed
|
||||
|
||||
last_off = off;
|
||||
if (retry_for_page) {
|
||||
// set offset to the next IFD
|
||||
off = ff_tget_long(&s->gb, le);
|
||||
@@ -1830,7 +1830,6 @@ again:
|
||||
avpriv_request_sample(s->avctx, "non increasing IFD offset");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
last_off = off;
|
||||
if (off >= UINT_MAX - 14 || avpkt->size < off + 14) {
|
||||
av_log(avctx, AV_LOG_ERROR, "IFD offset is greater than image size\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -1887,7 +1886,7 @@ again:
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
has_tile_bits = s->is_tiled || s->tile_byte_counts_offset || s->tile_offsets_offset || s->tile_width || s->tile_length;
|
||||
has_tile_bits = s->is_tiled || s->tile_byte_counts_offset || s->tile_offsets_offset || s->tile_width || s->tile_length || s->tile_count;
|
||||
has_strip_bits = s->strippos || s->strips || s->stripoff || s->rps || s->sot || s->sstype || s->stripsize || s->stripsizesoff;
|
||||
|
||||
if (has_tile_bits && has_strip_bits) {
|
||||
|
||||
@@ -377,15 +377,8 @@ static int tta_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
case 3: {
|
||||
// shift samples for 24-bit sample format
|
||||
int32_t *samples = (int32_t *)frame->data[0];
|
||||
int overflow = 0;
|
||||
|
||||
for (i = 0; i < framelen * s->channels; i++) {
|
||||
int scaled = *samples * 256U;
|
||||
overflow += (scaled >> 8 != *samples);
|
||||
*samples++ = scaled;
|
||||
}
|
||||
if (overflow)
|
||||
av_log(avctx, AV_LOG_WARNING, "%d overflows occurred on 24bit upscale\n", overflow);
|
||||
for (i = 0; i < framelen * s->channels; i++)
|
||||
*samples++ *= 256;
|
||||
// reset decode buffer
|
||||
s->decode_buffer = NULL;
|
||||
break;
|
||||
|
||||
@@ -242,8 +242,6 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||
case AV_PIX_FMT_GBRAP16BE:
|
||||
w_align = 16; //FIXME assume 16 pixel per macroblock
|
||||
h_align = 16 * 2; // interlaced needs 2 macroblocks height
|
||||
if (s->codec_id == AV_CODEC_ID_BINKVIDEO)
|
||||
w_align = 16*2;
|
||||
break;
|
||||
case AV_PIX_FMT_YUV411P:
|
||||
case AV_PIX_FMT_YUVJ411P:
|
||||
@@ -322,7 +320,6 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||
*width = FFALIGN(*width, w_align);
|
||||
*height = FFALIGN(*height, h_align);
|
||||
if (s->codec_id == AV_CODEC_ID_H264 || s->lowres ||
|
||||
s->codec_id == AV_CODEC_ID_VC1 || s->codec_id == AV_CODEC_ID_WMV3 ||
|
||||
s->codec_id == AV_CODEC_ID_VP5 || s->codec_id == AV_CODEC_ID_VP6 ||
|
||||
s->codec_id == AV_CODEC_ID_VP6F || s->codec_id == AV_CODEC_ID_VP6A
|
||||
) {
|
||||
@@ -336,9 +333,6 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||
// the next rounded up width is 32
|
||||
*width = FFMAX(*width, 32);
|
||||
}
|
||||
if (s->codec_id == AV_CODEC_ID_SVQ3) {
|
||||
*width = FFMAX(*width, 32);
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
linesize_align[i] = STRIDE_ALIGN;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "version_major.h"
|
||||
|
||||
#define LIBAVCODEC_VERSION_MINOR 37
|
||||
#define LIBAVCODEC_VERSION_MINOR 38
|
||||
#define LIBAVCODEC_VERSION_MICRO 100
|
||||
|
||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||
|
||||
@@ -64,7 +64,7 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
|
||||
av_assert2(start_x < end_x && block_w);
|
||||
|
||||
w = end_x - start_x;
|
||||
src += start_y * src_linesize + start_x * (ptrdiff_t)sizeof(pixel);
|
||||
src += start_y * src_linesize + start_x * sizeof(pixel);
|
||||
buf += start_x * sizeof(pixel);
|
||||
|
||||
// top
|
||||
@@ -87,7 +87,7 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
|
||||
buf += buf_linesize;
|
||||
}
|
||||
|
||||
buf -= block_h * buf_linesize + start_x * (ptrdiff_t)sizeof(pixel);
|
||||
buf -= block_h * buf_linesize + start_x * sizeof(pixel);
|
||||
while (block_h--) {
|
||||
pixel *bufp = (pixel *) buf;
|
||||
|
||||
|
||||
@@ -690,7 +690,8 @@ static void videotoolbox_decoder_callback(void *opaque,
|
||||
CMTime pts,
|
||||
CMTime duration)
|
||||
{
|
||||
VTContext *vtctx = opaque;
|
||||
AVCodecContext *avctx = opaque;
|
||||
VTContext *vtctx = avctx->internal->hwaccel_priv_data;
|
||||
|
||||
if (vtctx->frame) {
|
||||
CVPixelBufferRelease(vtctx->frame);
|
||||
@@ -698,8 +699,7 @@ static void videotoolbox_decoder_callback(void *opaque,
|
||||
}
|
||||
|
||||
if (!image_buffer) {
|
||||
av_log(vtctx->logctx, status ? AV_LOG_WARNING : AV_LOG_DEBUG,
|
||||
"vt decoder cb: output image buffer is null: %i\n", status);
|
||||
av_log(avctx, status ? AV_LOG_WARNING : AV_LOG_DEBUG, "vt decoder cb: output image buffer is null: %i\n", status);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -949,7 +949,7 @@ static int videotoolbox_start(AVCodecContext *avctx)
|
||||
videotoolbox->cv_pix_fmt_type);
|
||||
|
||||
decoder_cb.decompressionOutputCallback = videotoolbox_decoder_callback;
|
||||
decoder_cb.decompressionOutputRefCon = avctx->internal->hwaccel_priv_data;
|
||||
decoder_cb.decompressionOutputRefCon = avctx;
|
||||
|
||||
status = VTDecompressionSessionCreate(NULL, // allocator
|
||||
videotoolbox->cm_fmt_desc, // videoFormatDescription
|
||||
@@ -1179,8 +1179,6 @@ int ff_videotoolbox_common_init(AVCodecContext *avctx)
|
||||
AVHWFramesContext *hw_frames;
|
||||
int err;
|
||||
|
||||
vtctx->logctx = avctx;
|
||||
|
||||
// Old API - do nothing.
|
||||
if (avctx->hwaccel_context)
|
||||
return 0;
|
||||
|
||||
@@ -45,8 +45,6 @@ typedef struct VTContext {
|
||||
// Current H264 parameters (used to trigger decoder restart on SPS changes).
|
||||
uint8_t sps[3];
|
||||
bool reconfig_needed;
|
||||
|
||||
void *logctx;
|
||||
} VTContext;
|
||||
|
||||
int ff_videotoolbox_alloc_frame(AVCodecContext *avctx, AVFrame *frame);
|
||||
|
||||
@@ -129,7 +129,7 @@ static av_always_inline unsigned get_tail(GetBitContext *gb, int k)
|
||||
e = (1 << (p + 1)) - k - 1;
|
||||
res = get_bitsz(gb, p);
|
||||
if (res >= e)
|
||||
res = res * 2U - e + get_bits1(gb);
|
||||
res = (res << 1) - e + get_bits1(gb);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -499,8 +499,6 @@ static int wv_unpack_dsd_high(WavpackFrameContext *s, uint8_t *dst_left, uint8_t
|
||||
sp[0].fltr0 = 0;
|
||||
}
|
||||
|
||||
if (DSD_BYTE_READY(high, low) && !bytestream2_get_bytes_left(&s->gbyte))
|
||||
return AVERROR_INVALIDDATA;
|
||||
while (DSD_BYTE_READY(high, low) && bytestream2_get_bytes_left(&s->gbyte)) {
|
||||
value = (value << 8) | bytestream2_get_byte(&s->gbyte);
|
||||
high = (high << 8) | 0xff;
|
||||
@@ -536,8 +534,6 @@ static int wv_unpack_dsd_high(WavpackFrameContext *s, uint8_t *dst_left, uint8_t
|
||||
sp[1].fltr0 = 0;
|
||||
}
|
||||
|
||||
if (DSD_BYTE_READY(high, low) && !bytestream2_get_bytes_left(&s->gbyte))
|
||||
return AVERROR_INVALIDDATA;
|
||||
while (DSD_BYTE_READY(high, low) && bytestream2_get_bytes_left(&s->gbyte)) {
|
||||
value = (value << 8) | bytestream2_get_byte(&s->gbyte);
|
||||
high = (high << 8) | 0xff;
|
||||
|
||||
@@ -355,9 +355,6 @@ static int xpm_decode_frame(AVCodecContext *avctx, AVFrame *p,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (size > SIZE_MAX / 4)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
size *= 4;
|
||||
|
||||
ptr += mod_strcspn(ptr, ",") + 1;
|
||||
|
||||
@@ -75,11 +75,9 @@ int avdevice_list_devices(AVFormatContext *s, AVDeviceInfoList **device_list)
|
||||
ret = s->oformat->get_device_list(s, *device_list);
|
||||
else
|
||||
ret = s->iformat->get_device_list(s, *device_list);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
avdevice_free_list_devices(device_list);
|
||||
return ret;
|
||||
}
|
||||
return (*device_list)->nb_devices;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int list_devices_for_context(AVFormatContext *s, AVDictionary *options,
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "version_major.h"
|
||||
|
||||
#define LIBAVDEVICE_VERSION_MINOR 7
|
||||
#define LIBAVDEVICE_VERSION_MINOR 8
|
||||
#define LIBAVDEVICE_VERSION_MICRO 100
|
||||
|
||||
#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include "version_major.h"
|
||||
|
||||
#define LIBAVFILTER_VERSION_MINOR 44
|
||||
#define LIBAVFILTER_VERSION_MINOR 45
|
||||
#define LIBAVFILTER_VERSION_MICRO 100
|
||||
|
||||
|
||||
|
||||
@@ -491,19 +491,19 @@ static int config_props(AVFilterLink *outlink)
|
||||
if ((ret = scale_eval_dimensions(ctx)) < 0)
|
||||
goto fail;
|
||||
|
||||
outlink->w = scale->w;
|
||||
outlink->h = scale->h;
|
||||
|
||||
ff_scale_adjust_dimensions(inlink, &outlink->w, &outlink->h,
|
||||
ff_scale_adjust_dimensions(inlink, &scale->w, &scale->h,
|
||||
scale->force_original_aspect_ratio,
|
||||
scale->force_divisible_by);
|
||||
|
||||
if (outlink->w > INT_MAX ||
|
||||
outlink->h > INT_MAX ||
|
||||
(outlink->h * inlink->w) > INT_MAX ||
|
||||
(outlink->w * inlink->h) > INT_MAX)
|
||||
if (scale->w > INT_MAX ||
|
||||
scale->h > INT_MAX ||
|
||||
(scale->h * inlink->w) > INT_MAX ||
|
||||
(scale->w * inlink->h) > INT_MAX)
|
||||
av_log(ctx, AV_LOG_ERROR, "Rescaled value for width or height is too big.\n");
|
||||
|
||||
outlink->w = scale->w;
|
||||
outlink->h = scale->h;
|
||||
|
||||
/* TODO: make algorithm configurable */
|
||||
|
||||
scale->input_is_pal = desc->flags & AV_PIX_FMT_FLAG_PAL;
|
||||
@@ -718,9 +718,9 @@ static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out)
|
||||
goto scale;
|
||||
|
||||
if (scale->eval_mode == EVAL_MODE_INIT) {
|
||||
snprintf(buf, sizeof(buf) - 1, "%d", scale->w);
|
||||
snprintf(buf, sizeof(buf)-1, "%d", outlink->w);
|
||||
av_opt_set(scale, "w", buf, 0);
|
||||
snprintf(buf, sizeof(buf) - 1, "%d", scale->h);
|
||||
snprintf(buf, sizeof(buf)-1, "%d", outlink->h);
|
||||
av_opt_set(scale, "h", buf, 0);
|
||||
|
||||
ret = scale_parse_expr(ctx, NULL, &scale->w_pexpr, "width", scale->w_expr);
|
||||
|
||||
@@ -730,15 +730,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
||||
av_log(ctx, AV_LOG_INFO, " %08"PRIX32, plane_checksum[plane]);
|
||||
av_log(ctx, AV_LOG_INFO, "] mean:[");
|
||||
for (plane = 0; plane < 4 && frame->data[plane] && frame->linesize[plane]; plane++)
|
||||
av_log(ctx, AV_LOG_INFO, "%s%"PRId64,
|
||||
plane ? " ":"",
|
||||
(sum[plane] + pixelcount[plane]/2) / pixelcount[plane]);
|
||||
av_log(ctx, AV_LOG_INFO, "] stdev:[");
|
||||
av_log(ctx, AV_LOG_INFO, "%"PRId64" ", (sum[plane] + pixelcount[plane]/2) / pixelcount[plane]);
|
||||
av_log(ctx, AV_LOG_INFO, "\b] stdev:[");
|
||||
for (plane = 0; plane < 4 && frame->data[plane] && frame->linesize[plane]; plane++)
|
||||
av_log(ctx, AV_LOG_INFO, "%s%3.1f",
|
||||
plane ? " ":"",
|
||||
av_log(ctx, AV_LOG_INFO, "%3.1f ",
|
||||
sqrt((sum2[plane] - sum[plane]*(double)sum[plane]/pixelcount[plane])/pixelcount[plane]));
|
||||
av_log(ctx, AV_LOG_INFO, "]");
|
||||
av_log(ctx, AV_LOG_INFO, "\b]");
|
||||
}
|
||||
av_log(ctx, AV_LOG_INFO, "\n");
|
||||
|
||||
|
||||
@@ -134,8 +134,8 @@ static int activate(AVFilterContext *ctx)
|
||||
if (!(s->desc->flags & AV_PIX_FMT_FLAG_PAL)) {
|
||||
for (i = 1; i < 3; i ++) {
|
||||
if (out->data[i]) {
|
||||
out->data[i] += (y >> s->desc->log2_chroma_h) * out->linesize[i];
|
||||
out->data[i] += (x >> s->desc->log2_chroma_w) * s->max_step[i];
|
||||
out->data[i] += (y >> s->desc->log2_chroma_w) * out->linesize[i];
|
||||
out->data[i] += (x >> s->desc->log2_chroma_h) * s->max_step[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -372,8 +372,6 @@ got_sound:
|
||||
av_log(s, AV_LOG_ERROR, "could not find COMM tag or invalid block_align value\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (aiff->block_duration < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* Now positioned, get the sound data start and end */
|
||||
avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
|
||||
@@ -428,7 +426,7 @@ static int aiff_read_packet(AVFormatContext *s,
|
||||
pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
|
||||
/* Only one stream in an AIFF file */
|
||||
pkt->stream_index = 0;
|
||||
pkt->duration = (res / st->codecpar->block_align) * (int64_t) aiff->block_duration;
|
||||
pkt->duration = (res / st->codecpar->block_align) * aiff->block_duration;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -298,8 +298,6 @@ static int ape_read_header(AVFormatContext * s)
|
||||
ape->frames[i].pos -= ape->frames[i].skip;
|
||||
ape->frames[i].size += ape->frames[i].skip;
|
||||
}
|
||||
if (ape->frames[i].size > INT_MAX - 3)
|
||||
return AVERROR_INVALIDDATA;
|
||||
ape->frames[i].size = (ape->frames[i].size + 3) & ~3;
|
||||
}
|
||||
if (ape->fileversion < 3810) {
|
||||
|
||||
@@ -148,7 +148,7 @@ static int apm_read_header(AVFormatContext *s)
|
||||
par->codec_id = AV_CODEC_ID_ADPCM_IMA_APM;
|
||||
par->format = AV_SAMPLE_FMT_S16;
|
||||
par->bit_rate = par->ch_layout.nb_channels *
|
||||
(int64_t)par->sample_rate *
|
||||
par->sample_rate *
|
||||
par->bits_per_coded_sample;
|
||||
|
||||
if ((ret = avio_read(s->pb, buf, APM_FILE_EXTRADATA_SIZE)) < 0)
|
||||
|
||||
@@ -104,7 +104,7 @@ typedef struct ASFContext {
|
||||
int ts_is_pts;
|
||||
int packet_multi_size;
|
||||
int packet_time_delta;
|
||||
int64_t packet_time_start;
|
||||
int packet_time_start;
|
||||
int64_t packet_pos;
|
||||
|
||||
int stream_index;
|
||||
|
||||
@@ -109,7 +109,6 @@ typedef struct ASFContext {
|
||||
int64_t data_offset;
|
||||
int64_t first_packet_offset; // packet offset
|
||||
int64_t unknown_offset; // for top level header objects or subobjects without specified behavior
|
||||
int in_asf_read_unknown;
|
||||
|
||||
// ASF file must not contain more than 128 streams according to the specification
|
||||
ASFStream *asf_st[ASF_MAX_STREAMS];
|
||||
@@ -174,7 +173,7 @@ static int asf_read_unknown(AVFormatContext *s, const GUIDParseTable *g)
|
||||
uint64_t size = avio_rl64(pb);
|
||||
int ret;
|
||||
|
||||
if (size > INT64_MAX || asf->in_asf_read_unknown > 5)
|
||||
if (size > INT64_MAX)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (asf->is_header)
|
||||
@@ -183,11 +182,8 @@ static int asf_read_unknown(AVFormatContext *s, const GUIDParseTable *g)
|
||||
if (!g->is_subobject) {
|
||||
if (!(ret = strcmp(g->name, "Header Extension")))
|
||||
avio_skip(pb, 22); // skip reserved fields and Data Size
|
||||
asf->in_asf_read_unknown ++;
|
||||
ret = detect_unknown_subobject(s, asf->unknown_offset,
|
||||
asf->unknown_size);
|
||||
asf->in_asf_read_unknown --;
|
||||
if (ret < 0)
|
||||
if ((ret = detect_unknown_subobject(s, asf->unknown_offset,
|
||||
asf->unknown_size)) < 0)
|
||||
return ret;
|
||||
} else {
|
||||
if (size < 24) {
|
||||
@@ -1242,8 +1238,6 @@ static int asf_read_packet_header(AVFormatContext *s)
|
||||
unsigned char error_flags, len_flags, pay_flags;
|
||||
|
||||
asf->packet_offset = avio_tell(pb);
|
||||
if (asf->packet_offset > INT64_MAX/2)
|
||||
asf->packet_offset = 0;
|
||||
error_flags = avio_r8(pb); // read Error Correction Flags
|
||||
if (error_flags & ASF_PACKET_FLAG_ERROR_CORRECTION_PRESENT) {
|
||||
if (!(error_flags & ASF_ERROR_CORRECTION_LENGTH_TYPE)) {
|
||||
|
||||
@@ -144,14 +144,8 @@ static int wrapped_url_read(void *src, void *dst, size_t *size)
|
||||
|
||||
static int ring_write(RingBuffer *ring, URLContext *h, size_t size)
|
||||
{
|
||||
int ret;
|
||||
|
||||
av_assert2(size <= ring_space(ring));
|
||||
ret = av_fifo_write_from_cb(ring->fifo, wrapped_url_read, h, &size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return size;
|
||||
return av_fifo_write_from_cb(ring->fifo, wrapped_url_read, h, &size);
|
||||
}
|
||||
|
||||
static int ring_size_of_read_back(RingBuffer *ring)
|
||||
|
||||
@@ -82,8 +82,6 @@ typedef struct AVIContext {
|
||||
int stream_index;
|
||||
DVDemuxContext *dv_demux;
|
||||
int odml_depth;
|
||||
int64_t odml_read;
|
||||
int64_t odml_max_pos;
|
||||
int use_odml;
|
||||
#define MAX_ODML_DEPTH 1000
|
||||
int64_t dts_max;
|
||||
@@ -202,7 +200,7 @@ static int read_odml_index(AVFormatContext *s, int64_t frame_num)
|
||||
st = s->streams[stream_id];
|
||||
ast = st->priv_data;
|
||||
|
||||
if (index_sub_type || entries_in_use < 0)
|
||||
if (index_sub_type)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
avio_rl32(pb);
|
||||
@@ -223,18 +221,11 @@ static int read_odml_index(AVFormatContext *s, int64_t frame_num)
|
||||
}
|
||||
|
||||
for (i = 0; i < entries_in_use; i++) {
|
||||
avi->odml_max_pos = FFMAX(avi->odml_max_pos, avio_tell(pb));
|
||||
|
||||
// If we read more than there are bytes then we must have been reading something twice
|
||||
if (avi->odml_read > avi->odml_max_pos)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (index_type) {
|
||||
int64_t pos = avio_rl32(pb) + base - 8;
|
||||
int len = avio_rl32(pb);
|
||||
int key = len >= 0;
|
||||
len &= 0x7FFFFFFF;
|
||||
avi->odml_read += 8;
|
||||
|
||||
av_log(s, AV_LOG_TRACE, "pos:%"PRId64", len:%X\n", pos, len);
|
||||
|
||||
@@ -253,7 +244,6 @@ static int read_odml_index(AVFormatContext *s, int64_t frame_num)
|
||||
int64_t offset, pos;
|
||||
int duration;
|
||||
int ret;
|
||||
avi->odml_read += 16;
|
||||
|
||||
offset = avio_rl64(pb);
|
||||
avio_rl32(pb); /* size */
|
||||
|
||||
@@ -752,7 +752,7 @@ static int avisynth_create_stream_audio(AVFormatContext *s, AVStream *st)
|
||||
|
||||
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
st->codecpar->sample_rate = avs->vi->audio_samples_per_second;
|
||||
st->codecpar->ch_layout.nb_channels = avs->vi->nchannels;
|
||||
st->codecpar->channels = avs->vi->nchannels;
|
||||
st->duration = avs->vi->num_audio_samples;
|
||||
avpriv_set_pts_info(st, 64, 1, avs->vi->audio_samples_per_second);
|
||||
|
||||
|
||||
@@ -387,7 +387,7 @@ static int read_header(AVFormatContext *s)
|
||||
|
||||
found_data:
|
||||
if (caf->bytes_per_packet > 0 && caf->frames_per_packet > 0) {
|
||||
if (caf->data_size > 0 && caf->data_size / caf->bytes_per_packet < INT64_MAX / caf->frames_per_packet)
|
||||
if (caf->data_size > 0)
|
||||
st->nb_frames = (caf->data_size / caf->bytes_per_packet) * caf->frames_per_packet;
|
||||
} else if (ffstream(st)->nb_index_entries && st->duration > 0) {
|
||||
if (st->codecpar->sample_rate && caf->data_size / st->duration > INT64_MAX / st->codecpar->sample_rate / 8) {
|
||||
|
||||
@@ -53,11 +53,7 @@ static uint32_t codec_flags(enum AVCodecID codec_id) {
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t samples_per_packet(const AVCodecParameters *par) {
|
||||
enum AVCodecID codec_id = par->codec_id;
|
||||
int channels = par->ch_layout.nb_channels, block_align = par->block_align;
|
||||
int frame_size = par->frame_size, sample_rate = par->sample_rate;
|
||||
|
||||
static uint32_t samples_per_packet(enum AVCodecID codec_id, int channels, int block_align) {
|
||||
switch (codec_id) {
|
||||
case AV_CODEC_ID_PCM_S8:
|
||||
case AV_CODEC_ID_PCM_S16LE:
|
||||
@@ -87,8 +83,6 @@ static uint32_t samples_per_packet(const AVCodecParameters *par) {
|
||||
return 320;
|
||||
case AV_CODEC_ID_MP1:
|
||||
return 384;
|
||||
case AV_CODEC_ID_OPUS:
|
||||
return frame_size * 48000 / sample_rate;
|
||||
case AV_CODEC_ID_MP2:
|
||||
case AV_CODEC_ID_MP3:
|
||||
return 1152;
|
||||
@@ -116,7 +110,7 @@ static int caf_write_header(AVFormatContext *s)
|
||||
AVDictionaryEntry *t = NULL;
|
||||
unsigned int codec_tag = ff_codec_get_tag(ff_codec_caf_tags, par->codec_id);
|
||||
int64_t chunk_size = 0;
|
||||
int frame_size = par->frame_size, sample_rate = par->sample_rate;
|
||||
int frame_size = par->frame_size;
|
||||
|
||||
if (s->nb_streams != 1) {
|
||||
av_log(s, AV_LOG_ERROR, "CAF files have exactly one stream\n");
|
||||
@@ -145,10 +139,7 @@ static int caf_write_header(AVFormatContext *s)
|
||||
}
|
||||
|
||||
if (par->codec_id != AV_CODEC_ID_MP3 || frame_size != 576)
|
||||
frame_size = samples_per_packet(par);
|
||||
|
||||
if (par->codec_id == AV_CODEC_ID_OPUS)
|
||||
sample_rate = 48000;
|
||||
frame_size = samples_per_packet(par->codec_id, par->ch_layout.nb_channels, par->block_align);
|
||||
|
||||
ffio_wfourcc(pb, "caff"); //< mFileType
|
||||
avio_wb16(pb, 1); //< mFileVersion
|
||||
@@ -156,7 +147,7 @@ static int caf_write_header(AVFormatContext *s)
|
||||
|
||||
ffio_wfourcc(pb, "desc"); //< Audio Description chunk
|
||||
avio_wb64(pb, 32); //< mChunkSize
|
||||
avio_wb64(pb, av_double2int(sample_rate)); //< mSampleRate
|
||||
avio_wb64(pb, av_double2int(par->sample_rate)); //< mSampleRate
|
||||
avio_wl32(pb, codec_tag); //< mFormatID
|
||||
avio_wb32(pb, codec_flags(par->codec_id)); //< mFormatFlags
|
||||
avio_wb32(pb, par->block_align); //< mBytesPerPacket
|
||||
@@ -257,7 +248,7 @@ static int caf_write_trailer(AVFormatContext *s)
|
||||
avio_seek(pb, caf->data, SEEK_SET);
|
||||
avio_wb64(pb, file_size - caf->data - 8);
|
||||
if (!par->block_align) {
|
||||
int packet_size = samples_per_packet(par);
|
||||
int packet_size = samples_per_packet(par->codec_id, par->ch_layout.nb_channels, par->block_align);
|
||||
if (!packet_size) {
|
||||
packet_size = st->duration / (caf->packets - 1);
|
||||
avio_seek(pb, FRAME_SIZE_OFFSET, SEEK_SET);
|
||||
|
||||
@@ -956,11 +956,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
|
||||
xmlFree(val);
|
||||
}
|
||||
if (adaptionset_supplementalproperty_node) {
|
||||
char *scheme_id_uri = xmlGetProp(adaptionset_supplementalproperty_node, "schemeIdUri");
|
||||
if (scheme_id_uri) {
|
||||
int is_last_segment_number = !av_strcasecmp(scheme_id_uri, "http://dashif.org/guidelines/last-segment-number");
|
||||
xmlFree(scheme_id_uri);
|
||||
if (is_last_segment_number) {
|
||||
if (!av_strcasecmp(xmlGetProp(adaptionset_supplementalproperty_node,"schemeIdUri"), "http://dashif.org/guidelines/last-segment-number")) {
|
||||
val = xmlGetProp(adaptionset_supplementalproperty_node,"value");
|
||||
if (!val) {
|
||||
av_log(s, AV_LOG_ERROR, "Missing value attribute in adaptionset_supplementalproperty_node\n");
|
||||
@@ -969,7 +965,6 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url,
|
||||
xmlFree(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fragment_timeline_node = find_child_node_by_name(representation_segmenttemplate_node, "SegmentTimeline");
|
||||
|
||||
@@ -242,7 +242,7 @@ static int64_t get_duration(AVFormatContext *s)
|
||||
avio_seek(s->pb, avio_size(s->pb) - 8, SEEK_SET);
|
||||
while (avio_tell(s->pb) > 12 && max_interations--) {
|
||||
if (avio_rl32(s->pb) == MKTAG('d','h','a','v')) {
|
||||
int64_t seek_back = avio_rl32(s->pb);
|
||||
int seek_back = avio_rl32(s->pb);
|
||||
|
||||
avio_seek(s->pb, -seek_back, SEEK_CUR);
|
||||
read_chunk(s);
|
||||
|
||||
@@ -118,12 +118,9 @@ static int dxa_read_header(AVFormatContext *s)
|
||||
if(tag == MKTAG('d', 'a', 't', 'a')) break;
|
||||
avio_skip(pb, fsize);
|
||||
}
|
||||
c->bpc = (fsize + (int64_t)c->frames - 1) / c->frames;
|
||||
if(ast->codecpar->block_align) {
|
||||
if (c->bpc > INT_MAX - ast->codecpar->block_align + 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
c->bpc = (fsize + c->frames - 1) / c->frames;
|
||||
if(ast->codecpar->block_align)
|
||||
c->bpc = ((c->bpc + ast->codecpar->block_align - 1) / ast->codecpar->block_align) * ast->codecpar->block_align;
|
||||
}
|
||||
c->bytes_left = fsize;
|
||||
c->wavpos = avio_tell(pb);
|
||||
avio_seek(pb, c->vidpos, SEEK_SET);
|
||||
|
||||
@@ -65,7 +65,7 @@ typedef struct FLVContext {
|
||||
uint8_t resync_buffer[2*RESYNC_BUFFER_SIZE];
|
||||
|
||||
int broken_sizes;
|
||||
int64_t sum_flv_tag_size;
|
||||
int sum_flv_tag_size;
|
||||
|
||||
int last_keyframe_stream_index;
|
||||
int keyframe_count;
|
||||
@@ -463,8 +463,6 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, int64_t m
|
||||
goto invalid;
|
||||
if (current_array == × && (d <= INT64_MIN / 1000 || d >= INT64_MAX / 1000))
|
||||
goto invalid;
|
||||
if (avio_feof(ioc))
|
||||
goto invalid;
|
||||
current_array[0][i] = d;
|
||||
}
|
||||
if (times && filepositions) {
|
||||
@@ -1030,7 +1028,7 @@ retry:
|
||||
type = (avio_r8(s->pb) & 0x1F);
|
||||
orig_size =
|
||||
size = avio_rb24(s->pb);
|
||||
flv->sum_flv_tag_size += size + 11LL;
|
||||
flv->sum_flv_tag_size += size + 11;
|
||||
dts = avio_rb24(s->pb);
|
||||
dts |= (unsigned)avio_r8(s->pb) << 24;
|
||||
av_log(s, AV_LOG_TRACE, "type:%d, size:%d, last:%d, dts:%"PRId64" pos:%"PRId64"\n", type, size, last, dts, avio_tell(s->pb));
|
||||
@@ -1330,7 +1328,7 @@ leave:
|
||||
!avio_feof(s->pb) &&
|
||||
(last != orig_size || !last) && last != flv->sum_flv_tag_size &&
|
||||
!flv->broken_sizes) {
|
||||
av_log(s, AV_LOG_ERROR, "Packet mismatch %d %d %"PRId64"\n", last, orig_size + 11, flv->sum_flv_tag_size);
|
||||
av_log(s, AV_LOG_ERROR, "Packet mismatch %d %d %d\n", last, orig_size + 11, flv->sum_flv_tag_size);
|
||||
avio_seek(s->pb, pos + 1, SEEK_SET);
|
||||
ret = resync(s);
|
||||
av_packet_unref(pkt);
|
||||
|
||||
@@ -78,8 +78,6 @@ static int genh_read_header(AVFormatContext *s)
|
||||
case 0: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_PSX; break;
|
||||
case 1:
|
||||
case 11: st->codecpar->bits_per_coded_sample = 4;
|
||||
if (st->codecpar->ch_layout.nb_channels > INT_MAX / 36)
|
||||
return AVERROR_INVALIDDATA;
|
||||
st->codecpar->block_align = 36 * st->codecpar->ch_layout.nb_channels;
|
||||
st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_WAV; break;
|
||||
case 2: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_DTK; break;
|
||||
|
||||
@@ -250,7 +250,6 @@ static void free_init_section_list(struct playlist *pls)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < pls->n_init_sections; i++) {
|
||||
av_freep(&pls->init_sections[i]->key);
|
||||
av_freep(&pls->init_sections[i]->url);
|
||||
av_freep(&pls->init_sections[i]);
|
||||
}
|
||||
|
||||
@@ -196,9 +196,6 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
AV_WL32(buf + 32, image->nb_pal);
|
||||
}
|
||||
|
||||
if (image->nb_pal > INT_MAX / 4 - 14 - 40)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
AV_WL32(buf - 4, 14 + 40 + image->nb_pal * 4);
|
||||
AV_WL32(buf + 8, AV_RL32(buf + 8) / 2);
|
||||
}
|
||||
|
||||
@@ -377,10 +377,10 @@ static void read_uslt(AVFormatContext *s, AVIOContext *pb, int taglen,
|
||||
lang[3] = '\0';
|
||||
taglen -= 3;
|
||||
|
||||
if (decode_str(s, pb, encoding, &descriptor, &taglen) < 0 || taglen < 0)
|
||||
if (decode_str(s, pb, encoding, &descriptor, &taglen) < 0)
|
||||
goto error;
|
||||
|
||||
if (decode_str(s, pb, encoding, &text, &taglen) < 0 || taglen < 0)
|
||||
if (decode_str(s, pb, encoding, &text, &taglen) < 0)
|
||||
goto error;
|
||||
|
||||
// FFmpeg does not support hierarchical metadata, so concatenate the keys.
|
||||
|
||||
@@ -501,9 +501,6 @@ static int iff_read_header(AVFormatContext *s)
|
||||
case ID_DST:
|
||||
case ID_MDAT:
|
||||
iff->body_pos = avio_tell(pb);
|
||||
if (iff->body_pos < 0 || iff->body_pos + data_size > INT64_MAX)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
iff->body_end = iff->body_pos + data_size;
|
||||
iff->body_size = data_size;
|
||||
if (chunk_id == ID_DST) {
|
||||
|
||||
@@ -240,8 +240,13 @@ static int translate_ipfs_to_http(URLContext *h, const char *uri, int flags, AVD
|
||||
ret = populate_ipfs_gateway(h);
|
||||
|
||||
if (ret < 1) {
|
||||
av_log(h, AV_LOG_ERROR,
|
||||
"IPFS does not appear to be running.\n\n"
|
||||
// We fallback on dweb.link (managed by Protocol Labs).
|
||||
snprintf(c->gateway_buffer, sizeof(c->gateway_buffer), "https://dweb.link");
|
||||
|
||||
av_log(h, AV_LOG_WARNING,
|
||||
"IPFS does not appear to be running. "
|
||||
"You’re now using the public gateway at dweb.link.\n");
|
||||
av_log(h, AV_LOG_INFO,
|
||||
"Installing IPFS locally is recommended to "
|
||||
"improve performance and reliability, "
|
||||
"and not share all your activity with a single IPFS gateway.\n"
|
||||
@@ -254,8 +259,6 @@ static int translate_ipfs_to_http(URLContext *h, const char *uri, int flags, AVD
|
||||
"3. Define an $IPFS_PATH environment variable "
|
||||
"and point it to the IPFS data path "
|
||||
"- this is typically ~/.ipfs\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ static int get_shift(int timeres, const char *buf)
|
||||
ret = 0;
|
||||
switch (n) {
|
||||
case 4:
|
||||
ret = sign * (((int64_t)a*3600 + (int64_t)b*60 + c) * timeres + d);
|
||||
ret = sign * (((int64_t)a*3600 + b*60 + c) * timeres + d);
|
||||
break;
|
||||
case 3:
|
||||
ret = sign * (( (int64_t)a*60 + b) * timeres + c);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user