]> granicus.if.org Git - libvpx/commitdiff
Merge "VP9 dynamic resizing unit test with bitrate change."
authorJacky Chen <jackychen@google.com>
Wed, 16 Sep 2015 16:55:14 +0000 (16:55 +0000)
committerGerrit Code Review <noreply-gerritcodereview@google.com>
Wed, 16 Sep 2015 16:55:14 +0000 (16:55 +0000)
22 files changed:
test/vp9_encoder_parms_get_to_decoder.cc
vp10/common/entropymv.c
vp10/common/entropymv.h
vp10/common/thread_common.h
vp10/common/x86/vp10_fwd_dct32x32_impl_sse2.h
vp10/decoder/decodemv.c
vp10/decoder/dthread.h
vp10/encoder/context_tree.h
vp10/encoder/encodemv.c
vp10/encoder/encoder.c
vp10/encoder/ethread.h
vp10/encoder/resize.h
vp10/vp10_dx_iface.c
vp10/vp10_iface_common.h
vp9/common/vp9_thread_common.h
vp9/decoder/vp9_dthread.h
vp9/encoder/vp9_context_tree.h
vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_ethread.h
vp9/encoder/vp9_resize.h
vp9/vp9_dx_iface.c
vp9/vp9_iface_common.h

index a02070e43a6fb8b32b957da30bd7b5a638287902..1ceff1e7edad1ec2eb06d14f1ecf40c84f249c05 100644 (file)
 #include "test/encode_test_driver.h"
 #include "test/util.h"
 #include "test/y4m_video_source.h"
-#include "test/yuv_video_source.h"
 #include "vp9/decoder/vp9_decoder.h"
 
