Compare commits
66 Commits
n4.1.10
...
release/4.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 7ef6f317f8 | |||
| cdd355e087 | |||
| 835453fbd8 | |||
| 76ee3e41df | |||
| a957d604a2 | |||
| 08f0a18c34 | |||
| e14e7579f9 | |||
| 4e377ec8dc | |||
| bb34d18e33 | |||
| 1cf4afaeab | |||
| a207fbcdff | |||
| 4443cdbc92 | |||
| 67128a952c | |||
| 3b5c0f75ef | |||
| 60b30ede05 | |||
| 161740d99f | |||
| c536ee212a | |||
| 17163b57bd | |||
| a6676288e4 | |||
| 78efab9bed | |||
| 008e01a2de | |||
| d82fb8b689 | |||
| 477c5cf023 | |||
| 70189b9ecb | |||
| b06620b9be | |||
| 75c8967329 | |||
| a9e8b170a8 | |||
| 55d2d09a1e | |||
| cff7e3636e | |||
| 31206a077f | |||
| c02752bf7c | |||
| d8e1d8063e | |||
| 3c982fc61c | |||
| e82a3c05a4 | |||
| abe5bab7b5 | |||
| fd6043ac28 | |||
| ca1b6608f5 | |||
| fc682a1077 | |||
| 205c8feeef | |||
| d5eef2fb85 | |||
| 042e207e9b | |||
| 3b7a0e2b8f | |||
| ee9cec2566 | |||
| 9fc2c82006 | |||
| 306e38ae90 | |||
| c23ef5b345 | |||
| dd507e4c8f | |||
| cae611f864 | |||
| 662c3060b9 | |||
| ba9e8fa53a | |||
| 6c4135ae35 | |||
| 82dc3224b7 | |||
| 1818f9f4dc | |||
| ae61a4ca68 | |||
| ffeb46560f | |||
| 5da206d3a5 | |||
| 0bc8a2c295 | |||
| 03758674e2 | |||
| d12e316dbd | |||
| 419248dd19 | |||
| ab9b4ea207 | |||
| 97c9af0cc9 | |||
| 51efa68ec0 | |||
| a8a208b123 | |||
| f442a376a1 | |||
| a4ba6e7d2c |
@@ -1,6 +1,6 @@
|
||||
See the Git history of the project (git://source.ffmpeg.org/ffmpeg) to
|
||||
See the Git history of the project (https://git.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
|
||||
http://source.ffmpeg.org.
|
||||
https://git.ffmpeg.org/ffmpeg
|
||||
|
||||
@@ -1,6 +1,68 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 4.1.11:
|
||||
avformat/nutdec: Add check for avformat_new_stream
|
||||
avformat/wavdec: Check that smv block fits in available space
|
||||
avcodec/tak: Check remaining bits in ff_tak_decode_frame_header()
|
||||
avcodec/utils: the IFF_ILBM implementation assumes that there are a multiple of 16 allocated
|
||||
avcodec/pngdec: Do not pass AVFrame into global header decode
|
||||
avcodec/vorbisdec: Check codebook float values to be finite
|
||||
avcodec/g2meet: Replace fake allocation avoidance for framebuf
|
||||
avcodec/lcldec: More space for rgb24
|
||||
avcodec/lcldec: Support 4:1:1 and 4:2:2 with odd width
|
||||
libavcodec/lcldec: width and height should not be unsigned
|
||||
avcodec/escape124: Check that blocks are allocated before use
|
||||
avcodec/huffyuvdec: Fix undefined behavior with shift
|
||||
avcodec/j2kenc: Replace RGB24 special case by generic test
|
||||
avcodec/j2kenc: remove misleading pred value
|
||||
avcodec/j2kenc: fix 5/3 DWT identifer
|
||||
avcodec/vp3: Check width to avoid assertion failure
|
||||
avcodec/g729postfilter: Limit shift in long term filter
|
||||
configure: update copyright year
|
||||
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
|
||||
avcodec/escape124: Fix some return codes
|
||||
avcodec/escape124: fix signdness of end of input check
|
||||
Use https for repository links
|
||||
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: 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
|
||||
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/012v: Order operations for odd size handling
|
||||
avcodec/eatgq: : Check index increments in tgq_decode_block()
|
||||
avcodec/scpr: Test bx before use
|
||||
avcodec/sunrast: Fix maplength check
|
||||
avcodec/wavpack: Avoid undefined shift in get_tail()
|
||||
avformat/id3v2: Check taglen in read_uslt()
|
||||
avcodec/ffv1dec: restructure slice coordinate reading a bit
|
||||
avcodec/mlpdec: Check max matrix instead of max channel in noise check
|
||||
swscale/input: Use more unsigned intermediates
|
||||
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
|
||||
avcodec/speedhq: Check buf_size to be big enough for DC
|
||||
avcodec/ffv1dec: Fail earlier if prior context is corrupted
|
||||
(origin/release/4.1) avcodec/vdpau_mpeg4: fix order of quant matrix coefficients
|
||||
avcodec/vdpau_mpeg12: fix order of quant matrix coefficients
|
||||
avcodec/nvdec_mpeg4: fix order of quant matrix coefficients
|
||||
avcodec/nvdec_mpeg2: fix order of quant matrix coefficients
|
||||
avcodec/vp3: Add missing check for av_malloc
|
||||
avcodec/mjpegenc: take into account component count when writing the SOF header size
|
||||
checkasm: float_dsp: Scale FLT/DBL_EPSILON sufficiently when comparing
|
||||
swscale: aarch64: Fix yuv2rgb with negative strides
|
||||
|
||||
version 4.1.10:
|
||||
avcodec/dstdec: Check for overflow in build_filter()
|
||||
avformat/spdifdec: Use 64bit to compute bit rate
|
||||
|
||||
@@ -7243,7 +7243,7 @@ cat > $TMPH <<EOF
|
||||
#define FFMPEG_CONFIG_H
|
||||
#define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
|
||||
#define FFMPEG_LICENSE "$(c_escape $license)"
|
||||
#define CONFIG_THIS_YEAR 2022
|
||||
#define CONFIG_THIS_YEAR 2023
|
||||
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
|
||||
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
|
||||
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 4.1.10
|
||||
PROJECT_NUMBER = 4.1.11
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
||||
+2
-2
@@ -3,9 +3,9 @@
|
||||
The FFmpeg developers.
|
||||
|
||||
For details about the authorship, see the Git history of the project
|
||||
(git://source.ffmpeg.org/ffmpeg), e.g. by typing the command
|
||||
(https://git.ffmpeg.org/ffmpeg), e.g. by typing the command
|
||||
@command{git log} in the FFmpeg source directory, or browsing the
|
||||
online repository at @url{http://source.ffmpeg.org}.
|
||||
online repository at @url{https://git.ffmpeg.org/ffmpeg}.
|
||||
|
||||
Maintainers for the specific components are listed in the file
|
||||
@file{MAINTAINERS} in the source code tree.
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ Most distribution and operating system provide a package for it.
|
||||
@section Cloning the source tree
|
||||
|
||||
@example
|
||||
git clone git://source.ffmpeg.org/ffmpeg <target>
|
||||
git clone https://git.ffmpeg.org/ffmpeg.git <target>
|
||||
@end example
|
||||
|
||||
This will put the FFmpeg sources into the directory @var{<target>}.
|
||||
|
||||
+2
-2
@@ -131,8 +131,8 @@ static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
|
||||
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;
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
#define AC3_DYNAMIC_RANGE1 0
|
||||
|
||||
typedef int INTFLOAT;
|
||||
typedef unsigned int UINTFLOAT;
|
||||
typedef int16_t SHORTFLOAT;
|
||||
|
||||
#else /* USE_FIXED */
|
||||
@@ -94,6 +95,7 @@ typedef int16_t SHORTFLOAT;
|
||||
#define AC3_DYNAMIC_RANGE1 1.0f
|
||||
|
||||
typedef float INTFLOAT;
|
||||
typedef float UINTFLOAT;
|
||||
typedef float SHORTFLOAT;
|
||||
|
||||
#endif /* USE_FIXED */
|
||||
|
||||
+1
-1
@@ -1016,7 +1016,7 @@ static int read_block(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
|
||||
*bd->shift_lsbs = 0;
|
||||
|
||||
if (get_bits_left(gb) < 1)
|
||||
if (get_bits_left(gb) < 7)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
// read block type flag and read the samples accordingly
|
||||
|
||||
+4
-4
@@ -838,7 +838,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 * frame->linesize[plane_idx] + bw) * 8;
|
||||
ref_end = frame->data[plane_idx] + ((bh - 1) * frame->linesize[plane_idx] + bw - 1) * 8;
|
||||
|
||||
for (i = 0; i < 64; i++)
|
||||
coordmap[i] = (i & 7) + (i >> 3) * stride;
|
||||
@@ -894,7 +894,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 + 8*stride > ref_end) {
|
||||
if (ref < ref_start || ref > 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->hdsp.put_pixels_tab[1][0](dst, ref, stride, 8);
|
||||
@@ -910,7 +910,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 + 8 * stride > ref_end) {
|
||||
if (ref < ref_start || ref > 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->hdsp.put_pixels_tab[1][0](dst, ref, stride, 8);
|
||||
@@ -942,7 +942,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 + 8 * stride > ref_end) {
|
||||
if (ref < ref_start || ref > 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->hdsp.put_pixels_tab[1][0](dst, ref, stride, 8);
|
||||
|
||||
@@ -145,9 +145,11 @@ 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++) {
|
||||
float noise = nscale * (int32_t)av_lfg_get(&s->dith_state);
|
||||
UINTFLOAT noise = (INTFLOAT)(nscale * (int32_t)av_lfg_get(&s->dith_state));
|
||||
s->transform_coeffs[ch][bin] *= sscale;
|
||||
s->transform_coeffs[ch][bin++] += noise;
|
||||
}
|
||||
|
||||
+11
-3
@@ -58,7 +58,7 @@ static av_cold int tgq_decode_init(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb)
|
||||
static int tgq_decode_block(TgqContext *s, int16_t block[64], GetBitContext *gb)
|
||||
{
|
||||
uint8_t *perm = s->scantable.permutated;
|
||||
int i, j, value;
|
||||
@@ -66,6 +66,8 @@ static void 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;
|
||||
@@ -75,6 +77,8 @@ static void 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;
|
||||
@@ -102,6 +106,7 @@ static void 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,
|
||||
@@ -161,8 +166,11 @@ 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++)
|
||||
tgq_decode_block(s, s->block[i], &gb);
|
||||
for (i = 0; i < 6; i++) {
|
||||
int ret = tgq_decode_block(s, s->block[i], &gb);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
tgq_idct_put_mb(s, s->block, frame, mb_x, mb_y);
|
||||
bytestream2_skip(&s->gb, mode);
|
||||
} else {
|
||||
|
||||
@@ -88,11 +88,6 @@ 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;
|
||||
@@ -162,7 +157,7 @@ static MacroBlock decode_macroblock(Escape124Context* s, GetBitContext* gb,
|
||||
|
||||
// This condition can occur with invalid bitstreams and
|
||||
// *codebook_index == 2
|
||||
if (block_index >= s->codebooks[*codebook_index].size)
|
||||
if (block_index >= s->codebooks[*codebook_index].size || !s->codebooks[*codebook_index].blocks)
|
||||
return (MacroBlock) { { 0 } };
|
||||
|
||||
return s->codebooks[*codebook_index].blocks[block_index];
|
||||
@@ -226,7 +221,7 @@ static int escape124_decode_frame(AVCodecContext *avctx,
|
||||
// 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 -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
frame_flags = get_bits_long(&gb, 32);
|
||||
frame_size = get_bits_long(&gb, 32);
|
||||
@@ -277,9 +272,14 @@ static int escape124_decode_frame(AVCodecContext *avctx,
|
||||
}
|
||||
|
||||
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 -1;
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+45
-26
@@ -169,24 +169,31 @@ static int decode_slice_header(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;
|
||||
|
||||
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 (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);
|
||||
|
||||
if (fs->ac == AC_GOLOMB_RICE && fs->slice_width >= (1<<23))
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -304,8 +311,11 @@ 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;
|
||||
@@ -468,6 +478,11 @@ 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);
|
||||
@@ -770,21 +785,25 @@ static int read_header(FFV1Context *f)
|
||||
fs->slice_damaged = 0;
|
||||
|
||||
if (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;
|
||||
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 /= 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)
|
||||
if (sx < 0 || sy < 0 || sw <= 0 || sh <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if ( (unsigned)fs->slice_x + (uint64_t)fs->slice_width > f->width
|
||||
|| (unsigned)fs->slice_y + (uint64_t)fs->slice_height > f->height)
|
||||
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);
|
||||
}
|
||||
|
||||
for (i = 0; i < f->plane_count; i++) {
|
||||
|
||||
+10
-9
@@ -143,7 +143,8 @@ typedef struct G2MContext {
|
||||
int got_header;
|
||||
|
||||
uint8_t *framebuf;
|
||||
int framebuf_stride, old_width, old_height;
|
||||
int framebuf_stride;
|
||||
unsigned int framebuf_allocated;
|
||||
|
||||
uint8_t *synth_tile, *jpeg_tile, *epic_buf, *epic_buf_base;
|
||||
int tile_stride, epic_buf_stride, old_tile_w, old_tile_h;
|
||||
@@ -1179,14 +1180,13 @@ static int g2m_init_buffers(G2MContext *c)
|
||||
{
|
||||
int aligned_height;
|
||||
|
||||
if (!c->framebuf || c->old_width < c->width || c->old_height < c->height) {
|
||||
c->framebuf_stride = FFALIGN(c->width + 15, 16) * 3;
|
||||
aligned_height = c->height + 15;
|
||||
av_free(c->framebuf);
|
||||
c->framebuf = av_mallocz_array(c->framebuf_stride, aligned_height);
|
||||
if (!c->framebuf)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
c->framebuf_stride = FFALIGN(c->width + 15, 16) * 3;
|
||||
aligned_height = c->height + 15;
|
||||
|
||||
av_fast_mallocz(&c->framebuf, &c->framebuf_allocated, c->framebuf_stride * aligned_height);
|
||||
if (!c->framebuf)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
if (!c->synth_tile || !c->jpeg_tile ||
|
||||
(c->compression == 2 && !c->epic_buf_base) ||
|
||||
c->old_tile_w < c->tile_width ||
|
||||
@@ -1638,6 +1638,7 @@ static av_cold int g2m_decode_end(AVCodecContext *avctx)
|
||||
av_freep(&c->jpeg_tile);
|
||||
av_freep(&c->cursor);
|
||||
av_freep(&c->framebuf);
|
||||
c->framebuf_allocated = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ static int16_t long_term_filter(AudioDSPContext *adsp, int pitch_delay_int,
|
||||
if (tmp > 0)
|
||||
L_temp0 >>= tmp;
|
||||
else
|
||||
L_temp1 >>= -tmp;
|
||||
L_temp1 >>= FFMIN(-tmp, 31);
|
||||
|
||||
/* Check if longer filter increases the values of R'(k). */
|
||||
if (L_temp1 > L_temp0) {
|
||||
|
||||
@@ -691,9 +691,9 @@ static void decode_422_bitstream(HYuvContext *s, int count)
|
||||
/* TODO instead of restarting the read when the code isn't in the first level
|
||||
* of the joint table, jump into the 2nd level of the individual table. */
|
||||
#define READ_2PIX_PLANE16(dst0, dst1, plane){\
|
||||
dst0 = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2;\
|
||||
dst0 = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)*4;\
|
||||
dst0 += get_bits(&s->gb, 2);\
|
||||
dst1 = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2;\
|
||||
dst1 = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)*4;\
|
||||
dst1 += get_bits(&s->gb, 2);\
|
||||
}
|
||||
static void decode_plane_bitstream(HYuvContext *s, int width, int plane)
|
||||
|
||||
+4
-3
@@ -1003,6 +1003,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
int tileno, ret;
|
||||
Jpeg2000EncoderContext *s = avctx->priv_data;
|
||||
uint8_t *chunkstart, *jp2cstart, *jp2hstart;
|
||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
|
||||
|
||||
if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*9 + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0)
|
||||
return ret;
|
||||
@@ -1055,7 +1056,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
bytestream_put_byte(&s->buf, 1);
|
||||
bytestream_put_byte(&s->buf, 0);
|
||||
bytestream_put_byte(&s->buf, 0);
|
||||
if (avctx->pix_fmt == AV_PIX_FMT_RGB24 || avctx->pix_fmt == AV_PIX_FMT_PAL8) {
|
||||
if ((desc->flags & AV_PIX_FMT_FLAG_RGB) || avctx->pix_fmt == AV_PIX_FMT_PAL8) {
|
||||
bytestream_put_be32(&s->buf, 16);
|
||||
} else if (s->ncomponents == 1) {
|
||||
bytestream_put_be32(&s->buf, 17);
|
||||
@@ -1151,7 +1152,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
|
||||
if (avctx->pix_fmt == AV_PIX_FMT_PAL8 && (s->pred != FF_DWT97_INT || s->format != CODEC_JP2)) {
|
||||
av_log(s->avctx, AV_LOG_WARNING, "Forcing lossless jp2 for pal8\n");
|
||||
s->pred = FF_DWT97_INT;
|
||||
s->pred = 1;
|
||||
s->format = CODEC_JP2;
|
||||
}
|
||||
|
||||
@@ -1229,7 +1230,7 @@ static const AVOption options[] = {
|
||||
{ "tile_height", "Tile Height", OFFSET(tile_height), AV_OPT_TYPE_INT, { .i64 = 256 }, 1, 1<<30, VE, },
|
||||
{ "pred", "DWT Type", OFFSET(pred), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE, "pred" },
|
||||
{ "dwt97int", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "pred" },
|
||||
{ "dwt53", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "pred" },
|
||||
{ "dwt53", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, "pred" },
|
||||
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
+22
-11
@@ -148,6 +148,8 @@ static int zlib_decomp(AVCodecContext *avctx, const uint8_t *src, int src_len, i
|
||||
if (expected != (unsigned int)c->zstream.total_out) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %lu)\n",
|
||||
expected, c->zstream.total_out);
|
||||
if (expected > (unsigned int)c->zstream.total_out)
|
||||
return (unsigned int)c->zstream.total_out;
|
||||
return AVERROR_UNKNOWN;
|
||||
}
|
||||
return c->zstream.total_out;
|
||||
@@ -166,8 +168,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
int row, col;
|
||||
unsigned char *encoded = avpkt->data, *outptr;
|
||||
uint8_t *y_out, *u_out, *v_out;
|
||||
unsigned int width = avctx->width; // Real image width
|
||||
unsigned int height = avctx->height; // Real image height
|
||||
int width = avctx->width; // Real image width
|
||||
int height = avctx->height; // Real image height
|
||||
unsigned int mszh_dlen;
|
||||
unsigned char yq, y1q, uq, vq;
|
||||
int uqvq, ret;
|
||||
@@ -274,12 +276,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
ret = zlib_decomp(avctx, buf + 8 + mthread_inlen, len - 8 - mthread_inlen,
|
||||
mthread_outlen, mthread_outlen);
|
||||
if (ret < 0) return ret;
|
||||
len = c->decomp_size;
|
||||
} else {
|
||||
int ret = zlib_decomp(avctx, buf, len, 0, c->decomp_size);
|
||||
if (ret < 0) return ret;
|
||||
len = ret;
|
||||
}
|
||||
encoded = c->decomp_buf;
|
||||
len = c->decomp_size;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@@ -399,6 +402,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
v_out[ col >> 1 ] = *encoded++ + 128;
|
||||
v_out[(col >> 1) + 1] = *encoded++ + 128;
|
||||
}
|
||||
if (col && col < width) {
|
||||
u_out[ col >> 1 ] = u_out[(col>>1) - 1];
|
||||
v_out[ col >> 1 ] = v_out[(col>>1) - 1];
|
||||
}
|
||||
|
||||
y_out -= frame->linesize[0];
|
||||
u_out -= frame->linesize[1];
|
||||
v_out -= frame->linesize[2];
|
||||
@@ -420,6 +428,10 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
u_out[col >> 2] = *encoded++ + 128;
|
||||
v_out[col >> 2] = *encoded++ + 128;
|
||||
}
|
||||
if (col && col < width) {
|
||||
u_out[col >> 2] = u_out[(col>>2) - 1];
|
||||
v_out[col >> 2] = v_out[(col>>2) - 1];
|
||||
}
|
||||
y_out -= frame->linesize[0];
|
||||
u_out -= frame->linesize[1];
|
||||
v_out -= frame->linesize[2];
|
||||
@@ -477,6 +489,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
FFALIGN(avctx->height, 4);
|
||||
unsigned int max_decomp_size;
|
||||
int subsample_h, subsample_v;
|
||||
int partial_h_supported = 0;
|
||||
|
||||
if (avctx->extradata_size < 8) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Extradata size too small.\n");
|
||||
@@ -498,26 +511,24 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 1:1:1.\n");
|
||||
break;
|
||||
case IMGTYPE_YUV422:
|
||||
c->decomp_size = basesize * 2;
|
||||
c->decomp_size = (avctx->width & ~3) * avctx->height * 2;
|
||||
max_decomp_size = max_basesize * 2;
|
||||
avctx->pix_fmt = AV_PIX_FMT_YUV422P;
|
||||
av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 4:2:2.\n");
|
||||
if (avctx->width % 4) {
|
||||
avpriv_request_sample(avctx, "Unsupported dimensions");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
partial_h_supported = 1;
|
||||
break;
|
||||
case IMGTYPE_RGB24:
|
||||
c->decomp_size = basesize * 3;
|
||||
c->decomp_size = FFALIGN(avctx->width*3, 4) * avctx->height;
|
||||
max_decomp_size = max_basesize * 3;
|
||||
avctx->pix_fmt = AV_PIX_FMT_BGR24;
|
||||
av_log(avctx, AV_LOG_DEBUG, "Image type is RGB 24.\n");
|
||||
break;
|
||||
case IMGTYPE_YUV411:
|
||||
c->decomp_size = basesize / 2 * 3;
|
||||
c->decomp_size = (avctx->width & ~3) * avctx->height / 2 * 3;
|
||||
max_decomp_size = max_basesize / 2 * 3;
|
||||
avctx->pix_fmt = AV_PIX_FMT_YUV411P;
|
||||
av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 4:1:1.\n");
|
||||
partial_h_supported = 1;
|
||||
break;
|
||||
case IMGTYPE_YUV211:
|
||||
c->decomp_size = basesize * 2;
|
||||
@@ -537,7 +548,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &subsample_h, &subsample_v);
|
||||
if (avctx->width % (1<<subsample_h) || avctx->height % (1<<subsample_v)) {
|
||||
if ((avctx->width % (1<<subsample_h) && !partial_h_supported) || avctx->height % (1<<subsample_v)) {
|
||||
avpriv_request_sample(avctx, "Unsupported dimensions");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
|
||||
default: av_assert0(0);
|
||||
}
|
||||
|
||||
put_bits(pb, 16, 17);
|
||||
put_bits(pb, 16, 8 + 3 * components);
|
||||
if (lossless && ( avctx->pix_fmt == AV_PIX_FMT_BGR0
|
||||
|| avctx->pix_fmt == AV_PIX_FMT_BGRA
|
||||
|| avctx->pix_fmt == AV_PIX_FMT_BGR24))
|
||||
|
||||
+1
-1
@@ -520,7 +520,7 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
|
||||
|
||||
/* This should happen for TrueHD streams with >6 channels and MLP's noise
|
||||
* type. It is not yet known if this is allowed. */
|
||||
if (max_channel > MAX_MATRIX_CHANNEL_MLP && !noise_type) {
|
||||
if (max_matrix_channel > MAX_MATRIX_CHANNEL_MLP && !noise_type) {
|
||||
avpriv_request_sample(m->avctx,
|
||||
"%d channels (more than the "
|
||||
"maximum supported by the decoder)",
|
||||
|
||||
@@ -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];
|
||||
return mp_rgb_yuv_table[color & 0x7FFF];
|
||||
}
|
||||
|
||||
static void mp_set_rgb_from_yuv(MotionPixelsContext *mp, int x, int y, const YuvPixel *p)
|
||||
|
||||
@@ -44,6 +44,11 @@ static int noise(AVBSFContext *ctx, AVPacket *pkt)
|
||||
if (amount <= 0)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
if (ctx->par_in->codec_id == AV_CODEC_ID_WRAPPED_AVFRAME) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Wrapped AVFrame noising is unsupported\n");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
ret = ff_bsf_get_packet_ref(ctx, pkt);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -539,6 +539,8 @@ int ff_nvdec_simple_end_frame(AVCodecContext *avctx)
|
||||
NVDECContext *ctx = avctx->internal->hwaccel_priv_data;
|
||||
int ret = ff_nvdec_end_frame(avctx);
|
||||
ctx->bitstream = NULL;
|
||||
ctx->bitstream_len = 0;
|
||||
ctx->nb_slices = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,8 +76,9 @@ static int nvdec_mpeg12_start_frame(AVCodecContext *avctx, const uint8_t *buffer
|
||||
};
|
||||
|
||||
for (i = 0; i < 64; ++i) {
|
||||
ppc->QuantMatrixIntra[i] = s->intra_matrix[i];
|
||||
ppc->QuantMatrixInter[i] = s->inter_matrix[i];
|
||||
int n = s->idsp.idct_permutation[i];
|
||||
ppc->QuantMatrixIntra[i] = s->intra_matrix[n];
|
||||
ppc->QuantMatrixInter[i] = s->inter_matrix[n];
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -86,8 +86,9 @@ static int nvdec_mpeg4_start_frame(AVCodecContext *avctx, const uint8_t *buffer,
|
||||
};
|
||||
|
||||
for (i = 0; i < 64; ++i) {
|
||||
ppc->QuantMatrixIntra[i] = s->intra_matrix[i];
|
||||
ppc->QuantMatrixInter[i] = s->inter_matrix[i];
|
||||
int n = s->idsp.idct_permutation[i];
|
||||
ppc->QuantMatrixIntra[i] = s->intra_matrix[n];
|
||||
ppc->QuantMatrixInter[i] = s->inter_matrix[n];
|
||||
}
|
||||
|
||||
// We need to pass the full frame buffer and not just the slice
|
||||
|
||||
@@ -223,8 +223,6 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
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);
|
||||
|
||||
+9
-2
@@ -309,7 +309,7 @@ static void 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; i += 3 + alpha) { \
|
||||
for (i = 0; i < size - 2; i += 3 + alpha) { \
|
||||
int g = dst [i + 1]; \
|
||||
dst[i + 0] += g; \
|
||||
dst[i + 2] += g; \
|
||||
@@ -621,6 +621,8 @@ static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s,
|
||||
int ret;
|
||||
size_t byte_depth = s->bit_depth > 8 ? 2 : 1;
|
||||
|
||||
if (!p)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (!(s->hdr_state & PNG_IHDR)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "IDAT without IHDR\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -1295,6 +1297,8 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
|
||||
break;
|
||||
}
|
||||
case MKTAG('i', 'C', 'C', 'P'): {
|
||||
if (!p)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if ((ret = decode_iccp_chunk(s, length, p)) < 0)
|
||||
goto fail;
|
||||
break;
|
||||
@@ -1353,6 +1357,9 @@ skip_tag:
|
||||
}
|
||||
exit_loop:
|
||||
|
||||
if (!p)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (avctx->codec_id == AV_CODEC_ID_PNG &&
|
||||
avctx->skip_frame == AVDISCARD_ALL) {
|
||||
return 0;
|
||||
@@ -1499,7 +1506,7 @@ static int decode_frame_apng(AVCodecContext *avctx,
|
||||
s->zstream.zfree = ff_png_zfree;
|
||||
|
||||
bytestream2_init(&s->gb, avctx->extradata, avctx->extradata_size);
|
||||
if ((ret = decode_frame_common(avctx, s, p, avpkt)) < 0)
|
||||
if ((ret = decode_frame_common(avctx, s, NULL, avpkt)) < 0)
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
@@ -592,6 +592,9 @@ static int decompress_p(AVCodecContext *avctx,
|
||||
int run, z, bx = x * 16 + sx1, by = y * 16 + sy1;
|
||||
unsigned 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)
|
||||
|
||||
@@ -1543,10 +1543,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;
|
||||
@@ -1557,9 +1557,13 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -426,6 +426,8 @@ static int speedhq_decode_frame(AVCodecContext *avctx,
|
||||
|
||||
if (buf_size < 4 || avctx->width < 8 || avctx->width % 8 != 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (buf_size < avctx->width*avctx->height / 64 / 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
quality = buf[0];
|
||||
if (quality >= 100) {
|
||||
|
||||
+17
-2
@@ -19,6 +19,7 @@
|
||||
* 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"
|
||||
@@ -75,6 +76,12 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
|
||||
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;
|
||||
@@ -96,15 +103,23 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
|
||||
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);
|
||||
|
||||
if (buf_end - buf < maplength + (len * h) * 3 / 256)
|
||||
// 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)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
|
||||
@@ -118,7 +133,7 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
|
||||
} else if (maplength) {
|
||||
unsigned int len = maplength / 3;
|
||||
|
||||
if (maplength % 3 || maplength > 768) {
|
||||
if (maplength % 3) {
|
||||
av_log(avctx, AV_LOG_WARNING, "invalid colormap length\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@@ -167,6 +167,9 @@ int ff_tak_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
|
||||
if (ti->flags & TAK_FRAME_FLAG_HAS_METADATA)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (get_bits_left(gb) < 24)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
skip_bits(gb, 24);
|
||||
|
||||
return 0;
|
||||
|
||||
+24
-12
@@ -31,11 +31,13 @@ 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_mallocz_array(width, sizeof(DWTELEM));
|
||||
s.temp_idwt_buffer = av_mallocz_array(width, sizeof(IDWTELEM));
|
||||
@@ -49,24 +51,34 @@ 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) % 54321 - 12345;
|
||||
buffer[0][i] = buffer[1][i] = av_lfg_get(&prng) % 19000 - 9000;
|
||||
|
||||
ff_spatial_dwt(buffer[0], s.temp_dwt_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++)
|
||||
obuffer[i] = buffer[0][i];
|
||||
ff_spatial_idwt(obuffer, s.temp_idwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
|
||||
|
||||
for(i=0; i<width*height; i++)
|
||||
if(buffer[0][i]!= buffer[1][i]) printf("fsck: %6d %12d %7d\n",i, buffer[0][i], buffer[1][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;
|
||||
}
|
||||
|
||||
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) % 54321 - 12345;
|
||||
buffer[0][i] = buffer[1][i] = av_lfg_get(&prng) % 11000 - 5000;
|
||||
|
||||
ff_spatial_dwt(buffer[0], s.temp_dwt_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++)
|
||||
obuffer[i] = buffer[0][i];
|
||||
ff_spatial_idwt(obuffer, 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[0][i] - buffer[1][i])>20) printf("fsck: %6d %12d %7d\n",i, buffer[0][i], buffer[1][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;
|
||||
}
|
||||
|
||||
{
|
||||
int level, orientation, x, y;
|
||||
@@ -81,18 +93,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);
|
||||
DWTELEM *buf= buffer[0];
|
||||
IDWTELEM *buf= obuffer;
|
||||
int64_t error=0;
|
||||
|
||||
if(orientation&1) buf+=w;
|
||||
if(orientation>1) buf+=stride>>1;
|
||||
|
||||
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);
|
||||
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);
|
||||
for(y=0; y<height; y++){
|
||||
for(x=0; x<width; x++){
|
||||
int64_t d= buffer[0][x + y*width];
|
||||
int64_t d= obuffer[x + y*width];
|
||||
error += d*d;
|
||||
if(FFABS(width/2-x)<9 && FFABS(height/2-y)<9 && level==2) printf("%8"PRId64" ", d);
|
||||
}
|
||||
@@ -143,5 +155,5 @@ int main(void){
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
+7
-1
@@ -252,6 +252,8 @@ 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:
|
||||
@@ -317,12 +319,13 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||
}
|
||||
|
||||
if (s->codec_id == AV_CODEC_ID_IFF_ILBM) {
|
||||
w_align = FFMAX(w_align, 8);
|
||||
w_align = FFMAX(w_align, 16);
|
||||
}
|
||||
|
||||
*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,6 +339,9 @@ 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;
|
||||
|
||||
@@ -73,8 +73,9 @@ static int vdpau_mpeg_start_frame(AVCodecContext *avctx,
|
||||
info->f_code[1][0] = s->mpeg_f_code[1][0];
|
||||
info->f_code[1][1] = s->mpeg_f_code[1][1];
|
||||
for (i = 0; i < 64; ++i) {
|
||||
info->intra_quantizer_matrix[i] = s->intra_matrix[i];
|
||||
info->non_intra_quantizer_matrix[i] = s->inter_matrix[i];
|
||||
int n = s->idsp.idct_permutation[i];
|
||||
info->intra_quantizer_matrix[i] = s->intra_matrix[n];
|
||||
info->non_intra_quantizer_matrix[i] = s->inter_matrix[n];
|
||||
}
|
||||
|
||||
return ff_vdpau_common_start_frame(pic_ctx, buffer, size);
|
||||
|
||||
@@ -74,8 +74,9 @@ static int vdpau_mpeg4_start_frame(AVCodecContext *avctx,
|
||||
info->alternate_vertical_scan_flag = s->alternate_scan;
|
||||
info->top_field_first = s->top_field_first;
|
||||
for (i = 0; i < 64; ++i) {
|
||||
info->intra_quantizer_matrix[i] = s->intra_matrix[i];
|
||||
info->non_intra_quantizer_matrix[i] = s->inter_matrix[i];
|
||||
int n = s->idsp.idct_permutation[i];
|
||||
info->intra_quantizer_matrix[i] = s->intra_matrix[n];
|
||||
info->non_intra_quantizer_matrix[i] = s->inter_matrix[n];
|
||||
}
|
||||
|
||||
ff_vdpau_common_start_frame(pic_ctx, buffer, size);
|
||||
|
||||
@@ -60,7 +60,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 * sizeof(pixel);
|
||||
src += start_y * src_linesize + start_x * (ptrdiff_t)sizeof(pixel);
|
||||
buf += start_x * sizeof(pixel);
|
||||
|
||||
// top
|
||||
@@ -83,7 +83,7 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
|
||||
buf += buf_linesize;
|
||||
}
|
||||
|
||||
buf -= block_h * buf_linesize + start_x * sizeof(pixel);
|
||||
buf -= block_h * buf_linesize + start_x * (ptrdiff_t)sizeof(pixel);
|
||||
while (block_h--) {
|
||||
pixel *bufp = (pixel *) buf;
|
||||
|
||||
|
||||
@@ -363,6 +363,10 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
|
||||
unsigned codebook_value_bits = get_bits(gb, 4) + 1;
|
||||
unsigned codebook_sequence_p = get_bits1(gb);
|
||||
|
||||
if (!isfinite(codebook_minimum_value) || !isfinite(codebook_delta_value)) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto error;
|
||||
}
|
||||
ff_dlog(NULL, " We expect %d numbers for building the codevectors. \n",
|
||||
codebook_lookup_values);
|
||||
ff_dlog(NULL, " delta %f minmum %f \n",
|
||||
|
||||
+13
-2
@@ -1782,6 +1782,8 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
|
||||
s->avctx = avctx;
|
||||
s->width = FFALIGN(avctx->coded_width, 16);
|
||||
s->height = FFALIGN(avctx->coded_height, 16);
|
||||
if (s->width < 18)
|
||||
return AVERROR_PATCHWELCOME;
|
||||
if (avctx->codec_id != AV_CODEC_ID_THEORA)
|
||||
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
|
||||
avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
|
||||
@@ -2136,8 +2138,13 @@ static int vp3_decode_frame(AVCodecContext *avctx,
|
||||
if (ff_thread_get_buffer(avctx, &s->current_frame, AV_GET_BUFFER_FLAG_REF) < 0)
|
||||
goto error;
|
||||
|
||||
if (!s->edge_emu_buffer)
|
||||
if (!s->edge_emu_buffer) {
|
||||
s->edge_emu_buffer = av_malloc(9 * FFABS(s->current_frame.f->linesize[0]));
|
||||
if (!s->edge_emu_buffer) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
if (s->keyframe) {
|
||||
if (!s->theora) {
|
||||
@@ -2347,7 +2354,9 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
|
||||
/* sanity check */
|
||||
if (av_image_check_size(visible_width, visible_height, 0, avctx) < 0 ||
|
||||
visible_width + offset_x > s->width ||
|
||||
visible_height + offset_y > s->height) {
|
||||
visible_height + offset_y > s->height ||
|
||||
visible_width < 18
|
||||
) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Invalid frame dimensions - w:%d h:%d x:%d y:%d (%dx%d).\n",
|
||||
visible_width, visible_height, offset_x, offset_y,
|
||||
@@ -2393,6 +2402,8 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
|
||||
} else
|
||||
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
|
||||
|
||||
if (s->width < 18)
|
||||
return AVERROR_PATCHWELCOME;
|
||||
ret = ff_set_dimensions(avctx, s->width, s->height);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -95,7 +95,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 << 1) - e + get_bits1(gb);
|
||||
res = res * 2U - e + get_bits1(gb);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,12 +35,20 @@
|
||||
static av_always_inline av_const int MULL(int a, int b, unsigned shift)
|
||||
{
|
||||
int rt, dummy;
|
||||
if (__builtin_constant_p(shift))
|
||||
__asm__ (
|
||||
"imull %3 \n\t"
|
||||
"shrdl %4, %%edx, %%eax \n\t"
|
||||
:"=a"(rt), "=d"(dummy)
|
||||
:"a"(a), "rm"(b), "ci"((uint8_t)shift)
|
||||
:"a"(a), "rm"(b), "i"(shift & 0x1F)
|
||||
);
|
||||
else
|
||||
__asm__ (
|
||||
"imull %3 \n\t"
|
||||
"shrdl %4, %%edx, %%eax \n\t"
|
||||
:"=a"(rt), "=d"(dummy)
|
||||
:"a"(a), "rm"(b), "c"((uint8_t)shift)
|
||||
);
|
||||
return rt;
|
||||
}
|
||||
|
||||
@@ -113,19 +121,31 @@ __asm__ volatile(\
|
||||
// avoid +32 for shift optimization (gcc should do that ...)
|
||||
#define NEG_SSR32 NEG_SSR32
|
||||
static inline int32_t NEG_SSR32( int32_t a, int8_t s){
|
||||
if (__builtin_constant_p(s))
|
||||
__asm__ ("sarl %1, %0\n\t"
|
||||
: "+r" (a)
|
||||
: "ic" ((uint8_t)(-s))
|
||||
: "i" (-s & 0x1F)
|
||||
);
|
||||
else
|
||||
__asm__ ("sarl %1, %0\n\t"
|
||||
: "+r" (a)
|
||||
: "c" ((uint8_t)(-s))
|
||||
);
|
||||
return a;
|
||||
}
|
||||
|
||||
#define NEG_USR32 NEG_USR32
|
||||
static inline uint32_t NEG_USR32(uint32_t a, int8_t s){
|
||||
if (__builtin_constant_p(s))
|
||||
__asm__ ("shrl %1, %0\n\t"
|
||||
: "+r" (a)
|
||||
: "ic" ((uint8_t)(-s))
|
||||
: "i" (-s & 0x1F)
|
||||
);
|
||||
else
|
||||
__asm__ ("shrl %1, %0\n\t"
|
||||
: "+r" (a)
|
||||
: "c" ((uint8_t)(-s))
|
||||
);
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
@@ -351,6 +351,9 @@ static int xpm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (size > SIZE_MAX / 4)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
size *= 4;
|
||||
|
||||
ptr += mod_strcspn(ptr, ",") + 1;
|
||||
|
||||
+2
-2
@@ -376,10 +376,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)
|
||||
if (decode_str(s, pb, encoding, &descriptor, &taglen) < 0 || taglen < 0)
|
||||
goto error;
|
||||
|
||||
if (decode_str(s, pb, encoding, &text, &taglen) < 0)
|
||||
if (decode_str(s, pb, encoding, &text, &taglen) < 0 || taglen < 0)
|
||||
goto error;
|
||||
|
||||
// FFmpeg does not support hierarchical metadata, so concatenate the keys.
|
||||
|
||||
+9
-1
@@ -3901,6 +3901,13 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
|
||||
if (keyframe)
|
||||
distance = 0;
|
||||
sample_size = sc->stsz_sample_size > 0 ? sc->stsz_sample_size : sc->sample_sizes[current_sample];
|
||||
if (current_offset > INT64_MAX - sample_size) {
|
||||
av_log(mov->fc, AV_LOG_ERROR, "Current offset %"PRId64" or sample size %u is too large\n",
|
||||
current_offset,
|
||||
sample_size);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sc->pseudo_stream_id == -1 ||
|
||||
sc->stsc_data[stsc_index].id - 1 == sc->pseudo_stream_id) {
|
||||
AVIndexEntry *e;
|
||||
@@ -4346,12 +4353,13 @@ static int mov_read_keys(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
for (i = 1; i <= count; ++i) {
|
||||
uint32_t key_size = avio_rb32(pb);
|
||||
uint32_t type = avio_rl32(pb);
|
||||
if (key_size < 8) {
|
||||
if (key_size < 8 || key_size > atom.size) {
|
||||
av_log(c->fc, AV_LOG_ERROR,
|
||||
"The key# %"PRIu32" in meta has invalid size:"
|
||||
"%"PRIu32"\n", i, key_size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
atom.size -= key_size;
|
||||
key_size -= 8;
|
||||
if (type != MKTAG('m','d','t','a')) {
|
||||
avio_skip(pb, key_size);
|
||||
|
||||
+12
-4
@@ -358,8 +358,12 @@ static int decode_main_header(NUTContext *nut)
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
for (i = 0; i < stream_count; i++)
|
||||
avformat_new_stream(s, NULL);
|
||||
for (i = 0; i < stream_count; i++) {
|
||||
if (!avformat_new_stream(s, NULL)) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
fail:
|
||||
@@ -805,19 +809,23 @@ static int nut_read_header(AVFormatContext *s)
|
||||
NUTContext *nut = s->priv_data;
|
||||
AVIOContext *bc = s->pb;
|
||||
int64_t pos;
|
||||
int initialized_stream_count;
|
||||
int initialized_stream_count, ret;
|
||||
|
||||
nut->avf = s;
|
||||
|
||||
/* main header */
|
||||
pos = 0;
|
||||
ret = 0;
|
||||
do {
|
||||
if (ret == AVERROR(ENOMEM))
|
||||
return ret;
|
||||
|
||||
pos = find_startcode(bc, MAIN_STARTCODE, pos) + 1;
|
||||
if (pos < 0 + 1) {
|
||||
av_log(s, AV_LOG_ERROR, "No main startcode found.\n");
|
||||
goto fail;
|
||||
}
|
||||
} while (decode_main_header(nut) < 0);
|
||||
} while ((ret = decode_main_header(nut)) < 0);
|
||||
|
||||
/* stream headers */
|
||||
pos = 0;
|
||||
|
||||
@@ -61,7 +61,7 @@ static int32_t parse_value(const char *value, int32_t min)
|
||||
}
|
||||
}
|
||||
|
||||
if (abs(db) > (INT32_MAX - mb) / 100000)
|
||||
if (llabs(db) > (INT32_MAX - mb) / 100000)
|
||||
return min;
|
||||
|
||||
return db * 100000 + sign * mb;
|
||||
|
||||
@@ -647,6 +647,10 @@ smv_retry:
|
||||
goto smv_out;
|
||||
}
|
||||
size = avio_rl24(s->pb);
|
||||
if (size > wav->smv_block_size) {
|
||||
ret = AVERROR_EOF;
|
||||
goto smv_out;
|
||||
}
|
||||
ret = av_get_packet(s->pb, pkt, size);
|
||||
if (ret < 0)
|
||||
goto smv_out;
|
||||
|
||||
@@ -118,8 +118,8 @@
|
||||
.endm
|
||||
|
||||
.macro increment_yuv422p
|
||||
add x6, x6, w7, UXTW // srcU += incU
|
||||
add x13, x13, w14, UXTW // srcV += incV
|
||||
add x6, x6, w7, SXTW // srcU += incU
|
||||
add x13, x13, w14, SXTW // srcV += incV
|
||||
.endm
|
||||
|
||||
.macro compute_rgba r1 g1 b1 a1 r2 g2 b2 a2
|
||||
@@ -188,8 +188,8 @@ function ff_\ifmt\()_to_\ofmt\()_neon, export=1
|
||||
st4 {v16.8B,v17.8B,v18.8B,v19.8B}, [x2], #32
|
||||
subs w8, w8, #16 // width -= 16
|
||||
b.gt 2b
|
||||
add x2, x2, w3, UXTW // dst += padding
|
||||
add x4, x4, w5, UXTW // srcY += paddingY
|
||||
add x2, x2, w3, SXTW // dst += padding
|
||||
add x4, x4, w5, SXTW // srcY += paddingY
|
||||
increment_\ifmt
|
||||
subs w1, w1, #1 // height -= 1
|
||||
b.gt 1b
|
||||
|
||||
+12
-12
@@ -84,9 +84,9 @@ rgb64ToUV_half_c_template(uint16_t *dstU, uint16_t *dstV,
|
||||
int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
|
||||
av_assert1(src1==src2);
|
||||
for (i = 0; i < width; i++) {
|
||||
int r_b = (input_pixel(&src1[8 * i + 0]) + input_pixel(&src1[8 * i + 4]) + 1) >> 1;
|
||||
int g = (input_pixel(&src1[8 * i + 1]) + input_pixel(&src1[8 * i + 5]) + 1) >> 1;
|
||||
int b_r = (input_pixel(&src1[8 * i + 2]) + input_pixel(&src1[8 * i + 6]) + 1) >> 1;
|
||||
unsigned r_b = (input_pixel(&src1[8 * i + 0]) + input_pixel(&src1[8 * i + 4]) + 1) >> 1;
|
||||
unsigned g = (input_pixel(&src1[8 * i + 1]) + input_pixel(&src1[8 * i + 5]) + 1) >> 1;
|
||||
unsigned b_r = (input_pixel(&src1[8 * i + 2]) + input_pixel(&src1[8 * i + 6]) + 1) >> 1;
|
||||
|
||||
dstU[i]= (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
|
||||
dstV[i]= (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
|
||||
@@ -156,9 +156,9 @@ static av_always_inline void rgb48ToUV_c_template(uint16_t *dstU,
|
||||
int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
|
||||
av_assert1(src1 == src2);
|
||||
for (i = 0; i < width; i++) {
|
||||
int r_b = input_pixel(&src1[i * 3 + 0]);
|
||||
int g = input_pixel(&src1[i * 3 + 1]);
|
||||
int b_r = input_pixel(&src1[i * 3 + 2]);
|
||||
unsigned r_b = input_pixel(&src1[i * 3 + 0]);
|
||||
unsigned g = input_pixel(&src1[i * 3 + 1]);
|
||||
unsigned b_r = input_pixel(&src1[i * 3 + 2]);
|
||||
|
||||
dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
|
||||
dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
|
||||
@@ -178,12 +178,12 @@ static av_always_inline void rgb48ToUV_half_c_template(uint16_t *dstU,
|
||||
int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
|
||||
av_assert1(src1 == src2);
|
||||
for (i = 0; i < width; i++) {
|
||||
int r_b = (input_pixel(&src1[6 * i + 0]) +
|
||||
input_pixel(&src1[6 * i + 3]) + 1) >> 1;
|
||||
int g = (input_pixel(&src1[6 * i + 1]) +
|
||||
input_pixel(&src1[6 * i + 4]) + 1) >> 1;
|
||||
int b_r = (input_pixel(&src1[6 * i + 2]) +
|
||||
input_pixel(&src1[6 * i + 5]) + 1) >> 1;
|
||||
unsigned r_b = (input_pixel(&src1[6 * i + 0]) +
|
||||
input_pixel(&src1[6 * i + 3]) + 1) >> 1;
|
||||
unsigned g = (input_pixel(&src1[6 * i + 1]) +
|
||||
input_pixel(&src1[6 * i + 4]) + 1) >> 1;
|
||||
unsigned b_r = (input_pixel(&src1[6 * i + 2]) +
|
||||
input_pixel(&src1[6 * i + 5]) + 1) >> 1;
|
||||
|
||||
dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
|
||||
dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
|
||||
|
||||
+60
-60
@@ -1047,8 +1047,8 @@ yuv2rgba64_X_c_template(SwsContext *c, const int16_t *lumFilter,
|
||||
Y2 -= c->yuv2rgb_y_offset;
|
||||
Y1 *= c->yuv2rgb_y_coeff;
|
||||
Y2 *= c->yuv2rgb_y_coeff;
|
||||
Y1 += 1 << 13; // 21
|
||||
Y2 += 1 << 13;
|
||||
Y1 += (1 << 13) - (1 << 29); // 21
|
||||
Y2 += (1 << 13) - (1 << 29);
|
||||
// 8 bits: 17 + 13 bits = 30 bits, 16 bits: 17 + 13 bits = 30 bits
|
||||
|
||||
R = V * c->yuv2rgb_v2r_coeff;
|
||||
@@ -1056,20 +1056,20 @@ yuv2rgba64_X_c_template(SwsContext *c, const int16_t *lumFilter,
|
||||
B = U * c->yuv2rgb_u2b_coeff;
|
||||
|
||||
// 8 bits: 30 - 22 = 8 bits, 16 bits: 30 bits - 14 = 16 bits
|
||||
output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
|
||||
output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
|
||||
output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
|
||||
output_pixel(&dest[0], av_clip_uintp2(((R_B + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[1], av_clip_uintp2((( G + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[2], av_clip_uintp2(((B_R + Y1) >> 14) + (1<<15), 16));
|
||||
if (eightbytes) {
|
||||
output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14);
|
||||
output_pixel(&dest[4], av_clip_uintp2(R_B + Y2, 30) >> 14);
|
||||
output_pixel(&dest[5], av_clip_uintp2( G + Y2, 30) >> 14);
|
||||
output_pixel(&dest[6], av_clip_uintp2(B_R + Y2, 30) >> 14);
|
||||
output_pixel(&dest[4], av_clip_uintp2(((R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[6], av_clip_uintp2(((B_R + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14);
|
||||
dest += 8;
|
||||
} else {
|
||||
output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14);
|
||||
output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14);
|
||||
output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14);
|
||||
output_pixel(&dest[3], av_clip_uintp2(((R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[4], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2(((B_R + Y2) >> 14) + (1<<15), 16));
|
||||
dest += 6;
|
||||
}
|
||||
}
|
||||
@@ -1106,8 +1106,8 @@ yuv2rgba64_2_c_template(SwsContext *c, const int32_t *buf[2],
|
||||
Y2 -= c->yuv2rgb_y_offset;
|
||||
Y1 *= c->yuv2rgb_y_coeff;
|
||||
Y2 *= c->yuv2rgb_y_coeff;
|
||||
Y1 += 1 << 13;
|
||||
Y2 += 1 << 13;
|
||||
Y1 += (1 << 13) - (1 << 29);
|
||||
Y2 += (1 << 13) - (1 << 29);
|
||||
|
||||
R = V * c->yuv2rgb_v2r_coeff;
|
||||
G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
|
||||
@@ -1121,20 +1121,20 @@ yuv2rgba64_2_c_template(SwsContext *c, const int32_t *buf[2],
|
||||
A2 += 1 << 13;
|
||||
}
|
||||
|
||||
output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
|
||||
output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
|
||||
output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
|
||||
output_pixel(&dest[0], av_clip_uintp2(((R_B + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[1], av_clip_uintp2((( G + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[2], av_clip_uintp2(((B_R + Y1) >> 14) + (1<<15), 16));
|
||||
if (eightbytes) {
|
||||
output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14);
|
||||
output_pixel(&dest[4], av_clip_uintp2(R_B + Y2, 30) >> 14);
|
||||
output_pixel(&dest[5], av_clip_uintp2( G + Y2, 30) >> 14);
|
||||
output_pixel(&dest[6], av_clip_uintp2(B_R + Y2, 30) >> 14);
|
||||
output_pixel(&dest[4], av_clip_uintp2(((R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[6], av_clip_uintp2(((B_R + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14);
|
||||
dest += 8;
|
||||
} else {
|
||||
output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14);
|
||||
output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14);
|
||||
output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14);
|
||||
output_pixel(&dest[3], av_clip_uintp2(((R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[4], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2(((B_R + Y2) >> 14) + (1<<15), 16));
|
||||
dest += 6;
|
||||
}
|
||||
}
|
||||
@@ -1162,8 +1162,8 @@ yuv2rgba64_1_c_template(SwsContext *c, const int32_t *buf0,
|
||||
Y2 -= c->yuv2rgb_y_offset;
|
||||
Y1 *= c->yuv2rgb_y_coeff;
|
||||
Y2 *= c->yuv2rgb_y_coeff;
|
||||
Y1 += 1 << 13;
|
||||
Y2 += 1 << 13;
|
||||
Y1 += (1 << 13) - (1 << 29);
|
||||
Y2 += (1 << 13) - (1 << 29);
|
||||
|
||||
if (hasAlpha) {
|
||||
A1 = abuf0[i * 2 ] << 11;
|
||||
@@ -1177,20 +1177,20 @@ yuv2rgba64_1_c_template(SwsContext *c, const int32_t *buf0,
|
||||
G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
|
||||
B = U * c->yuv2rgb_u2b_coeff;
|
||||
|
||||
output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
|
||||
output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
|
||||
output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
|
||||
output_pixel(&dest[0], av_clip_uintp2(((R_B + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[1], av_clip_uintp2((( G + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[2], av_clip_uintp2(((B_R + Y1) >> 14) + (1<<15), 16));
|
||||
if (eightbytes) {
|
||||
output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14);
|
||||
output_pixel(&dest[4], av_clip_uintp2(R_B + Y2, 30) >> 14);
|
||||
output_pixel(&dest[5], av_clip_uintp2( G + Y2, 30) >> 14);
|
||||
output_pixel(&dest[6], av_clip_uintp2(B_R + Y2, 30) >> 14);
|
||||
output_pixel(&dest[4], av_clip_uintp2(((R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[6], av_clip_uintp2(((B_R + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14);
|
||||
dest += 8;
|
||||
} else {
|
||||
output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14);
|
||||
output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14);
|
||||
output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14);
|
||||
output_pixel(&dest[3], av_clip_uintp2(((R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[4], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2(((B_R + Y2) >> 14) + (1<<15), 16));
|
||||
dest += 6;
|
||||
}
|
||||
}
|
||||
@@ -1208,8 +1208,8 @@ yuv2rgba64_1_c_template(SwsContext *c, const int32_t *buf0,
|
||||
Y2 -= c->yuv2rgb_y_offset;
|
||||
Y1 *= c->yuv2rgb_y_coeff;
|
||||
Y2 *= c->yuv2rgb_y_coeff;
|
||||
Y1 += 1 << 13;
|
||||
Y2 += 1 << 13;
|
||||
Y1 += (1 << 13) - (1 << 29);
|
||||
Y2 += (1 << 13) - (1 << 29);
|
||||
|
||||
if (hasAlpha) {
|
||||
A1 = abuf0[i * 2 ] << 11;
|
||||
@@ -1223,20 +1223,20 @@ yuv2rgba64_1_c_template(SwsContext *c, const int32_t *buf0,
|
||||
G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
|
||||
B = U * c->yuv2rgb_u2b_coeff;
|
||||
|
||||
output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
|
||||
output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
|
||||
output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
|
||||
output_pixel(&dest[0], av_clip_uintp2(((R_B + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[1], av_clip_uintp2((( G + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[2], av_clip_uintp2(((B_R + Y1) >> 14) + (1<<15), 16));
|
||||
if (eightbytes) {
|
||||
output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14);
|
||||
output_pixel(&dest[4], av_clip_uintp2(R_B + Y2, 30) >> 14);
|
||||
output_pixel(&dest[5], av_clip_uintp2( G + Y2, 30) >> 14);
|
||||
output_pixel(&dest[6], av_clip_uintp2(B_R + Y2, 30) >> 14);
|
||||
output_pixel(&dest[4], av_clip_uintp2(((R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[6], av_clip_uintp2(((B_R + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14);
|
||||
dest += 8;
|
||||
} else {
|
||||
output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14);
|
||||
output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14);
|
||||
output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14);
|
||||
output_pixel(&dest[3], av_clip_uintp2(((R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[4], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2(((B_R + Y2) >> 14) + (1<<15), 16));
|
||||
dest += 6;
|
||||
}
|
||||
}
|
||||
@@ -1287,7 +1287,7 @@ yuv2rgba64_full_X_c_template(SwsContext *c, const int16_t *lumFilter,
|
||||
// 8bit: 27 -> 17bit, 16bit: 31 - 14 = 17bit
|
||||
Y -= c->yuv2rgb_y_offset;
|
||||
Y *= c->yuv2rgb_y_coeff;
|
||||
Y += 1 << 13; // 21
|
||||
Y += (1 << 13) - (1<<29); // 21
|
||||
// 8bit: 17 + 13bit = 30bit, 16bit: 17 + 13bit = 30bit
|
||||
|
||||
R = V * c->yuv2rgb_v2r_coeff;
|
||||
@@ -1295,9 +1295,9 @@ yuv2rgba64_full_X_c_template(SwsContext *c, const int16_t *lumFilter,
|
||||
B = U * c->yuv2rgb_u2b_coeff;
|
||||
|
||||
// 8bit: 30 - 22 = 8bit, 16bit: 30bit - 14 = 16bit
|
||||
output_pixel(&dest[0], av_clip_uintp2(R_B + Y, 30) >> 14);
|
||||
output_pixel(&dest[1], av_clip_uintp2( G + Y, 30) >> 14);
|
||||
output_pixel(&dest[2], av_clip_uintp2(B_R + Y, 30) >> 14);
|
||||
output_pixel(&dest[0], av_clip_uintp2(((R_B + Y)>>14) + (1<<15), 16));
|
||||
output_pixel(&dest[1], av_clip_uintp2((( G + Y)>>14) + (1<<15), 16));
|
||||
output_pixel(&dest[2], av_clip_uintp2(((B_R + Y)>>14) + (1<<15), 16));
|
||||
if (eightbytes) {
|
||||
output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14);
|
||||
dest += 4;
|
||||
@@ -1335,7 +1335,7 @@ yuv2rgba64_full_2_c_template(SwsContext *c, const int32_t *buf[2],
|
||||
|
||||
Y -= c->yuv2rgb_y_offset;
|
||||
Y *= c->yuv2rgb_y_coeff;
|
||||
Y += 1 << 13;
|
||||
Y += (1 << 13) - (1 << 29);
|
||||
|
||||
R = V * c->yuv2rgb_v2r_coeff;
|
||||
G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
|
||||
@@ -1347,9 +1347,9 @@ yuv2rgba64_full_2_c_template(SwsContext *c, const int32_t *buf[2],
|
||||
A += 1 << 13;
|
||||
}
|
||||
|
||||
output_pixel(&dest[0], av_clip_uintp2(R_B + Y, 30) >> 14);
|
||||
output_pixel(&dest[1], av_clip_uintp2( G + Y, 30) >> 14);
|
||||
output_pixel(&dest[2], av_clip_uintp2(B_R + Y, 30) >> 14);
|
||||
output_pixel(&dest[0], av_clip_uintp2(((R_B + Y) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[1], av_clip_uintp2((( G + Y) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[2], av_clip_uintp2(((B_R + Y) >> 14) + (1<<15), 16));
|
||||
if (eightbytes) {
|
||||
output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14);
|
||||
dest += 4;
|
||||
@@ -1378,7 +1378,7 @@ yuv2rgba64_full_1_c_template(SwsContext *c, const int32_t *buf0,
|
||||
|
||||
Y -= c->yuv2rgb_y_offset;
|
||||
Y *= c->yuv2rgb_y_coeff;
|
||||
Y += 1 << 13;
|
||||
Y += (1 << 13) - (1 << 29);
|
||||
|
||||
if (hasAlpha) {
|
||||
A = abuf0[i] << 11;
|
||||
@@ -1390,9 +1390,9 @@ yuv2rgba64_full_1_c_template(SwsContext *c, const int32_t *buf0,
|
||||
G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
|
||||
B = U * c->yuv2rgb_u2b_coeff;
|
||||
|
||||
output_pixel(&dest[0], av_clip_uintp2(R_B + Y, 30) >> 14);
|
||||
output_pixel(&dest[1], av_clip_uintp2( G + Y, 30) >> 14);
|
||||
output_pixel(&dest[2], av_clip_uintp2(B_R + Y, 30) >> 14);
|
||||
output_pixel(&dest[0], av_clip_uintp2(((R_B + Y) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[1], av_clip_uintp2((( G + Y) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[2], av_clip_uintp2(((B_R + Y) >> 14) + (1<<15), 16));
|
||||
if (eightbytes) {
|
||||
output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14);
|
||||
dest += 4;
|
||||
@@ -1411,7 +1411,7 @@ yuv2rgba64_full_1_c_template(SwsContext *c, const int32_t *buf0,
|
||||
|
||||
Y -= c->yuv2rgb_y_offset;
|
||||
Y *= c->yuv2rgb_y_coeff;
|
||||
Y += 1 << 13;
|
||||
Y += (1 << 13) - (1 << 29);
|
||||
|
||||
if (hasAlpha) {
|
||||
A = abuf0[i] << 11;
|
||||
@@ -1423,9 +1423,9 @@ yuv2rgba64_full_1_c_template(SwsContext *c, const int32_t *buf0,
|
||||
G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
|
||||
B = U * c->yuv2rgb_u2b_coeff;
|
||||
|
||||
output_pixel(&dest[0], av_clip_uintp2(R_B + Y, 30) >> 14);
|
||||
output_pixel(&dest[1], av_clip_uintp2( G + Y, 30) >> 14);
|
||||
output_pixel(&dest[2], av_clip_uintp2(B_R + Y, 30) >> 14);
|
||||
output_pixel(&dest[0], av_clip_uintp2(((R_B + Y) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[1], av_clip_uintp2((( G + Y) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[2], av_clip_uintp2(((B_R + Y) >> 14) + (1<<15), 16));
|
||||
if (eightbytes) {
|
||||
output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14);
|
||||
dest += 4;
|
||||
|
||||
@@ -51,7 +51,8 @@ static void test_vector_fmul(const float *src0, const float *src1)
|
||||
call_ref(cdst, src0, src1, LEN);
|
||||
call_new(odst, src0, src1, LEN);
|
||||
for (i = 0; i < LEN; i++) {
|
||||
if (!float_near_abs_eps(cdst[i], odst[i], FLT_EPSILON)) {
|
||||
double t = fabs(src0[i]) + fabs(src1[i]) + fabs(src0[i] * src1[i]) + 1.0;
|
||||
if (!float_near_abs_eps(cdst[i], odst[i], t * 2 * FLT_EPSILON)) {
|
||||
fprintf(stderr, "%d: %- .12f - %- .12f = % .12g\n",
|
||||
i, cdst[i], odst[i], cdst[i] - odst[i]);
|
||||
fail();
|
||||
@@ -73,7 +74,8 @@ static void test_vector_dmul(const double *src0, const double *src1)
|
||||
call_ref(cdst, src0, src1, LEN);
|
||||
call_new(odst, src0, src1, LEN);
|
||||
for (i = 0; i < LEN; i++) {
|
||||
if (!double_near_abs_eps(cdst[i], odst[i], DBL_EPSILON)) {
|
||||
double t = fabs(src0[i]) + fabs(src1[i]) + fabs(src0[i] * src1[i]) + 1.0;
|
||||
if (!double_near_abs_eps(cdst[i], odst[i], t * 2 * DBL_EPSILON)) {
|
||||
fprintf(stderr, "%d: %- .12f - %- .12f = % .12g\n",
|
||||
i, cdst[i], odst[i], cdst[i] - odst[i]);
|
||||
fail();
|
||||
@@ -117,7 +119,8 @@ static void test_vector_fmul_scalar(const float *src0, const float *src1)
|
||||
call_ref(cdst, src0, src1[0], LEN);
|
||||
call_new(odst, src0, src1[0], LEN);
|
||||
for (i = 0; i < LEN; i++) {
|
||||
if (!float_near_abs_eps(cdst[i], odst[i], FLT_EPSILON)) {
|
||||
double t = fabs(src0[i]) + fabs(src1[0]) + fabs(src0[i] * src1[0]) + 1.0;
|
||||
if (!float_near_abs_eps(cdst[i], odst[i], t * 2 * FLT_EPSILON)) {
|
||||
fprintf(stderr, "%d: %- .12f - %- .12f = % .12g\n",
|
||||
i, cdst[i], odst[i], cdst[i] - odst[i]);
|
||||
fail();
|
||||
|
||||
@@ -2,45 +2,45 @@ ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5652 size: 3035
|
||||
ret: 0 st:-1 flags:0 ts:-1.000000
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5652 size: 3035
|
||||
ret: 0 st:-1 flags:1 ts: 1.894167
|
||||
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 39806 size: 3640
|
||||
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 39690 size: 3640
|
||||
ret: 0 st: 0 flags:0 ts: 0.800000
|
||||
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 27442 size: 3494
|
||||
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 27382 size: 3493
|
||||
ret:-1 st: 0 flags:1 ts:-0.320000
|
||||
ret:-1 st:-1 flags:0 ts: 2.576668
|
||||
ret: 0 st:-1 flags:1 ts: 1.470835
|
||||
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 39806 size: 3640
|
||||
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 39690 size: 3640
|
||||
ret: 0 st: 0 flags:0 ts: 0.360000
|
||||
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 16134 size: 3244
|
||||
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 16074 size: 3245
|
||||
ret:-1 st: 0 flags:1 ts:-0.760000
|
||||
ret:-1 st:-1 flags:0 ts: 2.153336
|
||||
ret: 0 st:-1 flags:1 ts: 1.047503
|
||||
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 27442 size: 3494
|
||||
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 27382 size: 3493
|
||||
ret: 0 st: 0 flags:0 ts:-0.040000
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5652 size: 3035
|
||||
ret: 0 st: 0 flags:1 ts: 2.840000
|
||||
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 52608 size: 3582
|
||||
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 52538 size: 3582
|
||||
ret: 0 st:-1 flags:0 ts: 1.730004
|
||||
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 52608 size: 3582
|
||||
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 52538 size: 3582
|
||||
ret: 0 st:-1 flags:1 ts: 0.624171
|
||||
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 16134 size: 3244
|
||||
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 16074 size: 3245
|
||||
ret: 0 st: 0 flags:0 ts:-0.480000
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5652 size: 3035
|
||||
ret: 0 st: 0 flags:1 ts: 2.400000
|
||||
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 52608 size: 3582
|
||||
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 52538 size: 3582
|
||||
ret: 0 st:-1 flags:0 ts: 1.306672
|
||||
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 39806 size: 3640
|
||||
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 39690 size: 3640
|
||||
ret: 0 st:-1 flags:1 ts: 0.200839
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5652 size: 3035
|
||||
ret: 0 st: 0 flags:0 ts:-0.920000
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5652 size: 3035
|
||||
ret: 0 st: 0 flags:1 ts: 2.000000
|
||||
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 52608 size: 3582
|
||||
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 52538 size: 3582
|
||||
ret: 0 st:-1 flags:0 ts: 0.883340
|
||||
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 27442 size: 3494
|
||||
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 27382 size: 3493
|
||||
ret:-1 st:-1 flags:1 ts:-0.222493
|
||||
ret:-1 st: 0 flags:0 ts: 2.680000
|
||||
ret: 0 st: 0 flags:1 ts: 1.560000
|
||||
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 39806 size: 3640
|
||||
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 39690 size: 3640
|
||||
ret: 0 st:-1 flags:0 ts: 0.460008
|
||||
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 16134 size: 3244
|
||||
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 16074 size: 3245
|
||||
ret:-1 st:-1 flags:1 ts:-0.645825
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
67c10f8d52fcd1103caa675a1408bf6e *tests/data/fate/vsynth1-snow.avi
|
||||
136088 tests/data/fate/vsynth1-snow.avi
|
||||
bfc0bcc4bc7b956933aa58acc587018d *tests/data/fate/vsynth1-snow.out.rawvideo
|
||||
stddev: 22.77 PSNR: 20.98 MAXDIFF: 175 bytes: 7603200/ 7603200
|
||||
c4c77a6fb926b89fe6591c398f5cd4db *tests/data/fate/vsynth1-snow.avi
|
||||
136160 tests/data/fate/vsynth1-snow.avi
|
||||
dcf8b3f62d9c3ae2b2d0fbbacbf83e4e *tests/data/fate/vsynth1-snow.out.rawvideo
|
||||
stddev: 22.74 PSNR: 20.99 MAXDIFF: 173 bytes: 7603200/ 7603200
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
e62ae25d5040d04622a965bcb27fdb1e *tests/data/fate/vsynth1-snow-hpel.avi
|
||||
138446 tests/data/fate/vsynth1-snow-hpel.avi
|
||||
57c914cd150f8fc260b5989ce3e5884c *tests/data/fate/vsynth1-snow-hpel.out.rawvideo
|
||||
stddev: 22.74 PSNR: 20.99 MAXDIFF: 172 bytes: 7603200/ 7603200
|
||||
5c9eb93646eb0e5570d37e9adc9625e4 *tests/data/fate/vsynth1-snow-hpel.avi
|
||||
138580 tests/data/fate/vsynth1-snow-hpel.avi
|
||||
3382bdde624d8bb4af206a5ac6614605 *tests/data/fate/vsynth1-snow-hpel.out.rawvideo
|
||||
stddev: 22.71 PSNR: 21.00 MAXDIFF: 171 bytes: 7603200/ 7603200
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
0a41e73ddd2f54936490655b46dad4a3 *tests/data/fate/vsynth2-snow.avi
|
||||
72868 tests/data/fate/vsynth2-snow.avi
|
||||
34a75f5cf8a71159f1a572d9cedcfef9 *tests/data/fate/vsynth2-snow.out.rawvideo
|
||||
stddev: 13.73 PSNR: 25.37 MAXDIFF: 162 bytes: 7603200/ 7603200
|
||||
5e130d6a48b69348eee7f7c76c5869a3 *tests/data/fate/vsynth2-snow.avi
|
||||
72942 tests/data/fate/vsynth2-snow.avi
|
||||
9b6cee60e3ec0d1f312a8a25a7878fcc *tests/data/fate/vsynth2-snow.out.rawvideo
|
||||
stddev: 13.39 PSNR: 25.59 MAXDIFF: 154 bytes: 7603200/ 7603200
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
9bc409e4794ee50691a26c9c836d31a7 *tests/data/fate/vsynth2-snow-hpel.avi
|
||||
79728 tests/data/fate/vsynth2-snow-hpel.avi
|
||||
2cc64d8171175a1532fd7d3ed3011fbf *tests/data/fate/vsynth2-snow-hpel.out.rawvideo
|
||||
stddev: 13.70 PSNR: 25.39 MAXDIFF: 162 bytes: 7603200/ 7603200
|
||||
8edcf0fd7f066972ff77d5b891ed6dde *tests/data/fate/vsynth2-snow-hpel.avi
|
||||
79798 tests/data/fate/vsynth2-snow-hpel.avi
|
||||
7e0f2a24feda6fb3e54b85511a28c45f *tests/data/fate/vsynth2-snow-hpel.out.rawvideo
|
||||
stddev: 13.35 PSNR: 25.62 MAXDIFF: 157 bytes: 7603200/ 7603200
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
8e96f337e8f4ccac7d72ef517e1d2208 *tests/data/fate/vsynth_lena-snow.avi
|
||||
57680 tests/data/fate/vsynth_lena-snow.avi
|
||||
90963cfd2359d460001c94d94256dc2b *tests/data/fate/vsynth_lena-snow.out.rawvideo
|
||||
stddev: 10.48 PSNR: 27.72 MAXDIFF: 119 bytes: 7603200/ 7603200
|
||||
bf2cf9cacc1d98388798be98872049ee *tests/data/fate/vsynth_lena-snow.avi
|
||||
57604 tests/data/fate/vsynth_lena-snow.avi
|
||||
707a42eb20195913be55ba8dfadf72fb *tests/data/fate/vsynth_lena-snow.out.rawvideo
|
||||
stddev: 10.37 PSNR: 27.81 MAXDIFF: 120 bytes: 7603200/ 7603200
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
56b14cb1cbb637536233982e87f7ac3e *tests/data/fate/vsynth_lena-snow-hpel.avi
|
||||
61764 tests/data/fate/vsynth_lena-snow-hpel.avi
|
||||
244b0266127fa354d8485234b2c388e4 *tests/data/fate/vsynth_lena-snow-hpel.out.rawvideo
|
||||
stddev: 10.45 PSNR: 27.74 MAXDIFF: 119 bytes: 7603200/ 7603200
|
||||
c6ec87a11415a99b1a781f9f5bacb722 *tests/data/fate/vsynth_lena-snow-hpel.avi
|
||||
61814 tests/data/fate/vsynth_lena-snow-hpel.avi
|
||||
40f330397b7acf6bdbb3ec6d908be451 *tests/data/fate/vsynth_lena-snow-hpel.out.rawvideo
|
||||
stddev: 10.34 PSNR: 27.83 MAXDIFF: 118 bytes: 7603200/ 7603200
|
||||
|
||||
Reference in New Issue
Block a user