Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/videolan/dav1d.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Gramner <gramner@twoorioles.com>2022-09-08 14:30:00 +0300
committerHenrik Gramner <gramner@twoorioles.com>2022-09-08 14:58:48 +0300
commitfab6427e2a37f995beced2bbe15b8f7a2404bec2 (patch)
tree6e96fb60823db550005511b7c887c6277613cde2
parent677129c26095f5b67052f740ce54b663b43bdfcf (diff)
x86: Fix rare crash in chroma film grain asm
The width parameter is used directly as a pointer offset, so ensure that it has an appropriately sized data type. This has been done previously for luma, but chroma was overlooked.
-rw-r--r--src/arm/filmgrain.h4
-rw-r--r--src/filmgrain.h2
-rw-r--r--src/filmgrain_tmpl.c6
3 files changed, 6 insertions, 6 deletions
diff --git a/src/arm/filmgrain.h b/src/arm/filmgrain.h
index 118ce30..48776ac 100644
--- a/src/arm/filmgrain.h
+++ b/src/arm/filmgrain.h
@@ -137,7 +137,7 @@ void BF(dav1d_fguv_32x32_##nm, neon)(pixel *const dst, \
static void \
fguv_32x32xn_##nm##_neon(pixel *const dst_row, const pixel *const src_row, \
const ptrdiff_t stride, const Dav1dFilmGrainData *const data, \
- const int pw, const uint8_t scaling[SCALING_SIZE], \
+ const size_t pw, const uint8_t scaling[SCALING_SIZE], \
const entry grain_lut[][GRAIN_WIDTH], const int bh, \
const int row_num, const pixel *const luma_row, \
const ptrdiff_t luma_stride, const int uv, const int is_id \
@@ -156,7 +156,7 @@ fguv_32x32xn_##nm##_neon(pixel *const dst_row, const pixel *const src_row, \
int offsets[2 /* col offset */][2 /* row offset */]; \
\
/* process this row in BLOCK_SIZE^2 blocks (subsampled) */ \
- for (int bx = 0; bx < pw; bx += BLOCK_SIZE >> sx) { \
+ for (unsigned bx = 0; bx < pw; bx += BLOCK_SIZE >> sx) { \
if (data->overlap_flag && bx) { \
/* shift previous offsets left */ \
for (int i = 0; i < rows; i++) \
diff --git a/src/filmgrain.h b/src/filmgrain.h
index 0ffded6..a5d6be6 100644
--- a/src/filmgrain.h
+++ b/src/filmgrain.h
@@ -64,7 +64,7 @@ typedef decl_fgy_32x32xn_fn(*fgy_32x32xn_fn);
#define decl_fguv_32x32xn_fn(name) \
void (name)(pixel *dst_row, const pixel *src_row, ptrdiff_t stride, \
- const Dav1dFilmGrainData *data, int pw, \
+ const Dav1dFilmGrainData *data, size_t pw, \
const uint8_t scaling[SCALING_SIZE], \
const entry grain_lut[][GRAIN_WIDTH], int bh, int row_num, \
const pixel *luma_row, ptrdiff_t luma_stride, \
diff --git a/src/filmgrain_tmpl.c b/src/filmgrain_tmpl.c
index b772614..0986ac2 100644
--- a/src/filmgrain_tmpl.c
+++ b/src/filmgrain_tmpl.c
@@ -278,7 +278,7 @@ static void fgy_32x32xn_c(pixel *const dst_row, const pixel *const src_row,
static NOINLINE void
fguv_32x32xn_c(pixel *const dst_row, const pixel *const src_row,
const ptrdiff_t stride, const Dav1dFilmGrainData *const data,
- const int pw, const uint8_t scaling[SCALING_SIZE],
+ const size_t pw, const uint8_t scaling[SCALING_SIZE],
const entry grain_lut[][GRAIN_WIDTH], const int bh,
const int row_num, const pixel *const luma_row,
const ptrdiff_t luma_stride, const int uv, const int is_id,
@@ -311,8 +311,8 @@ fguv_32x32xn_c(pixel *const dst_row, const pixel *const src_row,
int offsets[2 /* col offset */][2 /* row offset */];
// process this row in BLOCK_SIZE^2 blocks (subsampled)
- for (int bx = 0; bx < pw; bx += BLOCK_SIZE >> sx) {
- const int bw = imin(BLOCK_SIZE >> sx, pw - bx);
+ for (unsigned bx = 0; bx < pw; bx += BLOCK_SIZE >> sx) {
+ const int bw = imin(BLOCK_SIZE >> sx, (int)(pw - bx));
if (data->overlap_flag && bx) {
// shift previous offsets left
for (int i = 0; i < rows; i++)