shithub: libvpx

Download patch

ref: 9e69aa0b4845eda6f43fa615c2c3094be06be9dc
parent: 396b7484fc36212a005998bd9ef58c0bdd852929
parent: 07de398172086c71ac778f46c3f6693d2beafde3
author: Harish Mahendrakar <[email protected]>
date: Wed Nov 14 16:55:16 EST 2018

Merge "vpx_dec_fuzzer: Unify single and multi-thread tests"

--- a/examples/vpx_dec_fuzzer.cc
+++ b/examples/vpx_dec_fuzzer.cc
@@ -38,15 +38,13 @@
  * Build libvpx
    $make -j32
 
- * Build vp9 threaded fuzzer
-   $ $CXX $CXXFLAGS -std=c++11 -DDECODE_MODE_threaded -DDECODER=vp9 \
+ * Build vp9 fuzzer
+   $ $CXX $CXXFLAGS -std=c++11 -DDECODER=vp9 \
    -fsanitize=fuzzer -I../libvpx -I. -Wl,--start-group \
-   ../libvpx/examples/vpx_dec_fuzzer.cc -o ./vpx_dec_fuzzer_threaded_vp9 \
+   ../libvpx/examples/vpx_dec_fuzzer.cc -o ./vpx_dec_fuzzer_vp9 \
    ./libvpx.a ./tools_common.c.o -Wl,--end-group
 
  * DECODER should be defined as vp9 or vp8 to enable vp9/vp8
- * DECODE_MODE_threaded or DECODE_MODE_serial needs to be defined to test
- * multi-threaded or single core implementation
  *
  * create a corpus directory and copy some ivf files there.
  * Based on which codec (vp8/vp9) is being tested, it is recommended to
@@ -55,7 +53,7 @@
    $mkdir CORPUS && cp some-files CORPUS
 
  * Run fuzzing:
-   $./vpx_dec_fuzzer_threaded_vp9 CORPUS
+   $./vpx_dec_fuzzer_vp9 CORPUS
 
  * References:
  * http://llvm.org/docs/LibFuzzer.html
@@ -66,9 +64,6 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
-#if defined(DECODE_MODE_threaded)
-#include <algorithm>
-#endif
 #include <memory>
 
 #include "./tools_common.h"
@@ -142,14 +137,8 @@
   }
 
   vpx_codec_ctx_t codec;
-#if defined(DECODE_MODE_serial)
-  const unsigned int threads = 1;
-#elif defined(DECODE_MODE_threaded)
-  // Set thread count in the range [2, 64].
-  const unsigned int threads = std::max((data[IVF_FILE_HDR_SZ] & 0x3f) + 1, 2);
-#else
-#error define one of DECODE_MODE_(serial|threaded)
-#endif
+  // Set thread count in the range [1, 64].
+  const unsigned int threads = (data[IVF_FILE_HDR_SZ] & 0x3f) + 1;
   vpx_codec_dec_cfg_t cfg = { threads, 0, 0 };
   if (vpx_codec_dec_init(&codec, decoder->codec_interface(), &cfg, 0)) {
     return 0;