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:
-rw-r--r--meson.build1
-rw-r--r--src/ref_mvs.c123
-rw-r--r--tests/libfuzzer/dav1d_fuzzer.c1
-rw-r--r--tests/libfuzzer/dav1d_fuzzer.h36
-rw-r--r--tests/libfuzzer/main.c4
5 files changed, 110 insertions, 55 deletions
diff --git a/meson.build b/meson.build
index 3e31a10..bcfebeb 100644
--- a/meson.build
+++ b/meson.build
@@ -149,6 +149,7 @@ optional_arguments = [
'-Werror=vla',
'-Wno-maybe-uninitialized',
'-Wno-unused-parameter',
+ '-Werror=missing-prototypes',
]
if (get_option('buildtype') != 'debug' and get_option('buildtype') != 'plain')
diff --git a/src/ref_mvs.c b/src/ref_mvs.c
index 2e1242a..3e1e98c 100644
--- a/src/ref_mvs.c
+++ b/src/ref_mvs.c
@@ -1824,57 +1824,6 @@ static void av1_setup_motion_field(AV1_COMMON *cm) {
}
}
-void av1_fill_motion_field(AV1_COMMON *cm,
- const int tile_col_start4, const int tile_col_end4,
- const int row_start4, int row_end4)
-{
- RefCntBuffer *const frame_bufs = cm->buffer_pool.frame_bufs;
- const int cur_order_hint = cm->cur_frame.cur_frame_offset;
- int *const ref_buf_idx = cm->ref_buf_idx;
- int *const ref_order_hint = cm->ref_order_hint;
-
- int ref_stamp = MFMV_STACK_SIZE - 1;
-
- if (ref_buf_idx[LAST_FRAME - LAST_FRAME] >= 0) {
- const int alt_of_lst_order_hint =
- frame_bufs[ref_buf_idx[LAST_FRAME - LAST_FRAME]]
- .ref_frame_offset[ALTREF_FRAME - LAST_FRAME];
-
- const int is_lst_overlay =
- (alt_of_lst_order_hint == ref_order_hint[GOLDEN_FRAME - LAST_FRAME]);
- if (!is_lst_overlay) motion_field_projection(cm, LAST_FRAME, 2,
- tile_col_start4, tile_col_end4,
- row_start4, row_end4);
- --ref_stamp;
- }
-
- if (get_relative_dist(cm, ref_order_hint[BWDREF_FRAME - LAST_FRAME],
- cur_order_hint) > 0) {
- if (motion_field_projection(cm, BWDREF_FRAME, 0,
- tile_col_start4, tile_col_end4,
- row_start4, row_end4)) --ref_stamp;
- }
-
- if (get_relative_dist(cm, ref_order_hint[ALTREF2_FRAME - LAST_FRAME],
- cur_order_hint) > 0) {
- if (motion_field_projection(cm, ALTREF2_FRAME, 0,
- tile_col_start4, tile_col_end4,
- row_start4, row_end4)) --ref_stamp;
- }
-
- if (get_relative_dist(cm, ref_order_hint[ALTREF_FRAME - LAST_FRAME],
- cur_order_hint) > 0 &&
- ref_stamp >= 0)
- if (motion_field_projection(cm, ALTREF_FRAME, 0,
- tile_col_start4, tile_col_end4,
- row_start4, row_end4)) --ref_stamp;
-
- if (ref_stamp >= 0 && ref_buf_idx[LAST2_FRAME - LAST_FRAME] >= 0)
- if (motion_field_projection(cm, LAST2_FRAME, 2,
- tile_col_start4, tile_col_end4,
- row_start4, row_end4)) --ref_stamp;
-}
-
enum BlockSize {
BS_128x128,
BS_128x64,
@@ -1957,6 +1906,12 @@ void av1_find_ref_mvs(CANDIDATE_MV *mvstack, int *cnt, int_mv (*mvlist)[2],
int w4, int h4, int bs, int bp, int by4, int bx4,
int tile_col_start4, int tile_col_end4,
int tile_row_start4, int tile_row_end4,
+ AV1_COMMON *cm);
+void av1_find_ref_mvs(CANDIDATE_MV *mvstack, int *cnt, int_mv (*mvlist)[2],
+ int *ctx, int refidx_dav1d[2],
+ int w4, int h4, int bs, int bp, int by4, int bx4,
+ int tile_col_start4, int tile_col_end4,
+ int tile_row_start4, int tile_row_end4,
AV1_COMMON *cm)
{
const int bw4 = dav1d_block_dimensions[bs][0];
@@ -2104,6 +2059,20 @@ int av1_init_ref_mv_common(AV1_COMMON *cm,
const int allow_hp,
const int force_int_mv,
const int allow_ref_frame_mvs,
+ const int order_hint);
+int av1_init_ref_mv_common(AV1_COMMON *cm,
+ const int w8, const int h8,
+ const ptrdiff_t stride,
+ const int allow_sb128,
+ MV_REF *cur,
+ MV_REF *ref_mvs[7],
+ const unsigned cur_poc,
+ const unsigned ref_poc[7],
+ const unsigned ref_ref_poc[7][7],
+ const WarpedMotionParams gmv[7],
+ const int allow_hp,
+ const int force_int_mv,
+ const int allow_ref_frame_mvs,
const int order_hint)
{
if (cm->mi_cols != (w8 << 1) || cm->mi_rows != (h8 << 1)) {
@@ -2158,12 +2127,59 @@ int av1_init_ref_mv_common(AV1_COMMON *cm,
void av1_init_ref_mv_tile_row(AV1_COMMON *cm,
int tile_col_start4, int tile_col_end4,
+ int row_start4, int row_end4);
+void av1_init_ref_mv_tile_row(AV1_COMMON *cm,
+ int tile_col_start4, int tile_col_end4,
int row_start4, int row_end4)
{
- av1_fill_motion_field(cm, tile_col_start4, tile_col_end4,
- row_start4, row_end4);
+ RefCntBuffer *const frame_bufs = cm->buffer_pool.frame_bufs;
+ const int cur_order_hint = cm->cur_frame.cur_frame_offset;
+ int *const ref_buf_idx = cm->ref_buf_idx;
+ int *const ref_order_hint = cm->ref_order_hint;
+
+ int ref_stamp = MFMV_STACK_SIZE - 1;
+
+ if (ref_buf_idx[LAST_FRAME - LAST_FRAME] >= 0) {
+ const int alt_of_lst_order_hint =
+ frame_bufs[ref_buf_idx[LAST_FRAME - LAST_FRAME]]
+ .ref_frame_offset[ALTREF_FRAME - LAST_FRAME];
+
+ const int is_lst_overlay =
+ (alt_of_lst_order_hint == ref_order_hint[GOLDEN_FRAME - LAST_FRAME]);
+ if (!is_lst_overlay) motion_field_projection(cm, LAST_FRAME, 2,
+ tile_col_start4, tile_col_end4,
+ row_start4, row_end4);
+ --ref_stamp;
+ }
+
+ if (get_relative_dist(cm, ref_order_hint[BWDREF_FRAME - LAST_FRAME],
+ cur_order_hint) > 0) {
+ if (motion_field_projection(cm, BWDREF_FRAME, 0,
+ tile_col_start4, tile_col_end4,
+ row_start4, row_end4)) --ref_stamp;
+ }
+
+ if (get_relative_dist(cm, ref_order_hint[ALTREF2_FRAME - LAST_FRAME],
+ cur_order_hint) > 0) {
+ if (motion_field_projection(cm, ALTREF2_FRAME, 0,
+ tile_col_start4, tile_col_end4,
+ row_start4, row_end4)) --ref_stamp;
+ }
+
+ if (get_relative_dist(cm, ref_order_hint[ALTREF_FRAME - LAST_FRAME],
+ cur_order_hint) > 0 &&
+ ref_stamp >= 0)
+ if (motion_field_projection(cm, ALTREF_FRAME, 0,
+ tile_col_start4, tile_col_end4,
+ row_start4, row_end4)) --ref_stamp;
+
+ if (ref_stamp >= 0 && ref_buf_idx[LAST2_FRAME - LAST_FRAME] >= 0)
+ if (motion_field_projection(cm, LAST2_FRAME, 2,
+ tile_col_start4, tile_col_end4,
+ row_start4, row_end4)) --ref_stamp;
}
+AV1_COMMON *av1_alloc_ref_mv_common(void);
AV1_COMMON *av1_alloc_ref_mv_common(void) {
AV1_COMMON *cm = malloc(sizeof(*cm));
if (!cm) return NULL;
@@ -2171,6 +2187,7 @@ AV1_COMMON *av1_alloc_ref_mv_common(void) {
return cm;
}
+void av1_free_ref_mv_common(AV1_COMMON *cm);
void av1_free_ref_mv_common(AV1_COMMON *cm) {
if (cm->tpl_mvs) free(cm->tpl_mvs);
free(cm);
diff --git a/tests/libfuzzer/dav1d_fuzzer.c b/tests/libfuzzer/dav1d_fuzzer.c
index 876980f..4fbcfa4 100644
--- a/tests/libfuzzer/dav1d_fuzzer.c
+++ b/tests/libfuzzer/dav1d_fuzzer.c
@@ -31,6 +31,7 @@
#include <string.h>
#include <dav1d/dav1d.h>
+#include <tests/libfuzzer/dav1d_fuzzer.h>
static unsigned r32le(const uint8_t *const p) {
return ((uint32_t)p[3] << 24U) | (p[2] << 16U) | (p[1] << 8U) | p[0];
diff --git a/tests/libfuzzer/dav1d_fuzzer.h b/tests/libfuzzer/dav1d_fuzzer.h
new file mode 100644
index 0000000..201d056
--- /dev/null
+++ b/tests/libfuzzer/dav1d_fuzzer.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright © 2018, VideoLAN and dav1d authors
+ * Copyright © 2018, Janne Grunau
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __DAV1D_TESTS_LIBFUZZER_DAV1D_FUZZER_H
+#define __DAV1D_TESTS_LIBFUZZER_DAV1D_FUZZER_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
+
+#endif /* __DAV1D_TESTS_LIBFUZZER_DAV1D_FUZZER_H*/
diff --git a/tests/libfuzzer/main.c b/tests/libfuzzer/main.c
index d714da5..dbf7b60 100644
--- a/tests/libfuzzer/main.c
+++ b/tests/libfuzzer/main.c
@@ -33,9 +33,9 @@
#include <string.h>
#include <stdio.h>
-// expects ivf input
+#include <tests/libfuzzer/dav1d_fuzzer.h>
-int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
+// expects ivf input
int main(const int argc, char *const *const argv) {
int ret = -1;