16fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org/*
26fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
36fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org *
46fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org *  Use of this source code is governed by a BSD-style license
56fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org *  that can be found in the LICENSE file in the root of the source
66fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org *  tree. An additional intellectual property rights grant can be found
76fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org *  in the file PATENTS.  All contributing project authors may
86fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org *  be found in the AUTHORS file in the root of the source tree.
96fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org */
106fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
116fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org#ifndef VP9_ENCODER_VP9_QUANTIZE_H_
126fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org#define VP9_ENCODER_VP9_QUANTIZE_H_
136fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
14693441efe611de7ca09c00f4e79776f604b689f4joeyparrish@google.com#include "./vpx_config.h"
156fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org#include "vp9/encoder/vp9_block.h"
166fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
17dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org#ifdef __cplusplus
18dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.orgextern "C" {
19dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org#endif
20dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org
2193a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.orgtypedef struct {
2293a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org  DECLARE_ALIGNED(16, int16_t, y_quant[QINDEX_RANGE][8]);
2393a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org  DECLARE_ALIGNED(16, int16_t, y_quant_shift[QINDEX_RANGE][8]);
2493a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org  DECLARE_ALIGNED(16, int16_t, y_zbin[QINDEX_RANGE][8]);
2593a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org  DECLARE_ALIGNED(16, int16_t, y_round[QINDEX_RANGE][8]);
2693a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org
2788b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org  // TODO(jingning): in progress of re-working the quantization. will decide
2888b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org  // if we want to deprecate the current use of y_quant.
2988b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org  DECLARE_ALIGNED(16, int16_t, y_quant_fp[QINDEX_RANGE][8]);
3088b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org  DECLARE_ALIGNED(16, int16_t, uv_quant_fp[QINDEX_RANGE][8]);
31e2064011d36b2008099446503f28e64d445060ecjohannkoenig@chromium.org  DECLARE_ALIGNED(16, int16_t, y_round_fp[QINDEX_RANGE][8]);
32e2064011d36b2008099446503f28e64d445060ecjohannkoenig@chromium.org  DECLARE_ALIGNED(16, int16_t, uv_round_fp[QINDEX_RANGE][8]);
3388b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org
3493a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org  DECLARE_ALIGNED(16, int16_t, uv_quant[QINDEX_RANGE][8]);
3593a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org  DECLARE_ALIGNED(16, int16_t, uv_quant_shift[QINDEX_RANGE][8]);
3693a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org  DECLARE_ALIGNED(16, int16_t, uv_zbin[QINDEX_RANGE][8]);
3793a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org  DECLARE_ALIGNED(16, int16_t, uv_round[QINDEX_RANGE][8]);
3893a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org} QUANTS;
3993a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org
4087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgvoid vp9_quantize_dc(const tran_low_t *coeff_ptr, int skip_block,
4188b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org                     const int16_t *round_ptr, const int16_t quant_ptr,
4287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                     tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
4388b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org                     const int16_t dequant_ptr, uint16_t *eob_ptr);
4487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgvoid vp9_quantize_dc_32x32(const tran_low_t *coeff_ptr, int skip_block,
4588b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org                           const int16_t *round_ptr, const int16_t quant_ptr,
4687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                           tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
4788b47b29cc274dd19cddc37c1ce1834d97df282efgalligan@chromium.org                           const int16_t dequant_ptr, uint16_t *eob_ptr);
48d851b91d14ef0bd71acdce7b90c9a8f1af1181adjohannkoenig@chromium.orgvoid vp9_regular_quantize_b_4x4(MACROBLOCK *x, int plane, int block,
49ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.org                                const int16_t *scan, const int16_t *iscan);
506fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
5187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#if CONFIG_VP9_HIGHBITDEPTH
5287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgvoid vp9_high_quantize_dc(const tran_low_t *coeff_ptr, int skip_block,
5387997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                          const int16_t *round_ptr, const int16_t quant_ptr,
5487997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                          tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
5587997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                          const int16_t dequant_ptr, uint16_t *eob_ptr);
5687997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.orgvoid vp9_high_quantize_dc_32x32(const tran_low_t *coeff_ptr, int skip_block,
5787997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                                const int16_t *round_ptr,
5887997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                                const int16_t quant_ptr, tran_low_t *qcoeff_ptr,
5987997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                                tran_low_t *dqcoeff_ptr,
6087997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org                                const int16_t dequant_ptr, uint16_t *eob_ptr);
6187997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org#endif
6287997d490ae52aa962a985c95b3cddf7f8832641johannkoenig@chromium.org
636fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.orgstruct VP9_COMP;
6493a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.orgstruct VP9Common;
656fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
66ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.orgvoid vp9_frame_init_quantizer(struct VP9_COMP *cpi);
676fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
68ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.orgvoid vp9_update_zbin_extra(struct VP9_COMP *cpi, MACROBLOCK *x);
696fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
70411971f94253c85e1866c281860d6344f6aa0c78fgalligan@chromium.orgvoid vp9_init_plane_quantizers(struct VP9_COMP *cpi, MACROBLOCK *x);
716fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
72ecee051929d6ced19cf324688774acccc9ad4a0ajohannkoenig@chromium.orgvoid vp9_init_quantizer(struct VP9_COMP *cpi);
736fefe538d859300e7febe78271828198c10f1b52fgalligan@chromium.org
7493a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.orgvoid vp9_set_quantizer(struct VP9Common *cm, int q);
7593a74791c8e808ea76001ee07693aa2a5fdd3500johannkoenig@chromium.org
76693441efe611de7ca09c00f4e79776f604b689f4joeyparrish@google.comint vp9_quantizer_to_qindex(int quantizer);
77693441efe611de7ca09c00f4e79776f604b689f4joeyparrish@google.com
78693441efe611de7ca09c00f4e79776f604b689f4joeyparrish@google.comint vp9_qindex_to_quantizer(int qindex);
79693441efe611de7ca09c00f4e79776f604b689f4joeyparrish@google.com
80dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org#ifdef __cplusplus
81dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org}  // extern "C"
82dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org#endif
83dddee1ec7cedf276305b107429f684539b105276johannkoenig@chromium.org
84d348b8d765c019ee7250075d663a83db00c65c08tomfinegan@chromium.org#endif  // VP9_ENCODER_VP9_QUANTIZE_H_
85