aboutsummaryrefslogtreecommitdiffstats
path: root/tests/checkasm/h264pred.c
diff options
context:
space:
mode:
authorHenrik Gramner <henrik@gramner.com>2015-08-16 13:00:21 +0200
committerHenrik Gramner <henrik@gramner.com>2015-08-19 16:17:35 +0200
commit18b101ff595c7f18e9571d26f8840f556b24ec03 (patch)
treef13145d96afd2d8d300ee4262ec7e9136a9d98a3 /tests/checkasm/h264pred.c
parent99b9f0136c6e2d80c5ce2fc3c4125605035e11cb (diff)
downloadffmpeg-18b101ff595c7f18e9571d26f8840f556b24ec03.tar.gz
checkasm: Explicitly declare function prototypes
Now we no longer have to rely on function pointers intentionally declared without specified argument types. This makes it easier to support functions with floating point parameters or return values as well as functions returning 64-bit values on 32-bit architectures. It also avoids having to explicitly cast strides to ptrdiff_t for example.
Diffstat (limited to 'tests/checkasm/h264pred.c')
-rw-r--r--tests/checkasm/h264pred.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/tests/checkasm/h264pred.c b/tests/checkasm/h264pred.c
index 5e9a7c1e17..ad1b02758d 100644
--- a/tests/checkasm/h264pred.c
+++ b/tests/checkasm/h264pred.c
@@ -144,14 +144,16 @@ static void check_pred4x4(H264PredContext *h, uint8_t *buf0, uint8_t *buf1,
if (chroma_format == 1) {
uint8_t *topright = buf0 + 2*16;
int pred_mode;
+ declare_func(void, uint8_t *src, const uint8_t *topright, ptrdiff_t stride);
+
for (pred_mode = 0; pred_mode < 15; pred_mode++) {
if (check_pred_func(h->pred4x4[pred_mode], "4x4", pred4x4_modes[codec][pred_mode])) {
randomize_buffers();
- call_ref(src0, topright, (ptrdiff_t)12*SIZEOF_PIXEL);
- call_new(src1, topright, (ptrdiff_t)12*SIZEOF_PIXEL);
+ call_ref(src0, topright, 12*SIZEOF_PIXEL);
+ call_new(src1, topright, 12*SIZEOF_PIXEL);
if (memcmp(buf0, buf1, BUF_SIZE))
fail();
- bench_new(src1, topright, (ptrdiff_t)12*SIZEOF_PIXEL);
+ bench_new(src1, topright, 12*SIZEOF_PIXEL);
}
}
}
@@ -161,15 +163,17 @@ static void check_pred8x8(H264PredContext *h, uint8_t *buf0, uint8_t *buf1,
int codec, int chroma_format, int bit_depth)
{
int pred_mode;
+ declare_func(void, uint8_t *src, ptrdiff_t stride);
+
for (pred_mode = 0; pred_mode < 11; pred_mode++) {
if (check_pred_func(h->pred8x8[pred_mode], (chroma_format == 2) ? "8x16" : "8x8",
pred8x8_modes[codec][pred_mode])) {
randomize_buffers();
- call_ref(src0, (ptrdiff_t)24*SIZEOF_PIXEL);
- call_new(src1, (ptrdiff_t)24*SIZEOF_PIXEL);
+ call_ref(src0, 24*SIZEOF_PIXEL);
+ call_new(src1, 24*SIZEOF_PIXEL);
if (memcmp(buf0, buf1, BUF_SIZE))
fail();
- bench_new(src1, (ptrdiff_t)24*SIZEOF_PIXEL);
+ bench_new(src1, 24*SIZEOF_PIXEL);
}
}
}
@@ -179,14 +183,16 @@ static void check_pred16x16(H264PredContext *h, uint8_t *buf0, uint8_t *buf1,
{
if (chroma_format == 1) {
int pred_mode;
+ declare_func(void, uint8_t *src, ptrdiff_t stride);
+
for (pred_mode = 0; pred_mode < 9; pred_mode++) {
if (check_pred_func(h->pred16x16[pred_mode], "16x16", pred16x16_modes[codec][pred_mode])) {
randomize_buffers();
- call_ref(src0, (ptrdiff_t)48);
- call_new(src1, (ptrdiff_t)48);
+ call_ref(src0, 48);
+ call_new(src1, 48);
if (memcmp(buf0, buf1, BUF_SIZE))
fail();
- bench_new(src1, (ptrdiff_t)48);
+ bench_new(src1, 48);
}
}
}
@@ -197,6 +203,8 @@ static void check_pred8x8l(H264PredContext *h, uint8_t *buf0, uint8_t *buf1,
{
if (chroma_format == 1 && codec_ids[codec] == AV_CODEC_ID_H264) {
int pred_mode;
+ declare_func(void, uint8_t *src, int topleft, int topright, ptrdiff_t stride);
+
for (pred_mode = 0; pred_mode < 12; pred_mode++) {
if (check_pred_func(h->pred8x8l[pred_mode], "8x8l", pred4x4_modes[codec][pred_mode])) {
int neighbors;
@@ -208,11 +216,11 @@ static void check_pred8x8l(H264PredContext *h, uint8_t *buf0, uint8_t *buf1,
continue; /* Those aren't allowed according to the spec */
randomize_buffers();
- call_ref(src0, has_topleft, has_topright, (ptrdiff_t)24*SIZEOF_PIXEL);
- call_new(src1, has_topleft, has_topright, (ptrdiff_t)24*SIZEOF_PIXEL);
+ call_ref(src0, has_topleft, has_topright, 24*SIZEOF_PIXEL);
+ call_new(src1, has_topleft, has_topright, 24*SIZEOF_PIXEL);
if (memcmp(buf0, buf1, BUF_SIZE))
fail();
- bench_new(src1, has_topleft, has_topright, (ptrdiff_t)24*SIZEOF_PIXEL);
+ bench_new(src1, has_topleft, has_topright, 24*SIZEOF_PIXEL);
}
}
}