Reinitialize dequantizer when switching from 10/12 bit to 8 bit.

Change-Id: Id294cf8d314a3f8aaf4ca2a6b3da052cc898a78c
This commit is contained in:
Alexander Voronov
2014-09-11 17:14:23 +04:00
parent 64fca22b4d
commit 902529c595
4 changed files with 14 additions and 6 deletions

View File

@@ -185,6 +185,7 @@ typedef struct VP9Common {
// VPX_BITS_8 in versions 0 and 1, VPX_BITS_10/VPX_BITS_12 in version 2 // VPX_BITS_8 in versions 0 and 1, VPX_BITS_10/VPX_BITS_12 in version 2
vpx_bit_depth_t bit_depth; vpx_bit_depth_t bit_depth;
vpx_bit_depth_t dequant_bit_depth;
#if CONFIG_VP9_POSTPROC #if CONFIG_VP9_POSTPROC
struct postproc_state postproc_state; struct postproc_state postproc_state;

View File

@@ -646,10 +646,10 @@ static void setup_quantization(VP9_COMMON *const cm, MACROBLOCKD *const xd,
update |= read_delta_q(rb, &cm->uv_dc_delta_q); update |= read_delta_q(rb, &cm->uv_dc_delta_q);
update |= read_delta_q(rb, &cm->uv_ac_delta_q); update |= read_delta_q(rb, &cm->uv_ac_delta_q);
// TODO(peter.derivaz): Don't really want to call this for every frame if (update || cm->bit_depth != cm->dequant_bit_depth) {
// for high-bit-depth, but need the bit depth to init dequantizers
if (update || cm->profile >= PROFILE_2)
vp9_init_dequantizer(cm); vp9_init_dequantizer(cm);
cm->dequant_bit_depth = cm->bit_depth;
}
xd->lossless = cm->base_qindex == 0 && xd->lossless = cm->base_qindex == 0 &&
cm->y_dc_delta_q == 0 && cm->y_dc_delta_q == 0 &&

View File

@@ -66,6 +66,7 @@ VP9Decoder *vp9_decoder_create() {
vpx_memset(&cm->ref_frame_map, -1, sizeof(cm->ref_frame_map)); vpx_memset(&cm->ref_frame_map, -1, sizeof(cm->ref_frame_map));
cm->current_video_frame = 0; cm->current_video_frame = 0;
cm->dequant_bit_depth = VPX_BITS_NOT_SET;
pbi->ready_for_new_data = 1; pbi->ready_for_new_data = 1;
// vp9_init_dequantizer() is first called here. Add check in // vp9_init_dequantizer() is first called here. Add check in

View File

@@ -43,6 +43,8 @@
extern "C" { extern "C" {
#endif #endif
#include <assert.h>
#include "./vpx_config.h" #include "./vpx_config.h"
#include "./vpx_integer.h" #include "./vpx_integer.h"
#include "./vpx_image.h" #include "./vpx_image.h"
@@ -216,9 +218,10 @@ extern "C" {
* This enumeration determines the bit depth of the codec. * This enumeration determines the bit depth of the codec.
*/ */
typedef enum vpx_bit_depth { typedef enum vpx_bit_depth {
VPX_BITS_8 = 8, /**< 8 bits */ VPX_BITS_8 = 8, /**< 8 bits */
VPX_BITS_10 = 10, /**< 10 bits */ VPX_BITS_10 = 10, /**< 10 bits */
VPX_BITS_12 = 12 /**< 12 bits */ VPX_BITS_12 = 12, /**< 12 bits */
VPX_BITS_NOT_SET = 0xFF /**< Invalid value */
} vpx_bit_depth_t; } vpx_bit_depth_t;
/* /*
@@ -481,6 +484,9 @@ static INLINE unsigned int vpx_bit_depth_to_bps(vpx_bit_depth_t bit_depth) {
case VPX_BITS_12: case VPX_BITS_12:
bps = 12; bps = 12;
break; break;
case VPX_BITS_NOT_SET:
assert(0 && "Bit depth is not initialized.");
break;
} }
return bps; return bps;
} }