shithub: libvpx

Download patch

ref: 767503504fa063b637e35b9a86f85b28025cdd42
parent: 0726dd97d30a98b9380a054c214142a8367b1774
author: Jerome Jiang <jianj@google.com>
date: Thu Sep 21 06:52:20 EDT 2017

Add unit test to expose vp8 bug when width is set odd.

BUG=b/64710201

Change-Id: Ia518af5494a42e80949cf1165244fbed59606cf7

--- a/test/encode_api_test.cc
+++ b/test/encode_api_test.cc
@@ -79,4 +79,31 @@
 #endif
 }
 
+#if CONFIG_VP8_ENCODER
+TEST(EncodeAPI, DISABLED_ImageSizeSetting) {
+  const int width = 711;
+  const int height = 360;
+  const int bps = 12;
+  vpx_image_t img;
+  vpx_codec_ctx_t enc;
+  vpx_codec_enc_cfg_t cfg;
+  uint8_t *img_buf = reinterpret_cast<uint8_t *>(
+      calloc(width * height * bps / 8, sizeof(*img_buf)));
+  vpx_codec_enc_config_default(vpx_codec_vp8_cx(), &cfg, 0);
+
+  cfg.g_w = width;
+  cfg.g_h = height;
+
+  vpx_img_wrap(&img, VPX_IMG_FMT_I420, width, height, 1, img_buf);
+
+  vpx_codec_enc_init(&enc, vpx_codec_vp8_cx(), &cfg, 0);
+
+  EXPECT_EQ(VPX_CODEC_OK, vpx_codec_encode(&enc, &img, 0, 1, 0, 0));
+
+  free(img_buf);
+
+  vpx_codec_destroy(&enc);
+}
+#endif
+
 }  // namespace