Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: source/libvpx/test/vp8_boolcoder_test.cc

Issue 23530058: libvpx: Pull from upstream (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/libvpx/test/variance_test.cc ('k') | source/libvpx/test/vp8_decrypt_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/libvpx/test/vp8_boolcoder_test.cc
===================================================================
--- source/libvpx/test/vp8_boolcoder_test.cc (revision 223100)
+++ source/libvpx/test/vp8_boolcoder_test.cc (working copy)
@@ -8,10 +8,6 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-extern "C" {
-#include "vp8/encoder/boolhuff.h"
-#include "vp8/decoder/dboolhuff.h"
-}
#include <math.h>
#include <stddef.h>
@@ -24,6 +20,11 @@
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "vpx/vpx_integer.h"
+extern "C" {
+#include "vp8/encoder/boolhuff.h"
+#include "vp8/decoder/dboolhuff.h"
+}
+
namespace {
const int num_tests = 10;
@@ -44,7 +45,7 @@
void test_decrypt_cb(void *decrypt_state, const uint8_t *input,
uint8_t *output, int count) {
- int offset = input - (uint8_t *)decrypt_state;
+ int offset = input - reinterpret_cast<uint8_t *>(decrypt_state);
for (int i = 0; i < count; i++) {
output[i] = input[i] ^ secret_key[(offset + i) & 15];
}
@@ -58,10 +59,10 @@
ACMRandom rnd(ACMRandom::DeterministicSeed());
for (int n = 0; n < num_tests; ++n) {
for (int method = 0; method <= 7; ++method) { // we generate various proba
- const int bits_to_test = 1000;
- uint8_t probas[bits_to_test];
+ const int kBitsToTest = 1000;
+ uint8_t probas[kBitsToTest];
- for (int i = 0; i < bits_to_test; ++i) {
+ for (int i = 0; i < kBitsToTest; ++i) {
const int parity = i & 1;
probas[i] =
(method == 0) ? 0 : (method == 1) ? 255 :
@@ -76,14 +77,14 @@
}
for (int bit_method = 0; bit_method <= 3; ++bit_method) {
const int random_seed = 6432;
- const int buffer_size = 10000;
+ const int kBufferSize = 10000;
ACMRandom bit_rnd(random_seed);
BOOL_CODER bw;
- uint8_t bw_buffer[buffer_size];
- vp8_start_encode(&bw, bw_buffer, bw_buffer + buffer_size);
+ uint8_t bw_buffer[kBufferSize];
+ vp8_start_encode(&bw, bw_buffer, bw_buffer + kBufferSize);
int bit = (bit_method == 0) ? 0 : (bit_method == 1) ? 1 : 0;
- for (int i = 0; i < bits_to_test; ++i) {
+ for (int i = 0; i < kBitsToTest; ++i) {
if (bit_method == 2) {
bit = (i & 1);
} else if (bit_method == 3) {
@@ -98,19 +99,20 @@
#if CONFIG_DECRYPT
encrypt_buffer(bw_buffer, buffer_size);
vp8dx_start_decode(&br, bw_buffer, buffer_size,
- test_decrypt_cb, (void *)bw_buffer);
+ test_decrypt_cb,
+ reinterpret_cast<void *>(bw_buffer));
#else
- vp8dx_start_decode(&br, bw_buffer, buffer_size, NULL, NULL);
+ vp8dx_start_decode(&br, bw_buffer, kBufferSize, NULL, NULL);
#endif
bit_rnd.Reset(random_seed);
- for (int i = 0; i < bits_to_test; ++i) {
+ for (int i = 0; i < kBitsToTest; ++i) {
if (bit_method == 2) {
bit = (i & 1);
} else if (bit_method == 3) {
bit = bit_rnd(2);
}
GTEST_ASSERT_EQ(vp8dx_decode_bool(&br, probas[i]), bit)
- << "pos: "<< i << " / " << bits_to_test
+ << "pos: "<< i << " / " << kBitsToTest
<< " bit_method: " << bit_method
<< " method: " << method;
}
« no previous file with comments | « source/libvpx/test/variance_test.cc ('k') | source/libvpx/test/vp8_decrypt_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698