1ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang/* 2ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 3ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang * 4ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang * Use of this source code is governed by a BSD-style license 5ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang * that can be found in the LICENSE file in the root of the source 6ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang * tree. An additional intellectual property rights grant can be found 7ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang * in the file PATENTS. All contributing project authors may 8ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang * be found in the AUTHORS file in the root of the source tree. 9ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang */ 10ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang 11ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#ifndef VP9_ENCODER_VP9_QUANTIZE_H_ 12ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#define VP9_ENCODER_VP9_QUANTIZE_H_ 13ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang 14ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian#include "./vpx_config.h" 15ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#include "vp9/encoder/vp9_block.h" 16ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang 172ec72e65689c948e92b826ae1e867bf369e72f13Vignesh Venkatasubramanian#ifdef __cplusplus 182ec72e65689c948e92b826ae1e867bf369e72f13Vignesh Venkatasubramanianextern "C" { 192ec72e65689c948e92b826ae1e867bf369e72f13Vignesh Venkatasubramanian#endif 202ec72e65689c948e92b826ae1e867bf369e72f13Vignesh Venkatasubramanian 214fb68e5dd4e93c7599dc905d861de11ac39c5585hkuangtypedef struct { 224fb68e5dd4e93c7599dc905d861de11ac39c5585hkuang DECLARE_ALIGNED(16, int16_t, y_quant[QINDEX_RANGE][8]); 234fb68e5dd4e93c7599dc905d861de11ac39c5585hkuang DECLARE_ALIGNED(16, int16_t, y_quant_shift[QINDEX_RANGE][8]); 244fb68e5dd4e93c7599dc905d861de11ac39c5585hkuang DECLARE_ALIGNED(16, int16_t, y_zbin[QINDEX_RANGE][8]); 254fb68e5dd4e93c7599dc905d861de11ac39c5585hkuang DECLARE_ALIGNED(16, int16_t, y_round[QINDEX_RANGE][8]); 264fb68e5dd4e93c7599dc905d861de11ac39c5585hkuang 27ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian // TODO(jingning): in progress of re-working the quantization. will decide 28ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian // if we want to deprecate the current use of y_quant. 29ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian DECLARE_ALIGNED(16, int16_t, y_quant_fp[QINDEX_RANGE][8]); 30ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian DECLARE_ALIGNED(16, int16_t, uv_quant_fp[QINDEX_RANGE][8]); 31ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian DECLARE_ALIGNED(16, int16_t, y_round_fp[QINDEX_RANGE][8]); 32ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian DECLARE_ALIGNED(16, int16_t, uv_round_fp[QINDEX_RANGE][8]); 33ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian 344fb68e5dd4e93c7599dc905d861de11ac39c5585hkuang DECLARE_ALIGNED(16, int16_t, uv_quant[QINDEX_RANGE][8]); 354fb68e5dd4e93c7599dc905d861de11ac39c5585hkuang DECLARE_ALIGNED(16, int16_t, uv_quant_shift[QINDEX_RANGE][8]); 364fb68e5dd4e93c7599dc905d861de11ac39c5585hkuang DECLARE_ALIGNED(16, int16_t, uv_zbin[QINDEX_RANGE][8]); 374fb68e5dd4e93c7599dc905d861de11ac39c5585hkuang DECLARE_ALIGNED(16, int16_t, uv_round[QINDEX_RANGE][8]); 384fb68e5dd4e93c7599dc905d861de11ac39c5585hkuang} QUANTS; 394fb68e5dd4e93c7599dc905d861de11ac39c5585hkuang 40ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanianvoid vp9_quantize_dc(const int16_t *coeff_ptr, int skip_block, 41ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian const int16_t *round_ptr, const int16_t quant_ptr, 42ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian int16_t *qcoeff_ptr, int16_t *dqcoeff_ptr, 43ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian const int16_t dequant_ptr, uint16_t *eob_ptr); 44ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanianvoid vp9_quantize_dc_32x32(const int16_t *coeff_ptr, int skip_block, 45ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian const int16_t *round_ptr, const int16_t quant_ptr, 46ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian int16_t *qcoeff_ptr, int16_t *dqcoeff_ptr, 47ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian const int16_t dequant_ptr, uint16_t *eob_ptr); 482ec72e65689c948e92b826ae1e867bf369e72f13Vignesh Venkatasubramanianvoid vp9_regular_quantize_b_4x4(MACROBLOCK *x, int plane, int block, 495ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang const int16_t *scan, const int16_t *iscan); 50ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang 51ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuangstruct VP9_COMP; 524fb68e5dd4e93c7599dc905d861de11ac39c5585hkuangstruct VP9Common; 53ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang 545ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangvoid vp9_frame_init_quantizer(struct VP9_COMP *cpi); 55ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang 565ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangvoid vp9_update_zbin_extra(struct VP9_COMP *cpi, MACROBLOCK *x); 57ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang 582ec72e65689c948e92b826ae1e867bf369e72f13Vignesh Venkatasubramanianvoid vp9_init_plane_quantizers(struct VP9_COMP *cpi, MACROBLOCK *x); 59ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang 605ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuangvoid vp9_init_quantizer(struct VP9_COMP *cpi); 61ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang 624fb68e5dd4e93c7599dc905d861de11ac39c5585hkuangvoid vp9_set_quantizer(struct VP9Common *cm, int q); 634fb68e5dd4e93c7599dc905d861de11ac39c5585hkuang 64ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanianint vp9_quantizer_to_qindex(int quantizer); 65ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian 66ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanianint vp9_qindex_to_quantizer(int qindex); 67ba6c59e9d7d7013b3906b6f4230b663422681848Vignesh Venkatasubramanian 682ec72e65689c948e92b826ae1e867bf369e72f13Vignesh Venkatasubramanian#ifdef __cplusplus 692ec72e65689c948e92b826ae1e867bf369e72f13Vignesh Venkatasubramanian} // extern "C" 702ec72e65689c948e92b826ae1e867bf369e72f13Vignesh Venkatasubramanian#endif 712ec72e65689c948e92b826ae1e867bf369e72f13Vignesh Venkatasubramanian 72ba164dffc5a6795bce97fae02b51ccf3330e15e4hkuang#endif // VP9_ENCODER_VP9_QUANTIZE_H_ 73