From 17db5d00be2f005f11428edf0fd23265d04d100f Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Mon, 11 Feb 2013 21:14:46 -0800 Subject: enable bitstream lossless support 1. Added a bit in frame header to to indicate if a frame is encoded in lossless mode, so decoder does not make the decision based on Q0 2. Minor changes to make sure that lossy coding works same as when the lossless experiment is not enabled. 3. Renamed function pointers for transforms to be consistent, using prefix fwd_txm and inv_txm for forward and inverse respectively To encode in lossless mode, using "--lossless=1 --min-q=0 --max-q=0" with vpxenc. Change-Id: Ifae53b26d2ffbe378d707e29d96817b8a5e6c068 --- vp9/common/vp9_blockd.h | 22 +++++++++++----------- vp9/common/vp9_idctllm.c | 7 ++++--- vp9/common/vp9_invtrans.c | 6 +++--- 3 files changed, 18 insertions(+), 17 deletions(-) (limited to 'vp9/common') diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h index b0c1bfa08..5c4c238b7 100644 --- a/vp9/common/vp9_blockd.h +++ b/vp9/common/vp9_blockd.h @@ -390,22 +390,22 @@ typedef struct macroblockd { int lossless; #endif /* Inverse transform function pointers. */ - void (*inv_xform4x4_1_x8)(int16_t *input, int16_t *output, int pitch); - void (*inv_xform4x4_x8)(int16_t *input, int16_t *output, int pitch); - void (*inv_walsh4x4_1)(int16_t *in, int16_t *out); - void (*inv_walsh4x4_lossless)(int16_t *in, int16_t *out); - void (*idct_add)(int16_t *input, const int16_t *dq, + void (*inv_txm4x4_1)(int16_t *input, int16_t *output, int pitch); + void (*inv_txm4x4)(int16_t *input, int16_t *output, int pitch); + void (*inv_2ndtxm4x4_1)(int16_t *in, int16_t *out); + void (*inv_2ndtxm4x4)(int16_t *in, int16_t *out); + void (*itxm_add)(int16_t *input, const int16_t *dq, uint8_t *pred, uint8_t *output, int pitch, int stride); - void (*dc_idct_add)(int16_t *input, const int16_t *dq, + void (*dc_itxm_add)(int16_t *input, const int16_t *dq, uint8_t *pred, uint8_t *output, int pitch, int stride, int dc); - void (*dc_only_idct_add)(int input_dc, uint8_t *pred_ptr, + void (*dc_only_itxm_add)(int input_dc, uint8_t *pred_ptr, uint8_t *dst_ptr, int pitch, int stride); - void (*dc_idct_add_y_block)(int16_t *q, const int16_t *dq, + void (*dc_itxm_add_y_block)(int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dst, int stride, uint16_t *eobs, const int16_t *dc); - void (*idct_add_y_block)(int16_t *q, const int16_t *dq, + void (*itxm_add_y_block)(int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dst, int stride, uint16_t *eobs); - void (*idct_add_uv_block)(int16_t *q, const int16_t *dq, + void (*itxm_add_uv_block)(int16_t *q, const int16_t *dq, uint8_t *pre, uint8_t *dst_u, uint8_t *dst_v, int stride, uint16_t *eobs); @@ -520,7 +520,7 @@ static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, const BLOCKD *b) { return tx_type; #if CONFIG_LOSSLESS if (xd->lossless) - return tx_type; + return DCT_DCT; #endif // TODO(rbultje, debargha): Explore ADST usage for superblocks if (xd->mode_info_context->mbmi.sb_type) diff --git a/vp9/common/vp9_idctllm.c b/vp9/common/vp9_idctllm.c index b27b34cf2..5afce6ee4 100644 --- a/vp9/common/vp9_idctllm.c +++ b/vp9/common/vp9_idctllm.c @@ -476,12 +476,13 @@ void vp9_short_inv_walsh4x4_1_x8_c(int16_t *in, int16_t *out, int pitch) { } } -void vp9_dc_only_inv_walsh_add_c(short input_dc, uint8_t *pred_ptr, +void vp9_dc_only_inv_walsh_add_c(int input_dc, uint8_t *pred_ptr, uint8_t *dst_ptr, int pitch, int stride) { int r, c; - short tmp[16]; - vp9_short_inv_walsh4x4_1_x8_c(&input_dc, tmp, 4 << 1); + int16_t dc = input_dc; + int16_t tmp[16]; + vp9_short_inv_walsh4x4_1_x8_c(&dc, tmp, 4 << 1); for (r = 0; r < 4; r++) { for (c = 0; c < 4; c++) { diff --git a/vp9/common/vp9_invtrans.c b/vp9/common/vp9_invtrans.c index 241a5bcb7..94cfb62df 100644 --- a/vp9/common/vp9_invtrans.c +++ b/vp9/common/vp9_invtrans.c @@ -32,9 +32,9 @@ static void recon_dcblock_8x8(MACROBLOCKD *xd) { void vp9_inverse_transform_b_4x4(MACROBLOCKD *xd, int block, int pitch) { BLOCKD *b = &xd->block[block]; if (b->eob <= 1) - xd->inv_xform4x4_1_x8(b->dqcoeff, b->diff, pitch); + xd->inv_txm4x4_1(b->dqcoeff, b->diff, pitch); else - xd->inv_xform4x4_x8(b->dqcoeff, b->diff, pitch); + xd->inv_txm4x4(b->dqcoeff, b->diff, pitch); } void vp9_inverse_transform_mby_4x4(MACROBLOCKD *xd) { @@ -44,7 +44,7 @@ void vp9_inverse_transform_mby_4x4(MACROBLOCKD *xd) { if (has_2nd_order) { /* do 2nd order transform on the dc block */ - xd->inv_walsh4x4_lossless(blockd[24].dqcoeff, blockd[24].diff); + xd->inv_2ndtxm4x4(blockd[24].dqcoeff, blockd[24].diff); recon_dcblock(xd); } -- cgit v1.2.3