1 /****************************************************************************** 2 * 3 * Copyright (C) 2022 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ***************************************************************************** 18 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore 19 */ 20 21 /** 22 ******************************************************************************* 23 * @file 24 * isvc_res_pred_private_defs.h 25 * 26 * @brief 27 * Contains datatype and macro definitions used exclusively in 28 * residual prediction 29 * 30 ******************************************************************************* 31 */ 32 33 #ifndef _ISVCE_RES_PRED_PRIVATE_DEFS_H_ 34 #define _ISVCE_RES_PRED_PRIVATE_DEFS_H_ 35 36 #include "ih264_typedefs.h" 37 #include "isvc_defs.h" 38 #include "isvc_structs.h" 39 40 #define REF_ARRAY_MAX_WIDTH (MB_SIZE + 6) 41 42 #define REF_ARRAY_MAX_HEIGHT (MB_SIZE + 6) 43 44 typedef UWORD32 FT_GET_SAD_WITH_RES_PRED(buffer_container_t *ps_src, buffer_container_t *ps_pred, 45 buffer_container_t *ps_res, UWORD32 u4_mb_wd, 46 UWORD32 u4_mb_ht); 47 48 typedef void FT_RESIDUAL_SAMPLER(coordinates_t *ps_ref_array_positions, 49 coordinates_t *ps_ref_array_phases, buffer_container_t *ps_inp, 50 buffer_container_t *ps_out, buffer_container_t *ps_scratch, 51 UWORD32 u4_ref_nnz, UWORD8 u1_ref_tx_size); 52 53 /* Structs */ 54 /* Offsets, etc used for residual upsampling and interpolation */ 55 /* Derived as per 'G.8.6.3.2', and 'G.8.6.3.3' for all MB's once during init */ 56 typedef struct res_pred_mb_state_t 57 { 58 coordinates_t s_offsets; 59 60 coordinates_t s_ref_array_dims; 61 62 coordinates_t *ps_ref_array_positions; 63 64 coordinates_t *ps_ref_array_phases; 65 } res_pred_mb_state_t; 66 67 typedef struct res_pred_layer_state_t 68 { 69 layer_resampler_props_t *ps_luma_props; 70 71 layer_resampler_props_t *ps_chroma_props; 72 73 res_pred_mb_state_t *ps_luma_mb_states; 74 75 res_pred_mb_state_t *ps_chroma_mb_states; 76 77 WORD8 *pi1_mb_mode; 78 79 WORD32 i4_mb_mode_stride; 80 81 } res_pred_layer_state_t; 82 83 typedef struct res_pred_mem_store_t 84 { 85 buffer_container_t s_scratch; 86 87 } res_pred_mem_store_t; 88 89 typedef struct res_pred_state_t 90 { 91 /* Array of size numSpatialLayers */ 92 res_pred_layer_state_t *ps_layer_state; 93 94 res_pred_mem_store_t s_mem_store; 95 96 FT_RESIDUAL_SAMPLER *apf_residual_samplers[NUM_COMPONENTS]; 97 98 FT_GET_SAD_WITH_RES_PRED *pf_get_sad_with_residual_pred; 99 100 UWORD8 *pu1_ref_x_ptr_incr; /*!< buffer to store the reference 101 array ptr increments for 102 operand 2 of interpolation 103 */ 104 UWORD8 *pu1_ref_y_ptr_incr; /*!< buffer to store the reference 105 array ptr increments for 106 operand 2 of interpolation 107 */ 108 109 } res_pred_state_t; 110 111 /* C declarations */ 112 extern FT_RESIDUAL_SAMPLER isvce_luma_residual_sampler_2x; 113 extern FT_RESIDUAL_SAMPLER isvce_chroma_residual_sampler_2x; 114 extern FT_GET_SAD_WITH_RES_PRED isvce_get_sad_with_residual_pred; 115 116 /* SSE42 declarations */ 117 extern FT_RESIDUAL_SAMPLER isvce_luma_residual_sampler_2x_sse42; 118 extern FT_GET_SAD_WITH_RES_PRED isvce_get_sad_with_residual_pred_sse42; 119 120 /* NEON declarations */ 121 extern FT_RESIDUAL_SAMPLER isvce_luma_residual_sampler_2x_neon; 122 extern FT_GET_SAD_WITH_RES_PRED isvce_get_sad_with_residual_pred_neon; 123 124 #endif 125