1 /* 2 * Copyright (c) 2022 Samsung Electronics Co., Ltd. 3 * All Rights Reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * - Redistributions of source code must retain the above copyright notice, 9 * this list of conditions and the following disclaimer. 10 * 11 * - Redistributions in binary form must reproduce the above copyright notice, 12 * this list of conditions and the following disclaimer in the documentation 13 * and/or other materials provided with the distribution. 14 * 15 * - Neither the name of the copyright owner, nor the names of its contributors 16 * may be used to endorse or promote products derived from this software 17 * without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32 #ifndef _OAPV_TQ_H_ 33 #define _OAPV_TQ_H_ 34 35 #include "oapv_def.h" 36 37 /////////////////////////////////////////////////////////////////////////////// 38 // start of encoder code 39 #if ENABLE_ENCODER 40 /////////////////////////////////////////////////////////////////////////////// 41 42 extern const oapv_fn_tx_t oapv_tbl_fn_tx[2]; 43 extern const oapv_fn_quant_t oapv_tbl_fn_quant[2]; 44 extern const int oapv_quant_scale[6]; 45 46 void oapv_trans(oapve_ctx_t *ctx, s16 *coef, int log2_w, int log2_h, int bit_depth); 47 void oapv_itx_get_wo_sft(s16 *src, s16 *dst, s32 *dst32, int shift, int line); 48 49 /////////////////////////////////////////////////////////////////////////////// 50 // end of encoder code 51 #endif // ENABLE_ENCODER 52 /////////////////////////////////////////////////////////////////////////////// 53 54 /////////////////////////////////////////////////////////////////////////////// 55 // start of decoder code 56 #if ENABLE_DECODER 57 /////////////////////////////////////////////////////////////////////////////// 58 #define ITX_SHIFT1 (7) /* shift after 1st IT stage */ 59 #define ITX_SHIFT2(bit_depth) (12 - (bit_depth - 8)) /* shift after 2nd IT stage */ 60 61 #define ITX_CLIP(x) \ 62 (s16)(((x) < MIN_TX_VAL) ? MIN_TX_VAL : (((x) > MAX_TX_VAL) ? MAX_TX_VAL : (x))) 63 64 #define MAX_TX_DYNAMIC_RANGE_32 (31) 65 #define MAX_TX_VAL_32 (2147483647) 66 #define MIN_TX_VAL_32 (-2147483647 - 1) 67 #define ITX_CLIP_32(x) \ 68 (s32)(((x) <= MIN_TX_VAL_32) ? MIN_TX_VAL_32 : (((x) >= MAX_TX_VAL_32) ? MAX_TX_VAL_32 : (x))) 69 70 extern const oapv_fn_itx_part_t oapv_tbl_fn_itx_part[2]; 71 extern const oapv_fn_itx_t oapv_tbl_fn_itx[2]; 72 extern const oapv_fn_dquant_t oapv_tbl_fn_dquant[2]; 73 extern const oapv_fn_itx_adj_t oapv_tbl_fn_itx_adj[2]; 74 75 /////////////////////////////////////////////////////////////////////////////// 76 // end of decoder code 77 #endif // ENABLE_DECODER 78 /////////////////////////////////////////////////////////////////////////////// 79 80 #endif /* _OAPV_TQ_H_ */ 81