Compare commits
49 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b0fe83714b | |||
| 7c538b3370 | |||
| 271b5016eb | |||
| cc34df4f71 | |||
| f8b3acf517 | |||
| c73a9382c6 | |||
| d4d83b910a | |||
| ed83667058 | |||
| 8b4c333134 | |||
| 0f57a289d2 | |||
| af693e639e | |||
| f36a243c04 | |||
| 022eee9ad9 | |||
| b2e1ee39f5 | |||
| ba1da094c9 | |||
| 82f79dd77f | |||
| a5930f4368 | |||
| 8215c6b21c | |||
| fbe41b907a | |||
| 83e73df00e | |||
| 7cba5ebd7d | |||
| 94687a5eff | |||
| 0c30285132 | |||
| ed78f71c6a | |||
| 6875531f44 | |||
| 747cefb8e6 | |||
| 26a98f0dba | |||
| 1e6d77a4ce | |||
| f952c536ef | |||
| 22cca60c21 | |||
| 1f8a4e35a1 | |||
| 85b4c5c106 | |||
| 102384cd7d | |||
| 5cc68bb176 | |||
| 255794f034 | |||
| e02bd11090 | |||
| 9980d388b9 | |||
| c4c1c28207 | |||
| 60d1f87b30 | |||
| a604063ede | |||
| 5f61c15e3c | |||
| e205351fa9 | |||
| 87df8385b8 | |||
| 4d5e869ea7 | |||
| f0e536f603 | |||
| a1b534bf83 | |||
| e228a0cccd | |||
| b4f2eb31dd | |||
| 9d5450b514 |
@@ -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,56 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 4.2.9
|
||||
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/vp3: Add missing check for av_malloc
|
||||
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/scpr3: Check bx
|
||||
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
|
||||
avcodec/nvenc: fix vbv buffer size in cq mode
|
||||
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.2.8
|
||||
avformat/vividas: Check packet size
|
||||
avcodec/dstdec: Check for overflow in build_filter()
|
||||
|
||||
@@ -7397,7 +7397,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.2.8
|
||||
PROJECT_NUMBER = 4.2.9
|
||||
|
||||
# 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);
|
||||
|
||||
@@ -139,9 +139,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++) {
|
||||
|
||||
@@ -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 }
|
||||
};
|
||||
|
||||
@@ -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)
|
||||
|
||||
+2
-1
@@ -920,8 +920,9 @@ 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 & honor max bitrate;
|
||||
// CQ mode shall discard avg bitrate/vbv buffer size and honor only 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,8 +231,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);
|
||||
|
||||
+1
-1
@@ -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; \
|
||||
|
||||
@@ -459,6 +459,9 @@ 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)
|
||||
|
||||
@@ -1184,6 +1184,9 @@ 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],
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
+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;
|
||||
}
|
||||
|
||||
@@ -256,6 +256,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:
|
||||
@@ -327,6 +329,7 @@ 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
|
||||
) {
|
||||
@@ -340,6 +343,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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
+13
-2
@@ -2336,6 +2336,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;
|
||||
@@ -2740,8 +2742,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) {
|
||||
@@ -3002,7 +3009,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,
|
||||
@@ -3048,6 +3057,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -355,6 +355,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
@@ -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)
|
||||
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.
|
||||
|
||||
@@ -3899,6 +3899,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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
@@ -1038,8 +1038,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;
|
||||
@@ -1047,20 +1047,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;
|
||||
}
|
||||
}
|
||||
@@ -1097,8 +1097,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;
|
||||
@@ -1112,20 +1112,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;
|
||||
}
|
||||
}
|
||||
@@ -1153,8 +1153,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;
|
||||
@@ -1168,20 +1168,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;
|
||||
}
|
||||
}
|
||||
@@ -1199,8 +1199,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;
|
||||
@@ -1214,20 +1214,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;
|
||||
}
|
||||
}
|
||||
@@ -1278,7 +1278,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;
|
||||
@@ -1286,9 +1286,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;
|
||||
@@ -1326,7 +1326,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;
|
||||
@@ -1338,9 +1338,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;
|
||||
@@ -1369,7 +1369,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;
|
||||
@@ -1381,9 +1381,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;
|
||||
@@ -1402,7 +1402,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;
|
||||
@@ -1414,9 +1414,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