-typedef vpx_codec_stream_info_t vp9_stream_info_t;
-struct vpx_codec_alg_priv {
-  vpx_codec_priv_t        base;
-  vpx_codec_dec_cfg_t     cfg;
-  vp9_stream_info_t       si;
-  struct VP9Decoder      *pbi;
-  int                     postproc_cfg_set;
-  vp8_postproc_cfg_t      postproc_cfg;
-  vpx_decrypt_cb          decrypt_cb;
-  void                   *decrypt_state;
-  vpx_image_t             img;
-  int                     img_avail;
-  int                     flushed;
-  int                     invert_tile_order;
-  int                     frame_parallel_decode;
-
-  // External frame buffer info to save for VP9 common.
-  void *ext_priv;  // Private data associated with the external frame buffers.
-  vpx_get_frame_buffer_cb_fn_t get_ext_fb_cb;
-  vpx_release_frame_buffer_cb_fn_t release_ext_fb_cb;
-};
-
-static vpx_codec_alg_priv_t *get_alg_priv(vpx_codec_ctx_t *ctx) {
-  return (vpx_codec_alg_priv_t *)ctx->priv;
-}
+#include "vp9/vp9_dx_iface.c"
 
 namespace {
 
-const unsigned int kFramerate = 50;
 const int kCpuUsed = 2;
 
 struct EncodePerfTestVideo {
@@ -71,30 +45,20 @@ struct EncodeParameters {
 };
 
 const EncodeParameters kVP9EncodeParameterSet[] = {
-    {0, 0, 0, 1, 0, VPX_CS_BT_601},
-    {0, 0, 0, 0, 0, VPX_CS_BT_709},
-    {0, 0, 1, 0, 0, VPX_CS_BT_2020},
-    {0, 2, 0, 0, 1, VPX_CS_UNKNOWN},
-    // TODO(JBB): Test profiles (requires more work).
+  {0, 0, 0, 1, 0, VPX_CS_BT_601},
+  {0, 0, 0, 0, 0, VPX_CS_BT_709},
+  {0, 0, 1, 0, 0, VPX_CS_BT_2020},
+  {0, 2, 0, 0, 1, VPX_CS_UNKNOWN},
+  // TODO(JBB): Test profiles (requires more work).
 };
 
-int is_extension_y4m(const char *filename) {
-  const char *dot = strrchr(filename, '.');
-  if (!dot || dot == filename)
-    return 0;
-  else
-    return !strcmp(dot, ".y4m");
-}
-
 class VpxEncoderParmsGetToDecoder
     : public ::libvpx_test::EncoderTest,
-      public ::libvpx_test::CodecTestWith2Params<EncodeParameters, \
+      public ::libvpx_test::CodecTestWith2Params<EncodeParameters,
                                                  EncodePerfTestVideo> {
  protected:
   VpxEncoderParmsGetToDecoder()
-      : EncoderTest(GET_PARAM(0)),
-        encode_parms(GET_PARAM(1)) {
-  }
+      : EncoderTest(GET_PARAM(0)), encode_parms(GET_PARAM(1)) {}
 
   virtual ~VpxEncoderParmsGetToDecoder() {}
 
@@ -126,33 +90,33 @@ class VpxEncoderParmsGetToDecoder
   }
 
   virtual bool HandleDecodeResult(const vpx_codec_err_t res_dec,
-                                  const libvpx_test::VideoSourcevideo,
+                                  const libvpx_test::VideoSource &video,
                                   libvpx_test::Decoder *decoder) {
-    vpx_codec_ctx_t* vp9_decoder = decoder->GetDecoder();
-    vpx_codec_alg_priv_t* priv =
-        (vpx_codec_alg_priv_t*) get_alg_priv(vp9_decoder);
-
-    VP9Decoder* pbi = priv->pbi;
-    VP9_COMMON* common = &pbi->common;
+    vpx_codec_ctx_t *const vp9_decoder = decoder->GetDecoder();
+    vpx_codec_alg_priv_t *const priv =
+        reinterpret_cast<vpx_codec_alg_priv_t *>(vp9_decoder->priv);
+    FrameWorkerData *const worker_data =
+        reinterpret_cast<FrameWorkerData *>(priv->frame_workers[0].data1);
+    VP9_COMMON *const common = &worker_data->pbi->common;
 
     if (encode_parms.lossless) {
-      EXPECT_EQ(common->base_qindex, 0);
-      EXPECT_EQ(common->y_dc_delta_q, 0);
-      EXPECT_EQ(common->uv_dc_delta_q, 0);
-      EXPECT_EQ(common->uv_ac_delta_q, 0);
-      EXPECT_EQ(common->tx_mode, ONLY_4X4);
+      EXPECT_EQ(0, common->base_qindex);
+      EXPECT_EQ(0, common->y_dc_delta_q);
+      EXPECT_EQ(0, common->uv_dc_delta_q);
+      EXPECT_EQ(0, common->uv_ac_delta_q);
+      EXPECT_EQ(ONLY_4X4, common->tx_mode);
     }
-    EXPECT_EQ(common->error_resilient_mode, encode_parms.error_resilient);
+    EXPECT_EQ(encode_parms.error_resilient, common->error_resilient_mode);
     if (encode_parms.error_resilient) {
-      EXPECT_EQ(common->frame_parallel_decoding_mode, 1);
-      EXPECT_EQ(common->use_prev_frame_mvs, 0);
+      EXPECT_EQ(1, common->frame_parallel_decoding_mode);
+      EXPECT_EQ(0, common->use_prev_frame_mvs);
     } else {
-      EXPECT_EQ(common->frame_parallel_decoding_mode,
-                encode_parms.frame_parallel);
+      EXPECT_EQ(encode_parms.frame_parallel,
+                common->frame_parallel_decoding_mode);
     }
-    EXPECT_EQ(common->color_space, encode_parms.cs);
-    EXPECT_EQ(common->log2_tile_cols, encode_parms.tile_cols);
-    EXPECT_EQ(common->log2_tile_rows, encode_parms.tile_rows);
+    EXPECT_EQ(encode_parms.cs, common->color_space);
+    EXPECT_EQ(encode_parms.tile_cols, common->log2_tile_cols);
+    EXPECT_EQ(encode_parms.tile_rows, common->log2_tile_rows);
 
     EXPECT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError();
     return VPX_CODEC_OK == res_dec;
@@ -164,35 +128,18 @@ class VpxEncoderParmsGetToDecoder
   EncodeParameters encode_parms;
 };
 
-// TODO(hkuang): This test conflicts with frame parallel decode. So disable it
-// for now until fix.
-TEST_P(VpxEncoderParmsGetToDecoder, DISABLED_BitstreamParms) {
+TEST_P(VpxEncoderParmsGetToDecoder, BitstreamParms) {
   init_flags_ = VPX_CODEC_USE_PSNR;
 
-  libvpx_test::VideoSource *video;
-  if (is_extension_y4m(test_video_.name)) {
-    video = new libvpx_test::Y4mVideoSource(test_video_.name,
-                                            0, test_video_.frames);
-  } else {
-    video = new libvpx_test::YUVVideoSource(test_video_.name,
-                                            VPX_IMG_FMT_I420,
-                                            test_video_.width,
-                                            test_video_.height,
-                                            kFramerate, 1, 0,
-                                            test_video_.frames);
-  }
+  libvpx_test::VideoSource *const video =
+      new libvpx_test::Y4mVideoSource(test_video_.name, 0, test_video_.frames);
+  ASSERT_TRUE(video != NULL);
 
   ASSERT_NO_FATAL_FAILURE(RunLoop(video));
-  delete(video);
+  delete video;
 }
 
-VP9_INSTANTIATE_TEST_CASE(
-    VpxEncoderParmsGetToDecoder,
-    ::testing::ValuesIn(kVP9EncodeParameterSet),
-    ::testing::ValuesIn(kVP9EncodePerfTestVectors));
-
-VP10_INSTANTIATE_TEST_CASE(
-    VpxEncoderParmsGetToDecoder,
-    ::testing::ValuesIn(kVP9EncodeParameterSet),
-    ::testing::ValuesIn(kVP9EncodePerfTestVectors));
+VP9_INSTANTIATE_TEST_CASE(VpxEncoderParmsGetToDecoder,
+                          ::testing::ValuesIn(kVP9EncodeParameterSet),
+                          ::testing::ValuesIn(kVP9EncodePerfTestVectors));
 }  // namespace
index ebf7a079b13106f85f4c8bd77cd1c3a6b32765af..6b99606ffb75d30f6fa891d8951eb09df971a316 100644 (file)
@@ -161,17 +161,19 @@ static void inc_mv_component(int v, nmv_component_counts *comp_counts,
   }
 }
 
-void vp10_inc_mv(const MV *mv, nmv_context_counts *counts) {
+void vp10_inc_mv(const MV *mv, nmv_context_counts *counts, const int usehp) {
   if (counts != NULL) {
     const MV_JOINT_TYPE j = vp10_get_mv_joint(mv);
     ++counts->joints[j];
 
     if (mv_joint_vertical(j)) {
-      inc_mv_component(mv->row, &counts->comps[0], 1, 1);
+      inc_mv_component(mv->row, &counts->comps[0], 1,
+                       !CONFIG_MISC_FIXES || usehp);
     }
 
     if (mv_joint_horizontal(j)) {
-      inc_mv_component(mv->col, &counts->comps[1], 1, 1);
+      inc_mv_component(mv->col, &counts->comps[1], 1,
+                       !CONFIG_MISC_FIXES || usehp);
     }
   }
 }
index fd9f1c0ce7c40c69465925b31fafd7285c06abbb..d1eb95c5798ba41cf4cb16aadf3f44319287a84d 100644 (file)
@@ -124,7 +124,7 @@ typedef struct {
   nmv_component_counts comps[2];
 } nmv_context_counts;
 
-void vp10_inc_mv(const MV *mv, nmv_context_counts *mvctx);
+void vp10_inc_mv(const MV *mv, nmv_context_counts *mvctx, const int usehp);
 
 #ifdef __cplusplus
 }  // extern "C"
index 6388c7a28d7d7b858e393bbd37c49e237f4f316d..a401ddcb2e40ffcd4359a3de9d0f177267aad166 100644 (file)
 #include "vp10/common/loopfilter.h"
 #include "vpx_util/vpx_thread.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct VP10Common;
 struct FRAME_COUNTS;
 
@@ -54,4 +58,8 @@ void vp10_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame,
 void vp10_accumulate_frame_counts(struct VP10Common *cm,
                                  struct FRAME_COUNTS *counts, int is_dec);
 
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
 #endif  // VP10_COMMON_LOOPFILTER_THREAD_H_
index ef787099b34cc069e7dfb94a8677b383f9b3622f..2490973e349e544c40542b2c96edb4331f93fde7 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <emmintrin.h>  // SSE2
 
+#include "./vp10_rtcd.h"
 #include "vp10/common/vp10_fwd_txfm.h"
 #include "vpx_dsp/txfm_common.h"
 #include "vpx_dsp/x86/txfm_common_sse2.h"
index b190f734c65a942665cb4085ccc0154ba3d82013..f157ada20e19116b8f1a3f37b18e492d7b790798 100644 (file)
@@ -294,7 +294,7 @@ static INLINE void read_mv(vpx_reader *r, MV *mv, const MV *ref,
   if (mv_joint_horizontal(joint_type))
     diff.col = read_mv_component(r, &ctx->comps[1], use_hp);
 
-  vp10_inc_mv(&diff, counts);
+  vp10_inc_mv(&diff, counts, use_hp);
 
   mv->row = ref->row + diff.row;
   mv->col = ref->col + diff.col;
index 7332aada292c78c26858472662977889f983ef58..1b0dc0191d2b9e38c16abdac9ebacd34c1e9e0e8 100644 (file)
 #include "vpx_util/vpx_thread.h"
 #include "vpx/internal/vpx_codec_internal.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct VP10Common;
 struct VP10Decoder;
 
@@ -63,4 +67,8 @@ void vp10_frameworker_broadcast(RefCntBuffer *const buf, int row);
 void vp10_frameworker_copy_context(VPxWorker *const dst_worker,
                                   VPxWorker *const src_worker);
 
+#ifdef __cplusplus
+}    // extern "C"
+#endif
+
 #endif  // VP10_DECODER_DTHREAD_H_
index 9310d1fc36e477c5ca025860ea1752211c408a13..67a07cb5054b4c4f149ce1dcf465deb7012b9229 100644 (file)
 #include "vp10/common/blockd.h"
 #include "vp10/encoder/block.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct VP10_COMP;
 struct VP10Common;
 struct ThreadData;
@@ -84,4 +88,8 @@ typedef struct PC_TREE {
 void vp10_setup_pc_tree(struct VP10Common *cm, struct ThreadData *td);
 void vp10_free_pc_tree(struct ThreadData *td);
 
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
 #endif /* VP10_ENCODER_CONTEXT_TREE_H_ */
index f1fe5a78f83cd32c2058fe2bc68fda8418f71c4f..ca2de1fba358e2457326cce1b73a92a018905284 100644 (file)
@@ -239,7 +239,7 @@ static void inc_mvs(const MB_MODE_INFO *mbmi, const MB_MODE_INFO_EXT *mbmi_ext,
     const MV *ref = &mbmi_ext->ref_mvs[mbmi->ref_frame[i]][0].as_mv;
     const MV diff = {mvs[i].as_mv.row - ref->row,
                      mvs[i].as_mv.col - ref->col};
-    vp10_inc_mv(&diff, counts);
+    vp10_inc_mv(&diff, counts, vp10_use_mv_hp(ref));
   }
 }
 
index 06cce93c0cd726d619637cc2e8cb8f3c3aa2a1e9..58c6423cb2cfbfe5a73fa7008bce65622ea21de6 100644 (file)
@@ -3623,6 +3623,7 @@ static void encode_frame_to_data_rate(VP10_COMP *cpi,
     cpi->refresh_last_frame = 1;
 
   cm->frame_to_show = get_frame_new_buffer(cm);
+  cm->frame_to_show->color_space = cm->color_space;
 
   // Pick the loop filter level for the frame.
   loopfilter_frame(cpi, cm);
index 997df0d0447d6ba7817033b68531d5997441dd8e..d72816cd5c894b9b8c5049916538f86b5313c24f 100644 (file)
 #ifndef VP10_ENCODER_ETHREAD_H_
 #define VP10_ENCODER_ETHREAD_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct VP10_COMP;
 struct ThreadData;
 
@@ -22,4 +26,8 @@ typedef struct EncWorkerData {
 
 void vp10_encode_tiles_mt(struct VP10_COMP *cpi);
 
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
 #endif  // VP10_ENCODER_ETHREAD_H_
index 131fc80ca5d705ad12d5470e39ef80ad0837ebc8..bf6377097ede68d98ef1c90a8b992d11c5a97a20 100644 (file)
 #include <stdio.h>
 #include "vpx/vpx_integer.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void vp10_resize_plane(const uint8_t *const input,
                       int height,
                       int width,
@@ -121,4 +125,9 @@ void vp10_highbd_resize_frame444(const uint8_t *const y,
                                 int owidth,
                                 int bd);
 #endif    // CONFIG_VP9_HIGHBITDEPTH
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
 #endif    // VP10_ENCODER_RESIZE_H_
index e2feca7b9c47b51869fc992cf6550d4e8ee58c93..a8f9aa351648bc2858745c0930047f86fcdfec63 100644 (file)
@@ -88,7 +88,8 @@ static vpx_codec_err_t decoder_init(vpx_codec_ctx_t *ctx,
   (void)data;
 
   if (!ctx->priv) {
-    vpx_codec_alg_priv_t *const priv = vpx_calloc(1, sizeof(*priv));
+    vpx_codec_alg_priv_t *const priv =
+        (vpx_codec_alg_priv_t *)vpx_calloc(1, sizeof(*priv));
     if (priv == NULL)
       return VPX_CODEC_MEM_ERROR;
 
index 4bc34372d7a7af522bc9e223831d6b7f1a60693a..8e1bfc2bdaba0a5d08b0ed3f477afa7ac2bcd7c4 100644 (file)
@@ -56,7 +56,7 @@ static void yuvconfig2image(vpx_image_t *img, const YV12_BUFFER_CONFIG  *yv12,
   if (yv12->flags & YV12_FLAG_HIGHBITDEPTH) {
     // vpx_image_t uses byte strides and a pointer to the first byte
     // of the image.
-    img->fmt |= VPX_IMG_FMT_HIGHBITDEPTH;
+    img->fmt = (vpx_img_fmt_t)(img->fmt | VPX_IMG_FMT_HIGHBITDEPTH);
     img->bit_depth = yv12->bit_depth;
     img->planes[VPX_PLANE_Y] = (uint8_t*)CONVERT_TO_SHORTPTR(yv12->y_buffer);
     img->planes[VPX_PLANE_U] = (uint8_t*)CONVERT_TO_SHORTPTR(yv12->u_buffer);
index 07af1bc4c3c1a28e51b010219c545a1334fc3921..04666b62ce190a48b0f2443e2672669f3d8d95e1 100644 (file)
 #include "vp9/common/vp9_loopfilter.h"
 #include "vpx_util/vpx_thread.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct VP9Common;
 struct FRAME_COUNTS;
 
@@ -54,4 +58,8 @@ void vp9_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame,
 void vp9_accumulate_frame_counts(struct VP9Common *cm,
                                  struct FRAME_COUNTS *counts, int is_dec);
 
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
 #endif  // VP9_COMMON_VP9_LOOPFILTER_THREAD_H_
index f6cdccd9c2ac63f8d3604997d09d9c89d856d78d..ba7c38a511fc75446449aa16d370fad8c0e16f57 100644 (file)
 #include "vpx_util/vpx_thread.h"
 #include "vpx/internal/vpx_codec_internal.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct VP9Common;
 struct VP9Decoder;
 
@@ -63,4 +67,8 @@ void vp9_frameworker_broadcast(RefCntBuffer *const buf, int row);
 void vp9_frameworker_copy_context(VPxWorker *const dst_worker,
                                   VPxWorker *const src_worker);
 
+#ifdef __cplusplus
+}    // extern "C"
+#endif
+
 #endif  // VP9_DECODER_VP9_DTHREAD_H_
index ac2449772802bb04d55540ba9dfc794e5cd64eeb..8e365ce33919c2c3e75289230dd930b53d888061 100644 (file)
 #include "vp9/common/vp9_blockd.h"
 #include "vp9/encoder/vp9_block.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct VP9_COMP;
 struct VP9Common;
 struct ThreadData;
@@ -84,4 +88,8 @@ typedef struct PC_TREE {
 void vp9_setup_pc_tree(struct VP9Common *cm, struct ThreadData *td);
 void vp9_free_pc_tree(struct ThreadData *td);
 
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
 #endif /* VP9_ENCODER_VP9_CONTEXT_TREE_H_ */
index 8e83903c668653d7e26c1514f079a5ccb102b339..60c6cec1985dbf3518c5d941ba5ebb2a5c421041 100644 (file)
@@ -3816,6 +3816,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
     cpi->refresh_last_frame = 1;
 
   cm->frame_to_show = get_frame_new_buffer(cm);
+  cm->frame_to_show->color_space = cm->color_space;
 
   // Pick the loop filter level for the frame.
   loopfilter_frame(cpi, cm);
index e87c50bc7125bc97fb90ad4464d99f5c272eeb56..1efa4dcde2f6ef315aff762610147cf331cd16c2 100644 (file)
 #ifndef VP9_ENCODER_VP9_ETHREAD_H_
 #define VP9_ENCODER_VP9_ETHREAD_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct VP9_COMP;
 struct ThreadData;
 
@@ -22,4 +26,8 @@ typedef struct EncWorkerData {
 
 void vp9_encode_tiles_mt(struct VP9_COMP *cpi);
 
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
 #endif  // VP9_ENCODER_VP9_ETHREAD_H_
index 067af53f993653abd07f6cd5e249fe5ea4be4df4..b5feb3860663abd5a90e34caaa692f2b4bda3b5d 100644 (file)
 #include <stdio.h>
 #include "vpx/vpx_integer.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void vp9_resize_plane(const uint8_t *const input,
                       int height,
                       int width,
@@ -121,4 +125,9 @@ void vp9_highbd_resize_frame444(const uint8_t *const y,
                                 int owidth,
                                 int bd);
 #endif    // CONFIG_VP9_HIGHBITDEPTH
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
 #endif    // VP9_ENCODER_VP9_RESIZE_H_
index 8119df85ffd33f84d908ee89262c36f924beccea..eb2371e2c0e79ed397654277c04b0f6ee54c8e92 100644 (file)
@@ -88,7 +88,8 @@ static vpx_codec_err_t decoder_init(vpx_codec_ctx_t *ctx,
   (void)data;
 
   if (!ctx->priv) {
-    vpx_codec_alg_priv_t *const priv = vpx_calloc(1, sizeof(*priv));
+    vpx_codec_alg_priv_t *const priv =
+        (vpx_codec_alg_priv_t *)vpx_calloc(1, sizeof(*priv));
     if (priv == NULL)
       return VPX_CODEC_MEM_ERROR;
 
index 58bb7d5d6486fb6fef9439bdc105e72f0a498730..da7ae0eda8b994cea76d550c79767486a431cf4a 100644 (file)
@@ -56,7 +56,7 @@ static void yuvconfig2image(vpx_image_t *img, const YV12_BUFFER_CONFIG  *yv12,
   if (yv12->flags & YV12_FLAG_HIGHBITDEPTH) {
     // vpx_image_t uses byte strides and a pointer to the first byte
     // of the image.
-    img->fmt |= VPX_IMG_FMT_HIGHBITDEPTH;
+    img->fmt = (vpx_img_fmt_t)(img->fmt | VPX_IMG_FMT_HIGHBITDEPTH);
     img->bit_depth = yv12->bit_depth;
     img->planes[VPX_PLANE_Y] = (uint8_t*)CONVERT_TO_SHORTPTR(yv12->y_buffer);
     img->planes[VPX_PLANE_U] = (uint8_t*)CONVERT_TO_SHORTPTR(yv12->u_buffer);