Skip to content

Commit a9bc1d1

Browse files
committed
upipe-v210: change pixel argument types to uintptr_t
The reasoning for this is: - We want it to be unsigned because we don't expect a negative value to be passed. We perform unsigned shifts on the value in some cases. - We want it to be register sized so that we do not have to extend it on x86-64.
1 parent 5ab5402 commit a9bc1d1

File tree

5 files changed

+15
-20
lines changed

5 files changed

+15
-20
lines changed

lib/upipe-v210/upipe_v210enc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@
5757
/** @This defines an 8-bit packing function. */
5858
typedef void (*upipe_v210enc_pack_line_8)(
5959
const uint8_t *y, const uint8_t *u, const uint8_t *v,
60-
uint8_t *dst, ptrdiff_t width);
60+
uint8_t *dst, uintptr_t width);
6161

6262
/** @This defines a 10-bit packing function. */
6363
typedef void (*upipe_v210enc_pack_line_10)(
6464
const uint16_t *y, const uint16_t *u, const uint16_t *v,
65-
uint8_t *dst, ptrdiff_t width);
65+
uint8_t *dst, uintptr_t width);
6666

6767
/** upipe_v210enc structure with v210enc parameters */
6868
struct upipe_v210enc {

lib/upipe-v210/v210enc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static inline void wl32(uint8_t *dst, uint32_t u)
6262
} while (0)
6363

6464
void upipe_planar_to_v210_8_c(const uint8_t *y, const uint8_t *u,
65-
const uint8_t *v, uint8_t *dst, ptrdiff_t pixels)
65+
const uint8_t *v, uint8_t *dst, uintptr_t pixels)
6666
{
6767
uint32_t val;
6868
int i;
@@ -81,7 +81,7 @@ void upipe_planar_to_v210_8_c(const uint8_t *y, const uint8_t *u,
8181
}
8282

8383
void upipe_planar_to_v210_10_c(const uint16_t *y, const uint16_t *u,
84-
const uint16_t *v, uint8_t *dst, ptrdiff_t pixels)
84+
const uint16_t *v, uint8_t *dst, uintptr_t pixels)
8585
{
8686
uint32_t val;
8787
int i;

lib/upipe-v210/v210enc.h

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,13 @@
55
#include <stddef.h>
66
#include <stdint.h>
77

8-
void upipe_planar_to_v210_8_c(const uint8_t *y, const uint8_t *u, const uint8_t *v, uint8_t *dst, ptrdiff_t pixels);
9-
void upipe_planar_to_v210_10_c(const uint16_t *y, const uint16_t *u, const uint16_t *v, uint8_t *dst, ptrdiff_t pixels);
8+
void upipe_planar_to_v210_8_c(const uint8_t *y, const uint8_t *u, const uint8_t *v, uint8_t *dst, uintptr_t pixels);
9+
void upipe_planar_to_v210_10_c(const uint16_t *y, const uint16_t *u, const uint16_t *v, uint8_t *dst, uintptr_t pixels);
1010

11-
void upipe_planar_to_v210_10_avx2(const uint16_t *y, const uint16_t *u,
12-
const uint16_t *v, uint8_t *dst, ptrdiff_t pixels);
13-
void upipe_planar_to_v210_10_ssse3(const uint16_t *y, const uint16_t *u,
14-
const uint16_t *v, uint8_t *dst, ptrdiff_t pixels);
15-
void upipe_planar_to_v210_8_ssse3(const uint8_t *y, const uint8_t *u,
16-
const uint8_t *v, uint8_t *dst, ptrdiff_t pixels);
17-
void upipe_planar_to_v210_8_avx(const uint8_t *y, const uint8_t *u,
18-
const uint8_t *v, uint8_t *dst, ptrdiff_t pixels);
19-
void upipe_planar_to_v210_8_avx2(const uint8_t *y, const uint8_t *u,
20-
const uint8_t *v, uint8_t *dst, ptrdiff_t pixels);
11+
void upipe_planar_to_v210_10_avx2(const uint16_t *y, const uint16_t *u, const uint16_t *v, uint8_t *dst, uintptr_t pixels);
12+
void upipe_planar_to_v210_10_ssse3(const uint16_t *y, const uint16_t *u, const uint16_t *v, uint8_t *dst, uintptr_t pixels);
13+
void upipe_planar_to_v210_8_ssse3(const uint8_t *y, const uint8_t *u, const uint8_t *v, uint8_t *dst, uintptr_t pixels);
14+
void upipe_planar_to_v210_8_avx(const uint8_t *y, const uint8_t *u, const uint8_t *v, uint8_t *dst, uintptr_t pixels);
15+
void upipe_planar_to_v210_8_avx2(const uint8_t *y, const uint8_t *u, const uint8_t *v, uint8_t *dst, uintptr_t pixels);
2116

2217
#endif

tests/checkasm/planar10_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static void randomize_buffers(uint16_t *src0, uint16_t *src1, int len)
3535
void checkasm_check_planar10_input(void)
3636
{
3737
struct {
38-
void (*v210)(const uint16_t *y, const uint16_t *u, const uint16_t *v, uint8_t *dst, ptrdiff_t pixels);
38+
void (*v210)(const uint16_t *y, const uint16_t *u, const uint16_t *v, uint8_t *dst, uintptr_t pixels);
3939
} s = {
4040
.v210 = upipe_planar_to_v210_10_c,
4141
};
@@ -62,7 +62,7 @@ void checkasm_check_planar10_input(void)
6262
uint8_t dst1[NUM_SAMPLES * 4 / 3 + 32];
6363
const int pixels = NUM_SAMPLES / 2 / 6 * 6;
6464

65-
declare_func(void, const uint16_t *y, const uint16_t *u, const uint16_t *v, uint8_t *dst, ptrdiff_t pixels);
65+
declare_func(void, const uint16_t *y, const uint16_t *u, const uint16_t *v, uint8_t *dst, uintptr_t pixels);
6666

6767
randomize_buffers(y0, y1, NUM_SAMPLES/2);
6868
randomize_buffers(u0, u1, NUM_SAMPLES/4);

tests/checkasm/planar8_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static void randomize_buffers(uint8_t *src0, uint8_t *src1, int len)
3737
void checkasm_check_planar8_input(void)
3838
{
3939
struct {
40-
void (*v210)(const uint8_t *y, const uint8_t *u, const uint8_t *v, uint8_t *dst, ptrdiff_t pixels);
40+
void (*v210)(const uint8_t *y, const uint8_t *u, const uint8_t *v, uint8_t *dst, uintptr_t pixels);
4141
} s = {
4242
.v210 = upipe_planar_to_v210_8_c,
4343
};
@@ -67,7 +67,7 @@ void checkasm_check_planar8_input(void)
6767
uint8_t dst1[NUM_SAMPLES * 4 / 3 + 32];
6868
const int pixels = NUM_SAMPLES / 2 / 6 * 6;
6969

70-
declare_func(void, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint8_t *dst, ptrdiff_t pixels);
70+
declare_func(void, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint8_t *dst, uintptr_t pixels);
7171

7272
randomize_buffers(y0, y1, NUM_SAMPLES/2);
7373
randomize_buffers(u0, u1, NUM_SAMPLES/4);

0 commit comments

Comments
 (0)