├── MODULE_LICENSE_APACHE2 ├── OWNERS ├── test ├── Android.mk ├── decoder │ └── test.cfg └── decoder.mk ├── NOTICE ├── decoder ├── ihevcd_sao.h ├── ihevcd_deblk.h ├── ihevcd_decode.h ├── ihevcd_inter_pred.h ├── ihevcd_ref_list.h ├── ihevcd_parse_slice.h ├── ihevcd_ilf_padding.h ├── ihevcd_process_slice.h ├── ihevcd_get_mv.h ├── ihevcd_parse_residual.h ├── ihevcd_boundary_strength.h ├── ihevcd_intra_pred_mode_prediction.h ├── ihevcd_common_tables.c ├── ihevcd_func_types.h ├── ihevcd_iquant_itrans_recon_ctb.h ├── ihevcd_mv_pred.h ├── ihevcd_parse_slice_header.h ├── ihevcd_nal.h ├── ihevcd_common_tables.h ├── ihevcd_utils.h ├── ihevcd_job_queue.h ├── ihevcd_parse_headers.h ├── mips │ └── ihevcd_function_selector.c ├── ihevcd_itrans_recon_dc.h ├── ihevcd_profile.h ├── ihevcd_error.h ├── x86 │ └── ihevcd_function_selector.c ├── arm │ ├── ihevcd_function_selector.c │ ├── ihevcd_itrans_recon_dc_luma.s │ └── ihevcd_itrans_recon_dc_chroma.s ├── ihevcd_version.c ├── ihevcd_mv_merge.h ├── ihevcd_itrans_recon_dc.c ├── ihevcd_ittiam_logo.h ├── ihevcd_fmt_conv.h └── arm64 │ └── ihevcd_itrans_recon_dc_luma.s └── common ├── ihevc_deblk_tables.h ├── arm64 ├── ihevc_neon_macros.s ├── ihevc_deblk_chroma_horz.s └── ihevc_intra_pred_chroma_mode_18_34.s ├── ihevc_typedefs.h ├── ihevc_error.h ├── ihevc_func_types.h ├── ihevc_disp_mgr.h ├── ihevc_quant_tables.h ├── ihevc_debug.h ├── ithread.h ├── ihevc_tables_x86_intr.h ├── ihevc_deblk_tables.c ├── ihevc_common_tables.h ├── ihevc_trans.h ├── mips └── ihevc_platform_macros.h ├── ihevc_dpb_mgr.h ├── ihevc_macros.h ├── ihevc_buf_mgr.h ├── ihevc_trans_tables.h ├── arm ├── ihevc_deblk_chroma_horz.s ├── ihevc_deblk_chroma_vert.s └── ihevc_intra_pred_chroma_mode_18_34.s ├── ihevc_mem_fns.h ├── ihevc_mem_fns.c ├── ihevc_chroma_recon.h ├── ihevc_itrans.h ├── x86 ├── ihevc_mem_fns_ssse3_intr.c └── ihevc_tables_x86_intr.c ├── ihevc_disp_mgr.c ├── ithread.c └── ihevc_recon.h /MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /OWNERS: -------------------------------------------------------------------------------- 1 | marcone@google.com 2 | essick@google.com 3 | -------------------------------------------------------------------------------- /test/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | # decoder 5 | include $(LOCAL_PATH)/decoder.mk 6 | -------------------------------------------------------------------------------- /test/decoder/test.cfg: -------------------------------------------------------------------------------- 1 | --input /data/local/tmp/hevcdec/crew_720p_2mbps.265 2 | --save_output 0 3 | --num_frames -1 4 | --output /data/local/tmp/hevcdec/out.yuv 5 | --chroma_format YUV_420P 6 | --share_display_buf 0 7 | --max_wd 1920 8 | --max_ht 1080 9 | --max_level 41 10 | --num_cores 2 11 | --loopback 0 12 | --display 0 13 | --arch ARM_A9Q 14 | --soc GENERIC 15 | -------------------------------------------------------------------------------- /test/decoder.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := hevcdec 6 | LOCAL_MODULE_TAGS := optional 7 | 8 | LOCAL_CFLAGS := \ 9 | -DPROFILE_ENABLE -DARM -fPIC -DMD5_DISABLE \ 10 | -Wall -Werror 11 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/../decoder $(LOCAL_PATH)/../common $(LOCAL_PATH)/ 12 | LOCAL_SRC_FILES := decoder/main.c 13 | LOCAL_STATIC_LIBRARIES := libhevcdec 14 | 15 | include $(BUILD_EXECUTABLE) 16 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at: 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | -------------------------------------------------------------------------------- /decoder/ihevcd_sao.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_sao.h 22 | * 23 | * @brief 24 | * 25 | * 26 | * @author 27 | * Srinivas T 28 | * 29 | * @remarks 30 | * None 31 | * 32 | ******************************************************************************* 33 | */ 34 | #ifndef _IHEVCD_SAO_H_ 35 | #define _IHEVCD_SAO_H_ 36 | 37 | void ihevcd_sao_ctb(sao_ctxt_t *ps_sao_ctxt); 38 | void ihevcd_sao_shift_ctb(sao_ctxt_t *ps_sao_ctxt); 39 | 40 | #endif /*_IHEVC_SAO_H_*/ 41 | -------------------------------------------------------------------------------- /decoder/ihevcd_deblk.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_deblk.h 22 | * 23 | * @brief 24 | * 25 | * 26 | * @author 27 | * Srinivas T 28 | * 29 | * @remarks 30 | * None 31 | * 32 | ******************************************************************************* 33 | */ 34 | #ifndef _IHEVCD_DEBLK_H_ 35 | #define _IHEVCD_DEBLK_H_ 36 | 37 | void ihevcd_deblk_ctb(deblk_ctxt_t *ps_deblk, 38 | WORD32 i4_is_last_ctb_x, 39 | WORD32 i4_is_last_ctb_y); 40 | 41 | 42 | #endif /*_IHEVC_DEBLK_H_*/ 43 | -------------------------------------------------------------------------------- /decoder/ihevcd_decode.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_nal.h 22 | * 23 | * @brief 24 | * Header for main decode function 25 | * 26 | * @author 27 | * Harish 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | 37 | #ifndef _IHEVCD_DECODE_H_ 38 | #define _IHEVCD_DECODE_H_ 39 | 40 | WORD32 ihevcd_decode(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *pv_api_op); 41 | 42 | #endif /* _IHEVCD_DECODE_H_ */ 43 | -------------------------------------------------------------------------------- /decoder/ihevcd_inter_pred.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_parse_slice.h 22 | * 23 | * @brief 24 | * Processing of slice level data 25 | * 26 | * @author 27 | * Harish 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | 37 | #ifndef IHEVCD_INTER_PRED_H_ 38 | #define IHEVCD_INTER_PRED_H_ 39 | 40 | void ihevcd_inter_pred_ctb(process_ctxt_t *ps_proc); 41 | 42 | 43 | #endif /* IHEVCD_INTER_PRED_H_ */ 44 | -------------------------------------------------------------------------------- /decoder/ihevcd_ref_list.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_ref_list.h 22 | * 23 | * @brief 24 | * Contains functions definitions for reference list generation 25 | * 26 | * @author 27 | * Srinivas T 28 | * 29 | * @remarks 30 | * None 31 | * 32 | ******************************************************************************* 33 | */ 34 | #ifndef _IHEVCD_REF_LIST_H_ 35 | #define _IHEVCD_REF_LIST_H_ 36 | 37 | WORD32 ihevcd_ref_list(codec_t *ps_codec, pps_t *ps_pps, sps_t *ps_sps, slice_header_t *ps_slice_hdr); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /decoder/ihevcd_parse_slice.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_parse_slice.h 22 | * 23 | * @brief 24 | * Parsing of slice level data 25 | * 26 | * @author 27 | * Harish 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | 37 | #ifndef _IHEVCD_PARSE_SLICE_H_ 38 | #define _IHEVCD_PARSE_SLICE_H_ 39 | 40 | 41 | IHEVCD_ERROR_T ihevcd_parse_mvd(codec_t *ps_codec, mv_t *ps_mv); 42 | IHEVCD_ERROR_T ihevcd_parse_slice_data(codec_t *ps_codec); 43 | #endif /* _IHEVCD_PARSE_SLICE_H_ */ 44 | -------------------------------------------------------------------------------- /common/ihevc_deblk_tables.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_deblk_tables.h 22 | * 23 | * @brief 24 | * Tables for forward and inverse transform 25 | * 26 | * @author 27 | * Srinivas T 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | #ifndef _IHEVC_DEBLK_TABLES_H_ 37 | #define _IHEVC_DEBLK_TABLES_H_ 38 | 39 | extern const WORD32 gai4_ihevc_beta_table[52]; 40 | 41 | extern const WORD32 gai4_ihevc_tc_table[54]; 42 | 43 | extern const WORD32 gai4_ihevc_qp_table[58]; 44 | 45 | #endif /*_IHEVC_DEBLK_TABLES_H_*/ 46 | -------------------------------------------------------------------------------- /decoder/ihevcd_ilf_padding.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_ilf_padding_frame.h 22 | * 23 | * @brief 24 | * Does frame level loop filtering (deblocking and SAO) and padding 25 | * 26 | * @author 27 | * Srinivas T 28 | * 29 | * @par List of Functions: 30 | * - ihevc_ilf_pad_frame() 31 | * 32 | * @remarks 33 | * None 34 | * 35 | ******************************************************************************* 36 | */ 37 | 38 | #ifndef IHEVCD_ILF_PADDING_H_ 39 | #define IHEVCD_ILF_PADDING_H_ 40 | 41 | void ihevcd_ilf_pad_frame(deblk_ctxt_t *ps_deblk_ctxt, sao_ctxt_t *ps_sao_ctxt); 42 | 43 | 44 | #endif /* IHEVCD_ILF_PADDING_H_ */ 45 | 46 | -------------------------------------------------------------------------------- /decoder/ihevcd_process_slice.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_parse_slice.h 22 | * 23 | * @brief 24 | * Processing of slice level data 25 | * 26 | * @author 27 | * Harish 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | 37 | #ifndef _IHEVCD_PROCESS_SLICE_H_ 38 | #define _IHEVCD_PROCESS_SLICE_H_ 39 | 40 | IHEVCD_ERROR_T ihevcd_process(process_ctxt_t *ps_proc); 41 | void ihevcd_init_proc_ctxt(process_ctxt_t *ps_proc, WORD32 tu_coeff_data_ofst); 42 | void ihevcd_process_thread(process_ctxt_t *ps_proc); 43 | 44 | #endif /* _IHEVCD_PROCESS_SLICE_H_ */ 45 | -------------------------------------------------------------------------------- /decoder/ihevcd_get_mv.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_parse_slice.h 22 | * 23 | * @brief 24 | * Processing of slice level data 25 | * 26 | * @author 27 | * Harish 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | 37 | #ifndef IHEVCD_GET_MV_H_ 38 | #define IHEVCD_GET_MV_H_ 39 | 40 | WORD32 ihevcd_get_mv_ctb(mv_ctxt_t *ps_mv_ctxt, 41 | UWORD32 *pu4_ctb_top_pu_idx, 42 | UWORD32 *pu4_ctb_left_pu_idx, 43 | UWORD32 *pu4_ctb_top_left_pu_idx); 44 | 45 | 46 | #endif /* IHEVCD_GET_MV_H_ */ 47 | -------------------------------------------------------------------------------- /decoder/ihevcd_parse_residual.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_parse_residual.h 22 | * 23 | * @brief 24 | * Parsing of residual data 25 | * 26 | * @author 27 | * Harish 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | 37 | #ifndef _IHEVCD_PARSE_RESIDUAL_H_ 38 | #define _IHEVCD_PARSE_RESIDUAL_H_ 39 | WORD32 ihevcd_parse_residual_coding(codec_t *ps_codec, 40 | WORD32 x0, WORD32 y0, 41 | WORD32 log2_trafo_size, 42 | WORD32 c_idx, 43 | WORD32 intra_pred_mode); 44 | 45 | #endif /* _IHEVCD_PARSE_RESIDUAL_H_ */ 46 | -------------------------------------------------------------------------------- /decoder/ihevcd_boundary_strength.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_bitps_bitstrm.h 22 | * 23 | * @brief 24 | * Header for bitps_bitstrm access functions 25 | * 26 | * @author 27 | * Harish 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | 37 | #ifndef IHEVCD_BOUNDARY_STRENGTH_H_ 38 | #define IHEVCD_BOUNDARY_STRENGTH_H_ 39 | 40 | WORD32 ihevcd_ctb_boundary_strength_islice(bs_ctxt_t *ps_bs_ctxt); 41 | 42 | WORD32 ihevcd_ctb_boundary_strength_pbslice(bs_ctxt_t *ps_bs_ctxt); 43 | 44 | WORD32 ihevcd_pu_boundary_strength(pu_t *ps_pu, 45 | pu_t *ps_ngbr_pu); 46 | 47 | 48 | 49 | #endif /* IHEVCD_BOUNDARY_STRENGTH_H_ */ 50 | -------------------------------------------------------------------------------- /common/arm64/ihevc_neon_macros.s: -------------------------------------------------------------------------------- 1 | ///***************************************************************************** 2 | //* 3 | //* Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | ///** 19 | //******************************************************************************* 20 | //* @file 21 | //* ihevc_neon_macros.s 22 | //* 23 | //* @brief 24 | //* Contains assembly macros 25 | //* 26 | //* @author 27 | //* Naveen SR 28 | //* 29 | //* @par List of Functions: 30 | //* 31 | //* 32 | //* @remarks 33 | //* None 34 | //* 35 | //******************************************************************************* 36 | 37 | 38 | .macro push_v_regs 39 | stp d8,d9,[sp,#-16]! 40 | stp d10,d11,[sp,#-16]! 41 | stp d12,d13,[sp,#-16]! 42 | stp d14,d15,[sp,#-16]! 43 | .endm 44 | .macro pop_v_regs 45 | ldp d14,d15,[sp],#16 46 | ldp d12,d13,[sp],#16 47 | ldp d10,d11,[sp],#16 48 | ldp d8,d9,[sp],#16 49 | .endm 50 | -------------------------------------------------------------------------------- /decoder/ihevcd_intra_pred_mode_prediction.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_intra_pred_mode_prediction.h 22 | * 23 | * @brief 24 | * Contains functions for intra pred mode prediction 25 | * 26 | * @author 27 | * Ittiam 28 | * 29 | * @par List of Functions: 30 | * - ihevcd_intra_pred_mode_prediction() 31 | * 32 | * @remarks 33 | * None 34 | * 35 | ******************************************************************************* 36 | */ 37 | 38 | #ifndef _IHEVCD_INTRA_PRED_MODE_PREDICTION_H_ 39 | #define _IHEVCD_INTRA_PRED_MODE_PREDICTION_H_ 40 | void ihevcd_intra_pred_mode_prediction(codec_t *ps_codec, 41 | WORD32 log2_cb_size, 42 | WORD32 x0, 43 | WORD32 y0); 44 | 45 | #endif /* _IHEVCD_INTRA_PRED_MODE_PREDICTION_H_ */ 46 | -------------------------------------------------------------------------------- /decoder/ihevcd_common_tables.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_common_tables.c 22 | * 23 | * @brief 24 | * Contains common global tables for decoder 25 | * 26 | * @author 27 | * Naveen S R 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | 37 | #include "ihevc_typedefs.h" 38 | #include "ihevcd_common_tables.h" 39 | #include "ihevc_defs.h" 40 | 41 | const WORD16 gai2_ihevcd_chroma_qp[] = 42 | { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 43 | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 29, 44 | 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 45 | 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 }; 46 | 47 | const UWORD8 gau1_intra_pred_chroma_modes[] = 48 | { INTRA_PLANAR, INTRA_ANGULAR(26), INTRA_ANGULAR(10), INTRA_DC }; 49 | 50 | -------------------------------------------------------------------------------- /common/ihevc_typedefs.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * typedefs.h 22 | * 23 | * @brief 24 | * Type definitions used in the code 25 | * 26 | * @author 27 | * Srinivas T 28 | * 29 | * @remarks 30 | * None 31 | * 32 | ******************************************************************************* 33 | */ 34 | 35 | #ifndef _IHEVC_TYPEDEFS_H_ 36 | #define _IHEVC_TYPEDEFS_H_ 37 | 38 | 39 | typedef unsigned char UWORD8; 40 | typedef unsigned short UWORD16; 41 | typedef unsigned int UWORD32; 42 | 43 | typedef signed char WORD8; 44 | typedef signed short WORD16; 45 | typedef signed int WORD32; 46 | 47 | typedef char CHAR; 48 | 49 | typedef double DOUBLE; 50 | 51 | typedef char STRWORD8; 52 | 53 | 54 | 55 | #ifndef MSVC 56 | 57 | typedef unsigned long long ULWORD64; 58 | typedef signed long long LWORD64; 59 | 60 | #else 61 | typedef unsigned __int64 ULWORD64; 62 | typedef __int64 LWORD64; 63 | 64 | 65 | #endif 66 | #endif /* _IHEVC_TYPEDEFS_H_ */ 67 | -------------------------------------------------------------------------------- /common/ihevc_error.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_error.h 22 | * 23 | * @brief 24 | * Definitions related to error handling for common modules 25 | * 26 | * @author 27 | * Harish 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | 37 | #ifndef _IHEVC_ERROR_H_ 38 | #define _IHEVC_ERROR_H_ 39 | 40 | /** 41 | * Enumerations for error codes used in the codec. 42 | * Not all these are expected to be returned to the application. 43 | * Only select few will be exported 44 | */ 45 | typedef enum 46 | { 47 | /** 48 | * No error 49 | */ 50 | IHEVC_SUCCESS = 0, 51 | /** 52 | * Start error code for decoder 53 | */ 54 | IHEVC_DEC_ERROR_START = 0x100, 55 | 56 | /** 57 | * Start error code for encoder 58 | */ 59 | IHEVC_ENC_ERROR_START = 0x200, 60 | /** 61 | * Generic failure 62 | */ 63 | IHEVC_FAIL = 0x7FFFFFFF 64 | }IHEVC_ERROR_T; 65 | #endif /* _IHEVC_ERROR_H_ */ 66 | -------------------------------------------------------------------------------- /common/ihevc_func_types.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_func_types.h 22 | * 23 | * @brief 24 | * Defines different types of function implementations Eg C, Cortex A8 25 | * Intrinsics, Neon assembly etc 26 | * 27 | * @author 28 | * Harish 29 | * 30 | * @par List of Functions: 31 | * 32 | * @remarks 33 | * None 34 | * 35 | ******************************************************************************* 36 | */ 37 | #ifndef _IHEVC_FUNC_TYPES_H_ 38 | #define _IHEVC_FUNC_TYPES_H_ 39 | 40 | 41 | /* C Model : No platform specific intrinsics or inline assemblies */ 42 | #define C 0 43 | 44 | /* Cortex Ax intrinsics */ 45 | #define CXAINTR 10 46 | 47 | /* Neon intrinsics */ 48 | #define NEONINTR 11 49 | 50 | /* X86 intrinsics */ 51 | #define X86INTR 12 52 | 53 | /* X64 intrinsics */ 54 | #define X64INTR 13 55 | 56 | /* Atom intrinsics */ 57 | #define ATOMINTR 14 58 | 59 | /* Cortex Ax assembly */ 60 | #define CXAASM 20 61 | 62 | /* Neon assembly */ 63 | #define NEONASM 21 64 | 65 | /* X86 assembly */ 66 | #define X86ASM 22 67 | 68 | 69 | #endif /* _IHEVC_FUNC_TYPES_H_ */ 70 | -------------------------------------------------------------------------------- /decoder/ihevcd_func_types.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_func_types.h 22 | * 23 | * @brief 24 | * Defines different types of function implementations Eg C, Cortex A8 25 | * Intrinsics, Neon assembly etc 26 | * 27 | * @author 28 | * Harish 29 | * 30 | * @par List of Functions: 31 | * 32 | * @remarks 33 | * None 34 | * 35 | ******************************************************************************* 36 | */ 37 | #ifndef _ihevcd_func_types_H_ 38 | #define _ihevcd_func_types_H_ 39 | 40 | 41 | /* C Model : No platform specific intrinsics or inline assemblies */ 42 | #define C 0 43 | 44 | /* Cortex Ax intrinsics */ 45 | #define CXAINTR 10 46 | 47 | /* Neon intrinsics */ 48 | #define NEONINTR 11 49 | 50 | /* X86 intrinsics */ 51 | #define X86INTR 12 52 | 53 | /* X64 intrinsics */ 54 | #define X64INTR 13 55 | 56 | /* Atom intrinsics */ 57 | #define ATOMINTR 14 58 | 59 | /* Cortex Ax assembly */ 60 | #define CXAASM 20 61 | 62 | /* Neon assembly */ 63 | #define NEONASM 21 64 | 65 | /* X86 assembly */ 66 | #define X86ASM 22 67 | 68 | 69 | #endif /* _ihevcd_func_types_H_ */ 70 | -------------------------------------------------------------------------------- /decoder/ihevcd_iquant_itrans_recon_ctb.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_iquant_itrans_recon_ctb.h 22 | * 23 | * @brief 24 | * Definitions related to inverse transform functions 25 | * 26 | * @author 27 | * Naveen S R 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | 37 | #ifndef _IHEVCD_IQUANT_ITRANS_RECON_CTB_H_ 38 | #define _IHEVCD_IQUANT_ITRANS_RECON_CTB_H_ 39 | 40 | #define MAX_NUM_IP_MODES 35 41 | 42 | typedef enum 43 | { 44 | IP_FUNC_MODE_0 = 1, 45 | IP_FUNC_MODE_1, 46 | IP_FUNC_MODE_2, 47 | IP_FUNC_MODE_3TO9, 48 | IP_FUNC_MODE_10, 49 | IP_FUNC_MODE_11TO17, 50 | IP_FUNC_MODE_18_34, 51 | IP_FUNC_MODE_19TO25, 52 | IP_FUNC_MODE_26, 53 | IP_FUNC_MODE_27TO33, 54 | 55 | NUM_IP_FUNCS 56 | 57 | }IP_FUNCS_T; 58 | 59 | 60 | typedef enum 61 | { 62 | DST_4x4, DCT_4x4, DCT_8x8, DCT_16x16, DCT_32x32, SKIP_64x64 63 | }TRANSFORM_TYPE; 64 | 65 | WORD32 ihevcd_iquant_itrans_recon_ctb(process_ctxt_t *ps_proc); 66 | 67 | #endif /* _IHEVCD_IQUANT_ITRANS_RECON_CTB_H_ */ 68 | -------------------------------------------------------------------------------- /decoder/ihevcd_mv_pred.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | 19 | /** 20 | ******************************************************************************* 21 | * @file 22 | * ihevcd_structs.h 23 | * 24 | * @brief 25 | * Structure definitions used in the decoder 26 | * 27 | * @author 28 | * Harish 29 | * 30 | * @par List of Functions: 31 | * 32 | * @remarks 33 | * None 34 | * 35 | ******************************************************************************* 36 | */ 37 | 38 | #ifndef IHEVCD_MV_PRED_H_ 39 | #define IHEVCD_MV_PRED_H_ 40 | void ihevcd_mv_pred(mv_ctxt_t *ps_mv_ctxt, 41 | UWORD32 *pu4_top_pu_idx, 42 | UWORD32 *pu4_left_pu_idx, 43 | UWORD32 *pu4_top_left_pu_idx, 44 | WORD32 left_nbr_4x4_strd, 45 | pu_t *ps_pu, 46 | WORD32 lb_avail, 47 | WORD32 l_avail, 48 | WORD32 tr_avail, 49 | WORD32 t_avail, 50 | WORD32 tl_avail, 51 | pu_mv_t *ps_pred_mv); 52 | void ihevcd_scale_mv(mv_t *ps_mv, 53 | WORD32 cur_ref_poc, 54 | WORD32 nbr_ref_poc, 55 | WORD32 cur_poc); 56 | 57 | 58 | #endif /* IHEVCD_MV_PRED_H_ */ 59 | -------------------------------------------------------------------------------- /decoder/ihevcd_parse_slice_header.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_parse_slice_header.h 22 | * 23 | * @brief 24 | * Parsing of slice header 25 | * 26 | * @author 27 | * Ittiam 28 | * 29 | * @remarks 30 | * None 31 | * 32 | ******************************************************************************* 33 | */ 34 | 35 | #ifndef _IHEVCD_PARSE_SLICE_HEADER_H_ 36 | #define _IHEVCD_PARSE_SLICE_HEADER_H_ 37 | 38 | IHEVCD_ERROR_T ihevcd_short_term_ref_pic_set(bitstrm_t *ps_bitstrm, 39 | stref_picset_t *ps_stref_picset_base, 40 | WORD32 num_short_term_ref_pic_sets, 41 | WORD32 idx, 42 | stref_picset_t *ps_stref_picset); 43 | 44 | WORD32 ihevcd_parse_pred_wt_ofst(bitstrm_t *ps_bitstrm, 45 | sps_t *ps_sps, 46 | pps_t *ps_pps, 47 | slice_header_t *ps_slice_hdr); 48 | 49 | WORD32 ihevcd_calc_poc(codec_t *ps_codec, nal_header_t *ps_nal, WORD8 i1_log2_max_poc_lsb, WORD32 i2_poc_lsb); 50 | 51 | 52 | 53 | #endif /* _IHEVCD_PARSE_SLICE_HEADER_H_ */ 54 | -------------------------------------------------------------------------------- /common/ihevc_disp_mgr.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_disp_mgr.h 22 | * 23 | * @brief 24 | * Function declarations used for display management 25 | * 26 | * @author 27 | * Srinivas T 28 | * 29 | * 30 | * @remarks 31 | * None 32 | * 33 | ******************************************************************************* 34 | */ 35 | #ifndef _DISP_MGR_H_ 36 | #define _DISP_MGR_H_ 37 | 38 | #define DISP_MGR_MAX_CNT 64 39 | #define DEFAULT_POC 0x7FFFFFFF 40 | 41 | typedef struct 42 | { 43 | /** 44 | * last_abs_poc 45 | */ 46 | UWORD32 u4_last_abs_poc; 47 | 48 | /** 49 | * au4_abs_poc[DISP_MGR_MAX_CNT] 50 | */ 51 | WORD32 ai4_abs_poc[DISP_MGR_MAX_CNT]; 52 | 53 | /** 54 | * apv_ptr[DISP_MGR_MAX_CNT] 55 | */ 56 | void *apv_ptr[DISP_MGR_MAX_CNT]; 57 | }disp_mgr_t; 58 | 59 | void ihevc_disp_mgr_init( 60 | disp_mgr_t *ps_disp_mgr); 61 | 62 | WORD32 ihevc_disp_mgr_add( 63 | disp_mgr_t *ps_disp_mgr, 64 | WORD32 id, 65 | WORD32 abs_poc, 66 | void *pv_ptr); 67 | 68 | void* ihevc_disp_mgr_get(disp_mgr_t *ps_disp_mgr, 69 | WORD32 *pi4_buf_id); 70 | 71 | #endif //_DISP_MGR_H_ 72 | -------------------------------------------------------------------------------- /common/ihevc_quant_tables.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_quant_tables.h 22 | * 23 | * @brief 24 | * Tables for forward and inverse quantization 25 | * 26 | * @author 27 | * Ittiam 28 | * 29 | * @remarks 30 | * None 31 | * 32 | ******************************************************************************* 33 | */ 34 | #ifndef _IHEVC_QUANT_TABLES_H_ 35 | #define _IHEVC_QUANT_TABLES_H_ 36 | 37 | extern const WORD16 gi2_flat_scale_mat_32x32[]; 38 | 39 | extern const WORD16 gi2_intra_default_scale_mat_8x8[]; 40 | 41 | extern const WORD16 gi2_inter_default_scale_mat_8x8[]; 42 | 43 | extern const WORD16 gi2_intra_default_scale_mat_16x16[]; 44 | 45 | extern const WORD16 gi2_inter_default_scale_mat_16x16[]; 46 | 47 | extern const WORD16 gi2_intra_default_scale_mat_32x32[]; 48 | 49 | extern const WORD16 gi2_inter_default_scale_mat_32x32[]; 50 | 51 | 52 | extern const WORD16 gi2_flat_rescale_mat_32x32[]; 53 | 54 | extern const WORD16 gi2_intra_default_rescale_mat_8x8[]; 55 | 56 | extern const WORD16 gi2_inter_default_rescale_mat_8x8[]; 57 | 58 | extern const WORD16 gi2_intra_default_rescale_mat_16x16[]; 59 | 60 | extern const WORD16 gi2_inter_default_rescale_mat_16x16[]; 61 | 62 | extern const WORD16 gi2_intra_default_rescale_mat_32x32[]; 63 | 64 | extern const WORD16 gi2_inter_default_rescale_mat_32x32[]; 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /decoder/ihevcd_nal.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_nal.h 22 | * 23 | * @brief 24 | * Header for NAL related function 25 | * 26 | * @author 27 | * Harish 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | 37 | #ifndef _IHEVCD_NAL_H_ 38 | #define _IHEVCD_NAL_H_ 39 | /** 40 | * Minimum size of start code including NAL type 41 | */ 42 | 43 | #define MIN_START_CODE_LEN 4 44 | /** 45 | * Start code prefix byte - 1 46 | */ 47 | #define START_CODE_PREFIX_BYTE 1 48 | 49 | /** 50 | * Emulation prevention byte - 3 51 | */ 52 | 53 | #define EMULATION_PREVENT_BYTE 3 54 | /** 55 | * Minimum number of zeros before start code 56 | */ 57 | #define NUM_ZEROS_BEFORE_START_CODE 2 58 | 59 | 60 | WORD32 ihevcd_nal_search_start_code(UWORD8 *pu1_buf, WORD32 bytes_remaining); 61 | 62 | IHEVCD_ERROR_T ihevcd_nal_remv_emuln_bytes(UWORD8 *pu1_src, 63 | UWORD8 *pu1_dst, 64 | WORD32 bytes_remaining, 65 | WORD32 *pi4_nal_len, 66 | WORD32 *pi4_dst_len); 67 | 68 | IHEVCD_ERROR_T ihevcd_nal_unit(codec_t *ps_codec); 69 | #endif /* _IHEVCD_NAL_H_ */ 70 | -------------------------------------------------------------------------------- /common/ihevc_debug.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_debug.h 22 | * 23 | * @brief 24 | * Definitions for codec debugging 25 | * 26 | * @author 27 | * Ittiam 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | #ifndef _IHEVC_DEBUG_H_ 37 | #define _IHEVC_DEBUG_H_ 38 | 39 | #ifdef DEBUG_PRINT 40 | 41 | #define DEBUG(...) \ 42 | { \ 43 | printf("\n[HEVC DBG] %s/%d:: ", __FUNCTION__, __LINE__); \ 44 | printf(__VA_ARGS__); \ 45 | } 46 | 47 | #else //DEBUG_CODEC 48 | 49 | #define DEBUG(...) {} 50 | 51 | #endif //DEBUG_CODEC 52 | 53 | #ifndef ASSERT_EXIT 54 | 55 | #define ASSERT(x) assert((x)) 56 | //#define ASSERT(x) ihevcd_debug_ASSERT((x)) 57 | 58 | #else 59 | #define ASSERT(x) \ 60 | { \ 61 | if (!(x)) \ 62 | { \ 63 | printf("ASSERT %s %d\n", __FILE__, __LINE__); \ 64 | exit(-1); \ 65 | } \ 66 | } 67 | #endif 68 | 69 | #endif /* _IHEVC_DEBUG_H_ */ 70 | 71 | -------------------------------------------------------------------------------- /decoder/ihevcd_common_tables.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /*****************************************************************************/ 19 | /* */ 20 | /* File Name : ihevcd_common_tables.h */ 21 | /* */ 22 | /* Description : Common tables */ 23 | /* */ 24 | /* List of Functions : None */ 25 | /* */ 26 | /* Issues / Problems : None */ 27 | /* */ 28 | /* Revision History : */ 29 | /* */ 30 | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ 31 | /* 07 09 2012 Harish Initial Version */ 32 | /*****************************************************************************/ 33 | 34 | #ifndef _IHEVCD_COMMON_TABLES_H_ 35 | #define _IHEVCD_COMMON_TABLES_H_ 36 | 37 | extern const WORD16 gai2_ihevcd_chroma_qp[]; 38 | 39 | extern const UWORD8 gau1_intra_pred_chroma_modes[]; 40 | 41 | 42 | #endif /*_IHEVCD_COMMON_TABLES_H_*/ 43 | -------------------------------------------------------------------------------- /decoder/ihevcd_utils.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_parse_slice.h 22 | * 23 | * @brief 24 | * Contains miscellaneous utility functions such as init() etc 25 | * 26 | * @author 27 | * Harish 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | 37 | #ifndef _IHEVCD_UTILS_H_ 38 | #define _IHEVCD_UTILS_H_ 39 | 40 | WORD32 ihevcd_get_lvl_idx(WORD32 level); 41 | WORD32 ihevcd_get_dpb_size(WORD32 level, WORD32 pic_size); 42 | WORD32 ihevcd_get_pic_mv_bank_size(WORD32 num_luma_samples); 43 | WORD32 ihevcd_get_tu_data_size(WORD32 num_luma_samples); 44 | WORD32 ihevcd_nctb_cnt(codec_t *ps_codec, sps_t *ps_sps); 45 | WORD32 ihevcd_get_max_luma_samples(WORD32 level); 46 | IHEVCD_ERROR_T ihevcd_get_tile_pos(pps_t *ps_pps, 47 | sps_t *ps_sps, 48 | WORD32 ctb_x, 49 | WORD32 ctb_y, 50 | WORD32 *pi4_ctb_tile_x, 51 | WORD32 *pi4_ctb_tile_y, 52 | WORD32 *pi4_tile_idx); 53 | IHEVCD_ERROR_T ihevcd_parse_pic_init(codec_t *ps_codec); 54 | WORD32 ihevcd_get_total_pic_buf_size(codec_t *ps_codec, 55 | WORD32 wd, 56 | WORD32 ht); 57 | #endif /* _IHEVCD_UTILS_H_ */ 58 | -------------------------------------------------------------------------------- /decoder/ihevcd_job_queue.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_job_queue.h 22 | * 23 | * @brief 24 | * Contains functions for job queue 25 | * 26 | * @author 27 | * Harish 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | 37 | #ifndef _IHEVCD_JOB_QUEUE_H_ 38 | #define _IHEVCD_JOB_QUEUE_H_ 39 | 40 | typedef struct 41 | { 42 | /** Pointer to buffer base which contains the jobs */ 43 | void *pv_buf_base; 44 | 45 | /** Pointer to current address where new job can be added */ 46 | void *pv_buf_wr; 47 | 48 | /** Pointer to current address from where next job can be obtained */ 49 | void *pv_buf_rd; 50 | 51 | /** Pointer to end of job buffer */ 52 | void *pv_buf_end; 53 | 54 | /** Mutex used to keep the functions thread-safe */ 55 | void *pv_mutex; 56 | 57 | /** Flag to indicate jobq has to be terminated */ 58 | WORD32 i4_terminate; 59 | }jobq_t; 60 | 61 | WORD32 ihevcd_jobq_ctxt_size(void); 62 | void* ihevcd_jobq_init(void *pv_buf, WORD32 buf_size); 63 | IHEVCD_ERROR_T ihevcd_jobq_free(jobq_t *ps_jobq); 64 | IHEVCD_ERROR_T ihevcd_jobq_reset(jobq_t *ps_jobq); 65 | IHEVCD_ERROR_T ihevcd_jobq_deinit(jobq_t *ps_jobq); 66 | IHEVCD_ERROR_T ihevcd_jobq_terminate(jobq_t *ps_jobq); 67 | IHEVCD_ERROR_T ihevcd_jobq_queue(jobq_t *ps_jobq, void *pv_job, WORD32 job_size, WORD32 blocking); 68 | IHEVCD_ERROR_T ihevcd_jobq_dequeue(jobq_t *ps_jobq, void *pv_job, WORD32 job_size, WORD32 blocking); 69 | 70 | #endif /* _IHEVCD_PROCESS_SLICE_H_ */ 71 | -------------------------------------------------------------------------------- /common/ithread.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ithread.h 22 | * 23 | * @brief 24 | * This file contains all the necessary structure and enumeration 25 | * definitions needed for the Application Program Interface(API) of the 26 | * Thread Abstraction Layer 27 | * 28 | * @author 29 | * Harish 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | #ifndef __ITHREAD_H__ 37 | #define __ITHREAD_H__ 38 | 39 | UWORD32 ithread_get_handle_size(void); 40 | 41 | UWORD32 ithread_get_mutex_lock_size(void); 42 | 43 | WORD32 ithread_create(void *thread_handle, void *attribute, void *strt, void *argument); 44 | 45 | void ithread_exit(void *val_ptr); 46 | 47 | WORD32 ithread_join(void *thread_id, void **val_ptr); 48 | 49 | WORD32 ithread_get_mutex_struct_size(void); 50 | 51 | WORD32 ithread_mutex_init(void *mutex); 52 | 53 | WORD32 ithread_mutex_destroy(void *mutex); 54 | 55 | WORD32 ithread_mutex_lock(void *mutex); 56 | 57 | WORD32 ithread_mutex_unlock(void *mutex); 58 | 59 | void ithread_yield(void); 60 | 61 | void ithread_sleep(UWORD32 u4_time); 62 | 63 | void ithread_msleep(UWORD32 u4_time_ms); 64 | 65 | void ithread_usleep(UWORD32 u4_time_us); 66 | 67 | UWORD32 ithread_get_sem_struct_size(void); 68 | 69 | WORD32 ithread_sem_init(void *sem, WORD32 pshared, UWORD32 value); 70 | 71 | WORD32 ithread_sem_post(void *sem); 72 | 73 | WORD32 ithread_sem_wait(void *sem); 74 | 75 | WORD32 ithread_sem_destroy(void *sem); 76 | 77 | WORD32 ithread_set_affinity(WORD32 core_id); 78 | #endif /* __ITHREAD_H__ */ 79 | -------------------------------------------------------------------------------- /decoder/ihevcd_parse_headers.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_parse_headers.h 22 | * 23 | * @brief 24 | * Parsing of various headers like VPS, SPS, PPS etc 25 | * 26 | * @author 27 | * Ittiam 28 | * 29 | * @remarks 30 | * None 31 | * 32 | ******************************************************************************* 33 | */ 34 | 35 | #ifndef _IHEVCD_PARSE_HEADERS_H_ 36 | #define _IHEVCD_PARSE_HEADERS_H_ 37 | 38 | void ihevcd_copy_sps(codec_t *ps_codec, WORD32 sps_id, WORD32 sps_id_ref); 39 | void ihevcd_copy_pps(codec_t *ps_codec, WORD32 pps_id, WORD32 pps_id_ref); 40 | void ihevcd_copy_slice_hdr(codec_t *ps_codec, WORD32 slice_idx, WORD32 slice_idx_ref); 41 | 42 | IHEVCD_ERROR_T ihevcd_parse_vps(codec_t *ps_codec); 43 | IHEVCD_ERROR_T ihevcd_parse_sps(codec_t *ps_codec); 44 | IHEVCD_ERROR_T ihevcd_parse_pps(codec_t *ps_codec); 45 | IHEVCD_ERROR_T ihevcd_parse_sei(codec_t *ps_codec, nal_header_t *ps_nal); 46 | IHEVCD_ERROR_T ihevcd_parse_pic_timing_sei(codec_t *ps_codec, sps_t *ps_sps); 47 | IHEVCD_ERROR_T ihevcd_parse_buffering_period_sei(codec_t *ps_codec, sps_t *ps_sps); 48 | IHEVCD_ERROR_T ihevcd_parse_time_code_sei(codec_t *ps_codec); 49 | IHEVCD_ERROR_T ihevcd_parse_user_data_registered_itu_t_t35(codec_t *ps_codec, UWORD32 u4_payload_size); 50 | IHEVCD_ERROR_T ihevcd_parse_active_parameter_sets_sei(codec_t *ps_codec, sps_t *ps_sps); 51 | IHEVCD_ERROR_T ihevcd_read_rbsp_trailing_bits(codec_t *ps_codec, UWORD32 u4_bits_left); 52 | IHEVCD_ERROR_T ihevcd_parse_slice_header(codec_t *ps_codec, 53 | nal_header_t *ps_nal); 54 | 55 | #endif /* _IHEVCD_PARSE_HEADERS_H_ */ 56 | -------------------------------------------------------------------------------- /common/ihevc_tables_x86_intr.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_tables_x86_intr.h 22 | * 23 | * @brief 24 | * Declarations for the fucntions defined in ihevc_intra_pred_filters 25 | * 26 | * @author 27 | * Mamatha 28 | * 29 | * 30 | * @remarks 31 | * None 32 | * 33 | ******************************************************************************* 34 | */ 35 | 36 | #ifndef IHEVC_TABLES_X86_INTR_H_ 37 | #define IHEVC_TABLES_X86_INTR_H_ 38 | 39 | 40 | //Luma intra pred 41 | extern MEM_ALIGN16 const UWORD8 IHEVCE_SHUFFLEMASKY1[16]; 42 | extern MEM_ALIGN16 const UWORD8 IHEVCE_SHUFFLEMASKY2[16]; 43 | extern MEM_ALIGN16 const UWORD8 IHEVCE_SHUFFLEMASKY3[16]; 44 | extern MEM_ALIGN16 const UWORD8 IHEVCE_SHUFFLEMASK4[16]; 45 | extern MEM_ALIGN16 const UWORD8 IHEVCE_SHUFFLEMASK5[16]; 46 | //Chroma intra pred 47 | extern MEM_ALIGN16 const UWORD8 IHEVCE_SHUFFLEMASKY7[16]; 48 | 49 | extern MEM_ALIGN16 const UWORD8 IHEVCE_SHUFFLEMASKY8[16]; 50 | 51 | extern MEM_ALIGN16 const UWORD8 IHEVCE_SHUFFLEMASKY9[16]; 52 | 53 | extern MEM_ALIGN16 const UWORD8 IHEVCE_SHUFFLEMASKY11[16]; 54 | 55 | extern MEM_ALIGN16 const UWORD8 inv_angle_shuffle[7][32]; 56 | // DEBLOCK TABLES 57 | extern MEM_ALIGN16 const WORD8 coef_d[16]; 58 | extern MEM_ALIGN16 const WORD8 coef_de1[16]; 59 | extern MEM_ALIGN16 const WORD8 coef_dep1[16]; 60 | extern MEM_ALIGN16 const WORD32 shuffle_d[4]; 61 | extern const WORD32 shuffle0[2]; 62 | extern MEM_ALIGN16 const WORD32 shuffle1[4]; 63 | extern MEM_ALIGN16 const WORD32 shuffle2[4]; 64 | extern MEM_ALIGN16 const WORD32 shuffle3[4]; 65 | 66 | extern MEM_ALIGN16 const WORD8 delta0[16]; 67 | extern MEM_ALIGN16 const WORD8 delta1[16]; 68 | extern MEM_ALIGN16 const WORD32 shuffle_uv[4]; 69 | 70 | #endif /*IHEVC_TABLES_X86_INTR_H_*/ 71 | -------------------------------------------------------------------------------- /common/ihevc_deblk_tables.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_deblk_tables.c 22 | * 23 | * @brief 24 | * Contains tables used for deblock filters 25 | * 26 | * @author 27 | * Srinivas T 28 | * 29 | * @par List of Tables: 30 | * gai4_ihevc_beta_table 31 | * gai4_ihevc_tc_table 32 | * gai4_ihevc_qp_table 33 | * 34 | * @remarks 35 | * None 36 | * 37 | ******************************************************************************* 38 | */ 39 | #include "ihevc_typedefs.h" 40 | #include "ihevc_deblk_tables.h" 41 | 42 | /** 43 | * Beta table for deblocking 44 | * Table 8-10 - Derivation of threshold variables beta and tc from input Q 45 | */ 46 | const WORD32 gai4_ihevc_beta_table[52] = 47 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48 | 0, 0, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 49 | 16, 17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 50 | 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64 51 | }; 52 | 53 | 54 | /** 55 | * Tc table for deblocking 56 | * Table 8-10 - Derivation of threshold variables beta and tc from input Q 57 | */ 58 | const WORD32 gai4_ihevc_tc_table[54] = 59 | { 60 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 61 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 62 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 63 | 2, 2, 2, 2, 3, 3, 3, 3, 4, 64 | 4, 4, 5, 5, 6, 6, 7, 8, 9, 65 | 10, 11, 13, 14, 16, 18, 20, 22, 24 66 | }; 67 | 68 | /** 69 | * QP table for deblocking 70 | * Table 8-9 Specification of QPC as a function of qPi 71 | */ 72 | const WORD32 gai4_ihevc_qp_table[58] = 73 | { 74 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 75 | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 29, 30, 31, 32, 76 | 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 77 | 45, 46, 47, 48, 49, 50, 51 78 | }; 79 | -------------------------------------------------------------------------------- /common/ihevc_common_tables.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_common_tables.h 22 | * 23 | * @brief 24 | * Common tables 25 | * 26 | * @author 27 | * Harish 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | 37 | #ifndef _IHEVC_COMMON_TABLES_H_ 38 | #define _IHEVC_COMMON_TABLES_H_ 39 | 40 | extern MEM_ALIGN16 const WORD32 gai4_ihevc_max_luma_pic_size[]; 41 | extern MEM_ALIGN16 const WORD32 gai4_ihevc_max_wd_ht[]; 42 | extern MEM_ALIGN16 const WORD32 gai4_ihevc_min_wd_ht[]; 43 | 44 | 45 | extern MEM_ALIGN16 const WORD32 gai4_ihevc_ang_table[35]; 46 | extern MEM_ALIGN16 const WORD32 gai4_ihevc_inv_ang_table[14]; 47 | 48 | extern MEM_ALIGN16 const UWORD8 gau1_ihevc_scan8x8[][64]; 49 | extern MEM_ALIGN16 const UWORD8 gau1_ihevc_scan4x4[][16]; 50 | extern MEM_ALIGN16 const UWORD8 gau1_ihevc_scan2x2[][4]; 51 | 52 | extern MEM_ALIGN16 const UWORD8 gau1_ihevc_invscan8x8[][64]; 53 | extern MEM_ALIGN16 const UWORD8 gau1_ihevc_invscan4x4[][16]; 54 | extern MEM_ALIGN16 const UWORD8 gau1_ihevc_invscan2x2[][4]; 55 | 56 | extern MEM_ALIGN16 const void *gapv_ihevc_scan[]; 57 | extern MEM_ALIGN16 const void *gapv_ihevc_invscan[]; 58 | extern MEM_ALIGN16 const UWORD8 gau1_ihevc_chroma_qp_scale[]; 59 | extern MEM_ALIGN16 const WORD8 gai1_ihevc_chroma_qp_scale[]; 60 | 61 | extern MEM_ALIGN16 const WORD32 gai4_ihevc_ang_table_chroma[35]; 62 | extern MEM_ALIGN16 const WORD32 gai4_ihevc_inv_ang_table_chroma[14]; 63 | extern MEM_ALIGN16 const UWORD8 gau1_ihevc_planar_factor_chroma[33]; 64 | 65 | extern MEM_ALIGN16 const UWORD8 gau1_ihevc_planar_factor[65]; 66 | 67 | extern MEM_ALIGN16 const UWORD8 gau1_intra_pred_ref_filter[]; 68 | 69 | extern MEM_ALIGN16 const WORD8 gi1_table_edge_idx[8]; 70 | 71 | extern MEM_ALIGN16 const UWORD8 gu1_table_band_idx[32]; 72 | 73 | extern MEM_ALIGN16 const UWORD16 gu2_table_band_idx[32]; 74 | 75 | #endif /*_IHEVC_COMMON_TABLES_H_*/ 76 | -------------------------------------------------------------------------------- /decoder/mips/ihevcd_function_selector.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_function_selector.c 22 | * 23 | * @brief 24 | * Contains functions to initialize function pointers used in hevc 25 | * 26 | * @author 27 | * Naveen 28 | * 29 | * @par List of Functions: 30 | * @remarks 31 | * None 32 | * 33 | ******************************************************************************* 34 | */ 35 | /*****************************************************************************/ 36 | /* File Includes */ 37 | /*****************************************************************************/ 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include "ihevc_typedefs.h" 44 | #include "iv.h" 45 | #include "ivd.h" 46 | #include "ihevc_defs.h" 47 | #include "ihevc_debug.h" 48 | #include "ihevc_structs.h" 49 | #include "ihevc_macros.h" 50 | #include "ihevc_platform_macros.h" 51 | #include "ihevc_cabac_tables.h" 52 | #include "ihevc_disp_mgr.h" 53 | #include "ihevc_buf_mgr.h" 54 | #include "ihevc_dpb_mgr.h" 55 | #include "ihevc_error.h" 56 | 57 | #include "ihevcd_defs.h" 58 | #include "ihevcd_function_selector.h" 59 | #include "ihevcd_structs.h" 60 | 61 | void ihevcd_init_function_ptr_mips_generic(codec_t *ps_codec); 62 | void ihevcd_init_function_ptr_mips_32(codec_t *ps_codec); 63 | 64 | void ihevcd_init_function_ptr(void *pv_codec) 65 | { 66 | codec_t *ps_codec = (codec_t *)pv_codec; 67 | switch(ps_codec->e_processor_arch) 68 | { 69 | #if ENABLE_MIPS32_SIMD 70 | case ARCH_MIPS_32: 71 | ihevcd_init_function_ptr_mips_32(ps_codec); 72 | break; 73 | #endif 74 | case ARCH_MIPS_GENERIC: 75 | default: 76 | ihevcd_init_function_ptr_mips_generic(ps_codec); 77 | break; 78 | } 79 | } 80 | 81 | void ihevcd_init_arch(void *pv_codec) 82 | { 83 | codec_t *ps_codec = (codec_t *)pv_codec; 84 | ps_codec->e_processor_arch = ARCH_MIPS_32; 85 | } 86 | -------------------------------------------------------------------------------- /common/ihevc_trans.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_trans.h 22 | * 23 | * @brief 24 | * Functions declarations for forward transform 25 | * 26 | * @author 27 | * Ittiam 28 | * 29 | * @remarks 30 | * None 31 | * 32 | ******************************************************************************* 33 | */ 34 | #ifndef _IHEVC_TRANS_H_ 35 | #define _IHEVC_TRANS_H_ 36 | 37 | typedef void ihevc_trans_4x4_ttype1_ft(WORD16 *pi2_src, 38 | WORD16 *pi2_dst, 39 | WORD32 i4_src_strd, 40 | WORD32 i4_dst_strd, 41 | WORD32 i4_shift, 42 | WORD32 i4_zero_rows); 43 | typedef void ihevc_trans_4x4_ft(WORD16 *pi2_src, 44 | WORD16 *pi2_dst, 45 | WORD32 i4_src_strd, 46 | WORD32 i4_dst_strd, 47 | WORD32 i4_shift, 48 | WORD32 i4_zero_rows); 49 | typedef void ihevc_trans_8x8_ft(WORD16 *pi2_src, 50 | WORD16 *pi2_dst, 51 | WORD32 i4_src_strd, 52 | WORD32 i4_dst_strd, 53 | WORD32 i4_shift, 54 | WORD32 i4_zero_rows); 55 | typedef void ihevc_trans_16x16_ft(WORD16 *pi2_src, 56 | WORD16 *pi2_dst, 57 | WORD32 i4_src_strd, 58 | WORD32 i4_dst_strd, 59 | WORD32 i4_shift, 60 | WORD32 i4_zero_rows); 61 | typedef void ihevc_trans_32x32_ft(WORD16 *pi2_src, 62 | WORD16 *pi2_dst, 63 | WORD32 i4_src_strd, 64 | WORD32 i4_dst_strd, 65 | WORD32 i4_shift, 66 | WORD32 i4_zero_rows); 67 | 68 | ihevc_trans_4x4_ttype1_ft ihevc_trans_4x4_ttype1; 69 | ihevc_trans_4x4_ft ihevc_trans_4x4; 70 | ihevc_trans_8x8_ft ihevc_trans_8x8; 71 | ihevc_trans_16x16_ft ihevc_trans_16x16; 72 | ihevc_trans_32x32_ft ihevc_trans_32x32; 73 | 74 | 75 | #endif /*_IHEVC_TRANS_H_*/ 76 | -------------------------------------------------------------------------------- /common/mips/ihevc_platform_macros.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_platform_macros.h 22 | * 23 | * @brief 24 | * Platform specific Macro definitions used in the codec 25 | * 26 | * @author 27 | * Ittiam 28 | * 29 | * @remarks 30 | * None 31 | * 32 | ******************************************************************************* 33 | */ 34 | #ifndef _IHEVC_PLATFORM_MACROS_H_ 35 | #define _IHEVC_PLATFORM_MACROS_H_ 36 | 37 | 38 | #define CLIP_U8(x) CLIP3((x), 0, 255) 39 | #define CLIP_S8(x) CLIP3((x), -128, 127) 40 | 41 | #define CLIP_U10(x) CLIP3((x), 0, 1023); 42 | #define CLIP_S10(x) CLIP3((x), -512, 511); 43 | 44 | #define CLIP_U12(x) CLIP3((x), 0, 4095); 45 | #define CLIP_S12(x) CLIP3((x), -2048, 2047); 46 | 47 | #define CLIP_U16(x) CLIP3((x), 0, 65535) 48 | #define CLIP_S16(x) CLIP3((x), -32768, 32767) 49 | 50 | #define ITT_BIG_ENDIAN(x) ((x << 24)) | \ 51 | ((x & 0x0000ff00) << 8) | \ 52 | ((x & 0x00ff0000) >> 8) | \ 53 | ((UWORD32)x >> 24); 54 | 55 | #define SHL(x,y) (((y) < 32) ? ((x) << (y)) : 0) 56 | #define SHR(x,y) (((y) < 32) ? ((x) >> (y)) : 0) 57 | 58 | #define SHR_NEG(val,shift) ((shift>0)?(val>>shift):(val<<(-shift))) 59 | #define SHL_NEG(val,shift) ((shift<0)?(val>>(-shift)):(val< 0 ; nop_i--) asm("nop");} 89 | 90 | #define INLINE 91 | 92 | #define MEM_ALIGN8 __attribute__ ((aligned (8))) 93 | #define MEM_ALIGN16 __attribute__ ((aligned (16))) 94 | #define MEM_ALIGN32 __attribute__ ((aligned (32))) 95 | 96 | #define DATA_SYNC() __sync_synchronize() 97 | 98 | #endif /* _IHEVC_PLATFORM_MACROS_H_ */ 99 | -------------------------------------------------------------------------------- /decoder/ihevcd_itrans_recon_dc.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_itrans_recon.h 22 | * 23 | * @brief 24 | * Header for itrans recon dc functions 25 | * 26 | * @author 27 | * Naveen 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | 37 | #ifndef _IHEVCD_ITRANS_RECON_DC_H_ 38 | #define _IHEVCD_ITRANS_RECON_DC_H_ 39 | 40 | typedef void ihevcd_itrans_recon_dc_luma_ft(UWORD8 *pu1_pred, 41 | UWORD8 *pu1_dst, 42 | WORD32 pred_strd, 43 | WORD32 dst_strd, 44 | WORD32 log2_trans_size, 45 | WORD16 i2_coeff_value); 46 | typedef void ihevcd_itrans_recon_dc_chroma_ft(UWORD8 *pu1_pred, 47 | UWORD8 *pu1_dst, 48 | WORD32 pred_strd, 49 | WORD32 dst_strd, 50 | WORD32 log2_trans_size, 51 | WORD16 i2_coeff_value); 52 | 53 | /* C function declarations */ 54 | ihevcd_itrans_recon_dc_luma_ft ihevcd_itrans_recon_dc_luma; 55 | ihevcd_itrans_recon_dc_chroma_ft ihevcd_itrans_recon_dc_chroma; 56 | 57 | /* A9Q function declarations */ 58 | ihevcd_itrans_recon_dc_luma_ft ihevcd_itrans_recon_dc_luma_a9q; 59 | ihevcd_itrans_recon_dc_chroma_ft ihevcd_itrans_recon_dc_chroma_a9q; 60 | 61 | /* A9A function declarations */ 62 | ihevcd_itrans_recon_dc_luma_ft ihevcd_itrans_recon_dc_luma_a9a; 63 | ihevcd_itrans_recon_dc_chroma_ft ihevcd_itrans_recon_dc_chroma_a9a; 64 | 65 | /* SSSE3 function declarations */ 66 | ihevcd_itrans_recon_dc_luma_ft ihevcd_itrans_recon_dc_luma_ssse3; 67 | ihevcd_itrans_recon_dc_chroma_ft ihevcd_itrans_recon_dc_chroma_ssse3; 68 | 69 | /* SSS4.2 function declarations */ 70 | ihevcd_itrans_recon_dc_luma_ft ihevcd_itrans_recon_dc_luma_sse42; 71 | ihevcd_itrans_recon_dc_chroma_ft ihevcd_itrans_recon_dc_chroma_sse42; 72 | 73 | /* armv8 function declarations */ 74 | ihevcd_itrans_recon_dc_luma_ft ihevcd_itrans_recon_dc_luma_av8; 75 | ihevcd_itrans_recon_dc_chroma_ft ihevcd_itrans_recon_dc_chroma_av8; 76 | 77 | #endif /* _IHEVCD_ITRANS_RECON_DC_H_ */ 78 | -------------------------------------------------------------------------------- /common/ihevc_dpb_mgr.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | 19 | /** 20 | ******************************************************************************* 21 | * @file 22 | * ihevc_dpb_mgr.h 23 | * 24 | * @brief 25 | * Function declarations used for decoded picture buffer management 26 | * 27 | * @author 28 | * Srinivas T 29 | * 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | #ifndef _DPB_MANAGER_H 37 | #define _DPB_MANAGER_H 38 | 39 | /* Temporary definitions. Have to be defined later */ 40 | 41 | #define MAX_DPB_BUFS (MAX_DPB_SIZE * 4) 42 | 43 | #define MARK_ST_PICNUM_AS_NONREF 1 44 | #define MARK_LT_INDEX_AS_NONREF 2 45 | #define MARK_ST_PICNUM_AS_LT_INDEX 3 46 | #define RESET_REF_PICTURES 5 47 | 48 | typedef struct dpb_info_t dpb_info_t; 49 | 50 | enum 51 | { 52 | UNUSED_FOR_REF = 0, 53 | LONG_TERM_REF, 54 | SHORT_TERM_REF, 55 | }; 56 | struct dpb_info_t 57 | { 58 | /** 59 | * Pointer to picture buffer structure 60 | */ 61 | pic_buf_t *ps_pic_buf; 62 | 63 | /** 64 | * Link to the DPB buffer with previous pic Num 65 | */ 66 | dpb_info_t *ps_prev_dpb; 67 | 68 | }; 69 | 70 | typedef struct 71 | { 72 | /** 73 | * Pointer to the most recent pic Num 74 | */ 75 | dpb_info_t *ps_dpb_head; 76 | 77 | /** 78 | * Physical storage for dpbInfo for ref bufs 79 | */ 80 | dpb_info_t as_dpb_info[MAX_DPB_BUFS]; 81 | 82 | /** 83 | * Number of reference buffers 84 | */ 85 | UWORD8 u1_num_ref_bufs; 86 | 87 | }dpb_mgr_t; 88 | 89 | void ihevc_dpb_mgr_init(dpb_mgr_t *ps_dpb_mgr); 90 | 91 | WORD32 ihevc_dpb_mgr_insert_ref(dpb_mgr_t *ps_dpb_mgr, 92 | pic_buf_t *ps_pic_buf, 93 | WORD32 buf_id); 94 | 95 | void ihevc_dpb_mgr_del_ref(dpb_mgr_t *ps_dpb_mgr, 96 | buf_mgr_t *ps_buf_mgr, 97 | WORD32 u4_abs_poc); 98 | 99 | pic_buf_t* ihevc_dpb_mgr_get_ref_by_nearest_poc(dpb_mgr_t *ps_dpb_mgr, WORD32 cur_abs_poc); 100 | 101 | pic_buf_t* ihevc_dpb_mgr_get_ref_by_poc(dpb_mgr_t *ps_dpb_mgr, WORD32 abs_poc); 102 | 103 | pic_buf_t* ihevc_dpb_mgr_get_ref_by_poc_lsb(dpb_mgr_t *ps_dpb_mgr, WORD32 poc_lsb); 104 | 105 | void ihevc_dpb_mgr_reset(dpb_mgr_t *ps_dpb_mgr, buf_mgr_t *ps_buf_mgr); 106 | 107 | void ihevc_dpb_mgr_release_pics(buf_mgr_t *ps_buf_mgr, UWORD8 u1_disp_bufs); 108 | 109 | #endif /* _DPB_MANAGER_H */ 110 | -------------------------------------------------------------------------------- /common/ihevc_macros.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_macros.h 22 | * 23 | * @brief 24 | * Macro definitions used in the codec 25 | * 26 | * @author 27 | * Ittiam 28 | * 29 | * @remarks 30 | * None 31 | * 32 | ******************************************************************************* 33 | */ 34 | #ifndef _IHEVC_MACROS_H_ 35 | #define _IHEVC_MACROS_H_ 36 | 37 | #define RETURN_IF(cond, retval) if(cond) {return (retval);} 38 | #define UNUSED(x) ((void)(x)) 39 | 40 | #define CLIP3(x, min, max) (((x) > (max)) ? (max) :(((x) < (min))? (min):(x))) 41 | 42 | #define MAX(x,y) (((x) > (y)) ? (x) :(y)) 43 | #define MIN(x,y) (((x) < (y)) ? (x) :(y)) 44 | #define SIGN(x) ((x) >= 0 ? ((x)>0 ? 1: 0) : -1) 45 | #define ABS(x) ((((WORD32)(x)) > 0) ? (x) : -(x)) 46 | 47 | #define ALIGN128(x) ((((x) + 127) >> 7) << 7) 48 | #define ALIGN64(x) ((((x) + 63) >> 6) << 6) 49 | #define ALIGN32(x) ((((x) + 31) >> 5) << 5) 50 | #define ALIGN16(x) ((((x) + 15) >> 4) << 4) 51 | #define ALIGN8(x) ((((x) + 7) >> 3) << 3) 52 | #define ALIGN4(x) ((((x) + 3) >> 2) << 2) 53 | 54 | #define ALIGN_POW2(ptr,align) ((((WORD32)ptr)+align-1)&(~(align-1))) 55 | 56 | /** Sets x bits to '1' starting from MSB */ 57 | #define MSB_ONES(x) ((UWORD32)0xFFFFFFFF << (32 - (x))) 58 | 59 | /** Generates a pattern of x number of '01' in binary starting from MSB */ 60 | #define DUP_MSB_01(x) ((UWORD32)0x55555555 << (32 - ((x) * 2))) 61 | 62 | /** Generates a pattern of x number of '10' in binary starting from MSB */ 63 | #define DUP_MSB_10(x) ((UWORD32)0xAAAAAAAA << (32 - ((x) * 2))) 64 | 65 | /** Generates a pattern of x number of '11' in binary starting from MSB */ 66 | #define DUP_MSB_11(x) ((UWORD32)0xFFFFFFFF << (32 - ((x) * 2))) 67 | 68 | /** Sets x bits to '1' starting from LSB */ 69 | #define LSB_ONES(x) ((UWORD32)0xFFFFFFFF >> (32 - (x))) 70 | 71 | /** Generates a pattern of x number of '01' in binary starting from LSB */ 72 | #define DUP_LSB_01(x) ((UWORD32)0x55555555 >> (32 - ((x) * 2))) 73 | 74 | /** Generates a pattern of x number of '10' in binary starting from LSB */ 75 | #define DUP_LSB_10(x) ((UWORD32)0xAAAAAAAA >> (32 - ((x) * 2))) 76 | 77 | /** Generates a pattern of x number of '11' in binary starting from LSB */ 78 | #define DUP_LSB_11(x) ((UWORD32)0xFFFFFFFF >> (32 - ((x) * 2))) 79 | 80 | /** Sets the bit in given position to 1 */ 81 | #define BITSET(x, pos) ((x) | (1 << (pos))) 82 | 83 | /** Swap two variables */ 84 | #define SWAP(X,Y) \ 85 | { \ 86 | (X) = (X) ^ (Y); \ 87 | (Y) = (X) ^ (Y); \ 88 | (X) = (X) ^ (Y); \ 89 | } 90 | #endif /*_IHEVCD_MACROS_H_*/ 91 | -------------------------------------------------------------------------------- /decoder/ihevcd_profile.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_profile.h 22 | * 23 | * @brief 24 | * Contains macros for profiling individual modules of decoder 25 | * 26 | * @author 27 | * Naveen SR 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | 37 | #ifndef _IHEVCD_PROFILE_H_ 38 | #define _IHEVCD_PROFILE_H_ 39 | 40 | #include "ihevc_defs.h" 41 | /* Define return; to disable individual module */ 42 | #ifdef PROFILE_DIS_SAO_LEAF_LEVEL 43 | #define PROFILE_DISABLE_SAO_LEAF_LEVEL() return; 44 | #else 45 | #define PROFILE_DISABLE_SAO_LEAF_LEVEL() ; 46 | #endif 47 | 48 | #ifdef PROFILE_DIS_SAO 49 | #define PROFILE_DISABLE_SAO() return; 50 | #else 51 | #define PROFILE_DISABLE_SAO() ; 52 | #endif 53 | 54 | #ifdef PROFILE_DIS_DEBLK 55 | #define PROFILE_DISABLE_DEBLK() return; 56 | #else 57 | #define PROFILE_DISABLE_DEBLK() ; 58 | #endif 59 | 60 | #ifdef PROFILE_DIS_IQ_IT_RECON_INTRA_PRED 61 | #define PROFILE_DISABLE_IQ_IT_RECON_INTRA_PRED() return; 62 | #else 63 | #define PROFILE_DISABLE_IQ_IT_RECON_INTRA_PRED() ; 64 | #endif 65 | 66 | #ifdef PROFILE_DIS_INTER_PRED 67 | #define PROFILE_DISABLE_INTER_PRED() return; 68 | #else 69 | #define PROFILE_DISABLE_INTER_PRED() ; 70 | #endif 71 | 72 | #ifdef PROFILE_DIS_PROCESS_CTB 73 | #define PROFILE_DISABLE_PROCESS_CTB() return; 74 | /* When processing is disabled, no point in format converion as well */ 75 | #define PROFILE_DISABLE_FMT_CONV() return 0; 76 | #else 77 | #define PROFILE_DISABLE_PROCESS_CTB() ; 78 | #define PROFILE_DISABLE_FMT_CONV(); 79 | #endif 80 | 81 | #ifdef PROFILE_DIS_BOUNDARY_STRENGTH 82 | #define PROFILE_DISABLE_BOUNDARY_STRENGTH() return; 83 | #else 84 | #define PROFILE_DISABLE_BOUNDARY_STRENGTH() ; 85 | #endif 86 | 87 | #ifdef PROFILE_DIS_MV_PREDICTION 88 | #define PROFILE_DISABLE_MV_PREDICTION() return; 89 | #else 90 | #define PROFILE_DISABLE_MV_PREDICTION() ; 91 | #endif 92 | 93 | //#define PROFILE_DISABLE_INTER_PRED_LUMA(clr_indx) {if(clr_indx == 0) continue;} 94 | //#define PROFILE_DISABLE_INTER_PRED_CHROMA(clr_indx) {if(clr_indx == 1) continue;} 95 | //#define PROFILE_DISABLE_INTER_PRED_LUMA_AVERAGING(clr_indx) {if(clr_indx == 0) continue;} 96 | //#define PROFILE_DISABLE_INTER_PRED_CHROMA_AVERAGING(clr_indx) {if(clr_indx == 1) continue;} 97 | 98 | #define PROFILE_DISABLE_INTER_PRED_LUMA(clr_indx) ; 99 | #define PROFILE_DISABLE_INTER_PRED_CHROMA(clr_indx) ; 100 | #define PROFILE_DISABLE_INTER_PRED_LUMA_AVERAGING(clr_indx) ; 101 | #define PROFILE_DISABLE_INTER_PRED_CHROMA_AVERAGING(clr_indx) ; 102 | 103 | #endif /* _IHEVCD_PROFILE_H_ */ 104 | -------------------------------------------------------------------------------- /decoder/ihevcd_error.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_error.h 22 | * 23 | * @brief 24 | * Definitions related to error handling 25 | * 26 | * @author 27 | * Harish 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | 37 | #ifndef _IHEVCD_ERROR_H_ 38 | #define _IHEVCD_ERROR_H_ 39 | 40 | /** 41 | * Enumerations for error codes used in the codec. 42 | * Not all these are expected to be returned to the application. 43 | * Only select few will be exported 44 | */ 45 | typedef enum 46 | { 47 | /** 48 | * VPS id more than MAX_VPS_CNT 49 | */ 50 | IHEVCD_UNSUPPORTED_VPS_ID = IVD_DUMMY_ELEMENT_FOR_CODEC_EXTENSIONS + 0x300, 51 | /** 52 | * SPS id more than MAX_SPS_CNT 53 | */ 54 | 55 | IHEVCD_UNSUPPORTED_SPS_ID, 56 | /** 57 | * PPS id more than MAX_PPS_CNT 58 | */ 59 | 60 | IHEVCD_UNSUPPORTED_PPS_ID, 61 | 62 | /** 63 | * Invelid Parameter while decoding 64 | */ 65 | IHEVCD_INVALID_PARAMETER, 66 | 67 | /** 68 | * Invalid header 69 | */ 70 | IHEVCD_INVALID_HEADER, 71 | 72 | /** 73 | * In sufficient memory allocated for MV Bank 74 | */ 75 | IHEVCD_INSUFFICIENT_MEM_MVBANK, 76 | 77 | /** 78 | * In sufficient memory allocated for MV Bank 79 | */ 80 | IHEVCD_INSUFFICIENT_MEM_PICBUF, 81 | 82 | /** 83 | * Buffer manager error 84 | */ 85 | IHEVCD_BUF_MGR_ERROR, 86 | 87 | /** 88 | * No free MV Bank buffer available to store current pic 89 | */ 90 | IHEVCD_NO_FREE_MVBANK, 91 | 92 | /** 93 | * No free picture buffer available to store current pic 94 | */ 95 | IHEVCD_NO_FREE_PICBUF, 96 | /** 97 | * Reached slice header in header mode 98 | */ 99 | IHEVCD_SLICE_IN_HEADER_MODE, 100 | 101 | /** 102 | * Ignore current slice and continue 103 | */ 104 | IHEVCD_IGNORE_SLICE, 105 | 106 | /** 107 | * Reference Picture not found 108 | */ 109 | IHEVCD_REF_PIC_NOT_FOUND, 110 | 111 | /** 112 | * Bit depth is greater than 8 113 | */ 114 | IHEVCD_UNSUPPORTED_BIT_DEPTH, 115 | 116 | /** 117 | * Limit on the number of frames decoded 118 | */ 119 | IHEVCD_NUM_FRAMES_LIMIT_REACHED, 120 | 121 | /** 122 | * VUI parameters not found 123 | */ 124 | IHEVCD_VUI_PARAMS_NOT_FOUND, 125 | 126 | /** 127 | * SEI mastering parameters not found 128 | */ 129 | IHEVCD_SEI_MASTERING_PARAMS_NOT_FOUND, 130 | 131 | }IHEVCD_ERROR_T; 132 | #endif /* _IHEVCD_ERROR_H_ */ 133 | -------------------------------------------------------------------------------- /decoder/x86/ihevcd_function_selector.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_function_selector.c 22 | * 23 | * @brief 24 | * Contains functions to initialize function pointers used in hevc 25 | * 26 | * @author 27 | * Naveen 28 | * 29 | * @par List of Functions: 30 | * @remarks 31 | * None 32 | * 33 | ******************************************************************************* 34 | */ 35 | /*****************************************************************************/ 36 | /* File Includes */ 37 | /*****************************************************************************/ 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include "ihevc_typedefs.h" 44 | #include "iv.h" 45 | #include "ivd.h" 46 | #include "ihevc_defs.h" 47 | #include "ihevc_debug.h" 48 | #include "ihevc_structs.h" 49 | #include "ihevc_macros.h" 50 | #include "ihevc_platform_macros.h" 51 | #include "ihevc_cabac_tables.h" 52 | #include "ihevc_disp_mgr.h" 53 | #include "ihevc_buf_mgr.h" 54 | #include "ihevc_dpb_mgr.h" 55 | #include "ihevc_error.h" 56 | 57 | #include "ihevcd_defs.h" 58 | #include "ihevcd_function_selector.h" 59 | #include "ihevcd_structs.h" 60 | 61 | void ihevcd_init_function_ptr(void *pv_codec) 62 | { 63 | codec_t *ps_codec = (codec_t *)pv_codec; 64 | switch(ps_codec->e_processor_arch) 65 | { 66 | case ARCH_X86_GENERIC: 67 | ihevcd_init_function_ptr_generic(pv_codec); 68 | break; 69 | case ARCH_X86_SSSE3: 70 | ihevcd_init_function_ptr_ssse3(pv_codec); 71 | break; 72 | case ARCH_X86_SSE42: 73 | ihevcd_init_function_ptr_sse42(pv_codec); 74 | break; 75 | case ARCH_X86_AVX2: 76 | #ifndef DISABLE_AVX2 77 | ihevcd_init_function_ptr_avx2(pv_codec); 78 | #else 79 | ihevcd_init_function_ptr_sse42(pv_codec); 80 | #endif 81 | break; 82 | default: 83 | ihevcd_init_function_ptr_ssse3(pv_codec); 84 | break; 85 | } 86 | } 87 | 88 | void ihevcd_init_arch(void *pv_codec) 89 | { 90 | codec_t *ps_codec = (codec_t *)pv_codec; 91 | 92 | #ifdef DEFAULT_ARCH 93 | #if DEFAULT_ARCH == D_ARCH_X86_GENERIC 94 | ps_codec->e_processor_arch = ARCH_X86_GENERIC; 95 | #elif DEFAULT_ARCH == D_ARCH_X86_SSE42 96 | ps_codec->e_processor_arch = ARCH_X86_SSE42; 97 | #elif DEFAULT_ARCH == D_ARCH_X86_AVX2 98 | ps_codec->e_processor_arch = ARCH_X86_AVX2; 99 | #else 100 | ps_codec->e_processor_arch = ARCH_X86_SSSE3; 101 | #endif 102 | #else 103 | ps_codec->e_processor_arch = ARCH_X86_SSSE3; 104 | #endif 105 | } 106 | -------------------------------------------------------------------------------- /common/ihevc_buf_mgr.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_buf_mgr.h 22 | * 23 | * @brief 24 | * Function declarations used for buffer management 25 | * 26 | * @author 27 | * Srinivas T 28 | * 29 | * @remarks 30 | * None 31 | * 32 | ******************************************************************************* 33 | */ 34 | #ifndef _BUF_MGR_H_ 35 | #define _BUF_MGR_H_ 36 | 37 | #define BUF_MGR_MAX_CNT 64 38 | 39 | #define BUF_MGR_DEC 1 40 | #define BUF_MGR_REF (1 << 1) 41 | #define BUF_MGR_DISP (1 << 2) 42 | 43 | typedef struct 44 | { 45 | /** 46 | * max_buf_cnt 47 | */ 48 | UWORD32 u4_max_buf_cnt; 49 | 50 | /** 51 | * active_buf_cnt 52 | */ 53 | UWORD32 u4_active_buf_cnt; 54 | /** 55 | * au4_status[BUF_MGR_MAX_CNT] 56 | */ 57 | UWORD32 au4_status[BUF_MGR_MAX_CNT]; 58 | /* The last three bit of status are: */ 59 | /* Bit 0 - DEC */ 60 | /* Bit 1 - REF */ 61 | /* Bit 2 - DISP */ 62 | 63 | void *apv_ptr[BUF_MGR_MAX_CNT]; 64 | }buf_mgr_t; 65 | 66 | // intializes the buffer API structure 67 | void ihevc_buf_mgr_init( 68 | buf_mgr_t *ps_buf_mgr); 69 | 70 | // Add buffer to buffer manager. 0: success, -1: fail (u4_active_buf_cnt has reached u4_max_buf_cnt) 71 | WORD32 ihevc_buf_mgr_add( 72 | buf_mgr_t *ps_buf_mgr, 73 | void *pv_ptr, 74 | WORD32 buf_id); 75 | 76 | // this function will set the buffer status to DEC 77 | void* ihevc_buf_mgr_get_next_free( 78 | buf_mgr_t *ps_buf_mgr, 79 | WORD32 *pi4_id); 80 | 81 | // this function will check if there are any free buffers 82 | WORD32 ihevc_buf_mgr_check_free( 83 | buf_mgr_t *ps_buf_mgr); 84 | 85 | // mask will have who released it: DISP:REF:DEC 86 | WORD32 ihevc_buf_mgr_release( 87 | buf_mgr_t *ps_buf_mgr, 88 | WORD32 id, 89 | UWORD32 mask); 90 | 91 | // sets the status to one or all of DISP:REF:DEC 92 | WORD32 ihevc_buf_mgr_set_status( 93 | buf_mgr_t *ps_buf_mgr, 94 | WORD32 id, 95 | UWORD32 mask); 96 | 97 | // Gets status of the buffer 98 | UWORD32 ihevc_buf_mgr_get_status( 99 | buf_mgr_t *ps_buf_mgr, 100 | WORD32 id); 101 | 102 | // pass the ID - buffer will be returned 103 | void* ihevc_buf_mgr_get_buf( 104 | buf_mgr_t *ps_buf_mgr, 105 | WORD32 id); 106 | 107 | // will return number of active buffers 108 | UWORD32 ihevc_buf_mgr_get_num_active_buf( 109 | buf_mgr_t *ps_buf_mgr); 110 | 111 | 112 | 113 | #endif //_BUF_MGR_H_ 114 | -------------------------------------------------------------------------------- /common/ihevc_trans_tables.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_trans_tables.h 22 | * 23 | * @brief 24 | * Tables for forward and inverse transform 25 | * 26 | * @author 27 | * Ittiam 28 | * 29 | * @remarks 30 | * None 31 | * 32 | ******************************************************************************* 33 | */ 34 | #ifndef _IHEVC_TRANS_TABLES_H_ 35 | #define _IHEVC_TRANS_TABLES_H_ 36 | 37 | 38 | #include "ihevc_defs.h" 39 | 40 | extern const WORD32 g_ihevc_iquant_scales[6]; 41 | 42 | extern const WORD16 g_ihevc_iquant_intr_scales[6][8]; 43 | 44 | extern const WORD32 g_ihevc_iquant_scales_flat_scale[6]; 45 | 46 | extern const WORD32 g_ihevc_quant_scales[6]; 47 | 48 | extern const WORD16 g_ai2_ihevc_trans_dst_4[4][4]; 49 | 50 | extern const WORD16 g_ai2_ihevc_trans_4[4][4]; 51 | 52 | extern const WORD16 g_ai2_ihevc_trans_4_transpose[4][4]; 53 | 54 | extern const WORD16 g_ai2_ihevc_trans_8[8][8]; 55 | 56 | extern const WORD16 g_ai2_ihevc_trans_16[16][16]; 57 | extern const WORD32 g_ai4_ihevc_trans_16[16][8]; 58 | extern const WORD16 g_ai2_ihevc_trans_16_transpose[1][16]; 59 | extern const WORD16 g_ai2_ihevc_trans_32_transpose[1][32]; 60 | extern const WORD16 g_ai2_ihevc_trans_32[32][32]; 61 | extern const WORD32 g_ai4_ihevc_trans_32[32][16]; 62 | 63 | extern const WORD32 g_ai4_ihevc_trans_dst_intr_4[3][4]; 64 | 65 | extern const WORD32 g_ai4_ihevc_trans_4_intr[3][4]; 66 | extern const WORD16 g_ai2_ihevc_trans_4_intr[8]; 67 | 68 | extern const WORD32 g_ai4_ihevc_trans_8_intr[7][4]; 69 | extern const WORD16 g_ai2_ihevc_trans_8_intr[8][8]; 70 | 71 | 72 | extern const WORD32 g_ai4_ihevc_trans_4_ttype1[3][4]; 73 | 74 | extern const WORD32 g_ai4_ihevc_trans_4_ttype0[3][4]; 75 | 76 | extern const WORD32 g_ai4_ihevc_trans_intr_even_8[3][4]; 77 | 78 | extern const WORD32 g_ai4_ihevc_trans_intr_odd_8[4][4]; 79 | 80 | extern const WORD32 g_ai4_ihevc_trans_16_even[7][4]; 81 | 82 | extern const WORD32 g_ai4_ihevc_trans_16_odd[8][4]; 83 | 84 | extern const WORD32 g_ai2_ihevc_trans_32_intr_8[8][4]; 85 | extern const WORD32 g_ai2_ihevc_trans_32_intr_16[15][4]; 86 | 87 | extern const WORD16 g_ai2_ihevc_trans_16_intr_even[12][8]; 88 | 89 | extern const WORD16 g_ai2_ihevc_trans_16_intr_odd[32][8]; 90 | 91 | 92 | extern const WORD16 g_ai2_ihevc_trans_32_intr_odd[32][16]; 93 | 94 | extern const WORD16 g_ai2_ihevc_trans_32_intr_even[22][8]; 95 | 96 | #ifndef DISABLE_AVX2 97 | extern const WORD16 g_ai2_ihevc_trans_8_intr_avx2[8][16]; 98 | extern const WORD32 g_ai4_ihevc_trans_8_intr_avx2[7][8]; 99 | extern const WORD16 g_ai2_ihevc_trans_16_intr_odd_avx2[32][16]; 100 | extern const WORD16 g_ai2_ihevc_trans_16_intr_even_avx2[12][16]; 101 | extern const WORD32 g_ai2_ihevc_trans_32_intr_8_avx2[8][8]; 102 | extern const WORD32 g_ai2_ihevc_trans_32_intr_16_avx2[15][8]; 103 | #endif 104 | 105 | extern MEM_ALIGN16 const WORD16 g_ai2_ihevc_trans_16_even_packed[12][8]; 106 | extern MEM_ALIGN16 const WORD16 g_ai2_ihevc_trans_32_intr_packed[32][8]; 107 | extern MEM_ALIGN16 const WORD16 g_ai2_ihevc_trans_32_intr_odd_packed[128][8]; 108 | 109 | extern MEM_ALIGN16 const WORD16 g_ai2_ihevc_trans_16_even[12][8]; 110 | extern MEM_ALIGN16 const WORD16 g_ai2_ihevc_trans_16_odd[32][8]; 111 | 112 | extern MEM_ALIGN16 const WORD16 g_ai2_ihevc_trans_intr_even_8[4][8]; 113 | extern MEM_ALIGN16 const WORD16 g_ai2_ihevc_trans_intr_odd_8[8][8]; 114 | 115 | extern const WORD16 g_ai2_ihevc_trans_intr_4[4][8]; 116 | 117 | extern const UWORD8 IHEVCE_CHROMA_SHUFFLEMASK_HBD[8]; 118 | 119 | #endif /*_IHEVC_TRANS_TABLES_H_*/ 120 | -------------------------------------------------------------------------------- /decoder/arm/ihevcd_function_selector.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_function_selector.c 22 | * 23 | * @brief 24 | * Contains functions to initialize function pointers used in hevc 25 | * 26 | * @author 27 | * Naveen 28 | * 29 | * @par List of Functions: 30 | * @remarks 31 | * None 32 | * 33 | ******************************************************************************* 34 | */ 35 | /*****************************************************************************/ 36 | /* File Includes */ 37 | /*****************************************************************************/ 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include "ihevc_typedefs.h" 44 | #include "iv.h" 45 | #include "ivd.h" 46 | #include "ihevc_defs.h" 47 | #include "ihevc_debug.h" 48 | #include "ihevc_structs.h" 49 | #include "ihevc_macros.h" 50 | #include "ihevc_platform_macros.h" 51 | #include "ihevc_cabac_tables.h" 52 | #include "ihevc_disp_mgr.h" 53 | #include "ihevc_buf_mgr.h" 54 | #include "ihevc_dpb_mgr.h" 55 | #include "ihevc_error.h" 56 | 57 | #include "ihevcd_defs.h" 58 | #include "ihevcd_function_selector.h" 59 | #include "ihevcd_structs.h" 60 | 61 | void ihevcd_init_function_ptr_neonintr(codec_t *ps_codec); 62 | void ihevcd_init_function_ptr_noneon(codec_t *ps_codec); 63 | void ihevcd_init_function_ptr_a9q(codec_t *ps_codec); 64 | void ihevcd_init_function_ptr_av8(codec_t *ps_codec); 65 | void ihevcd_init_function_ptr(void *pv_codec) 66 | { 67 | codec_t *ps_codec = (codec_t *)pv_codec; 68 | 69 | #ifndef ARMV8 70 | switch(ps_codec->e_processor_arch) 71 | { 72 | #ifndef DISABLE_NEONINTR 73 | case ARCH_ARM_NEONINTR: 74 | ihevcd_init_function_ptr_neonintr(ps_codec); 75 | break; 76 | #endif 77 | case ARCH_ARM_NONEON: 78 | ihevcd_init_function_ptr_noneon(ps_codec); 79 | break; 80 | default: 81 | case ARCH_ARM_A5: 82 | case ARCH_ARM_A7: 83 | case ARCH_ARM_A9: 84 | case ARCH_ARM_A15: 85 | case ARCH_ARM_A9Q: 86 | #ifndef DISABLE_NEON 87 | ihevcd_init_function_ptr_a9q(ps_codec); 88 | #else 89 | ihevcd_init_function_ptr_noneon(ps_codec); 90 | #endif 91 | break; 92 | } 93 | switch(ps_codec->e_processor_soc) 94 | { 95 | 96 | case SOC_HISI_37X: 97 | #ifndef DISABLE_NEON 98 | ps_codec->s_func_selector.ihevcd_fmt_conv_420sp_to_420sp_fptr = &ihevcd_fmt_conv_420sp_to_420sp_a9q; 99 | #endif 100 | break; 101 | case SOC_GENERIC: 102 | default: 103 | break; 104 | } 105 | #else 106 | switch(ps_codec->e_processor_arch) 107 | { 108 | case ARCH_ARM_NONEON: 109 | ihevcd_init_function_ptr_noneon(ps_codec); 110 | break; 111 | case ARCH_ARMV8_GENERIC: 112 | default: 113 | ihevcd_init_function_ptr_av8(ps_codec); 114 | break; 115 | } 116 | #endif 117 | } 118 | 119 | void ihevcd_init_arch(void *pv_codec) 120 | { 121 | codec_t *ps_codec = (codec_t *)pv_codec; 122 | #ifdef DEFAULT_ARCH 123 | #if DEFAULT_ARCH == D_ARCH_ARM_NONEON 124 | ps_codec->e_processor_arch = ARCH_ARM_NONEON; 125 | #elif DEFAULT_ARCH == D_ARCH_ARMV8_GENERIC 126 | ps_codec->e_processor_arch = ARCH_ARMV8_GENERIC; 127 | #elif DEFAULT_ARCH == D_ARCH_ARM_NEONINTR 128 | ps_codec->e_processor_arch = ARCH_ARM_NEONINTR; 129 | #else 130 | ps_codec->e_processor_arch = ARCH_ARM_A9Q; 131 | #endif 132 | #else 133 | ps_codec->e_processor_arch = ARCH_ARM_A9Q; 134 | #endif 135 | } 136 | -------------------------------------------------------------------------------- /common/arm/ihevc_deblk_chroma_horz.s: -------------------------------------------------------------------------------- 1 | @/***************************************************************************** 2 | @* 3 | @* Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | @/******************************************************************************* 19 | @* @file 20 | @* ihevc_deblk_luma_horz.s 21 | @* 22 | @* @brief 23 | @* contains function definitions for inter prediction interpolation. 24 | @* functions are coded using neon intrinsics and can be compiled using 25 | 26 | @* rvct 27 | @* 28 | @* @author 29 | @* anand s 30 | @* 31 | @* @par list of functions: 32 | @* 33 | @* 34 | @* @remarks 35 | @* none 36 | @* 37 | @*******************************************************************************/ 38 | 39 | .equ qp_offset_u_offset, 40 40 | .equ qp_offset_v_offset, 44 41 | .equ tc_offset_div2_offset, 48 42 | .equ filter_p_offset, 52 43 | .equ filter_q_offset, 56 44 | 45 | .text 46 | .align 4 47 | 48 | 49 | 50 | 51 | .extern gai4_ihevc_qp_table 52 | .extern gai4_ihevc_tc_table 53 | .globl ihevc_deblk_chroma_horz_a9q 54 | 55 | gai4_ihevc_qp_table_addr: 56 | .long gai4_ihevc_qp_table - ulbl1 - 8 57 | 58 | gai4_ihevc_tc_table_addr: 59 | .long gai4_ihevc_tc_table - ulbl2 - 8 60 | 61 | .type ihevc_deblk_chroma_horz_a9q, %function 62 | 63 | ihevc_deblk_chroma_horz_a9q: 64 | push {r4-r12,lr} 65 | sub r12,r0,r1 66 | vld1.8 {d0},[r0] 67 | sub r5,r12,r1 68 | add r6,r0,r1 69 | add r1,r2,r3 70 | vmovl.u8 q0,d0 71 | ldr r10,[sp,#qp_offset_u_offset] 72 | vld1.8 {d2},[r12] 73 | add r2,r1,#1 74 | ldr r4,[sp,#tc_offset_div2_offset] 75 | vld1.8 {d4},[r5] 76 | ldr r8,[sp,#filter_p_offset] 77 | vld1.8 {d16},[r6] 78 | ldr r9,[sp,#filter_q_offset] 79 | adds r1,r10,r2,asr #1 80 | vmovl.u8 q1,d2 81 | ldr r7,[sp,#qp_offset_v_offset] 82 | ldr r3,gai4_ihevc_qp_table_addr 83 | ulbl1: 84 | add r3, r3, pc 85 | bmi l1.3312 86 | cmp r1,#0x39 87 | ldrle r1,[r3,r1,lsl #2] 88 | subgt r1,r1,#6 89 | l1.3312: 90 | adds r2,r7,r2,asr #1 91 | vmovl.u8 q2,d4 92 | bmi l1.3332 93 | cmp r2,#0x39 94 | ldrle r2,[r3,r2,lsl #2] 95 | subgt r2,r2,#6 96 | l1.3332: 97 | add r1,r1,r4,lsl #1 98 | vsub.i16 q3,q0,q1 99 | add r3,r1,#2 100 | cmp r3,#0x35 101 | movgt r1,#0x35 102 | vshl.i16 q3,q3,#2 103 | vmovl.u8 q8,d16 104 | bgt l1.3368 105 | adds r3,r1,#2 106 | addpl r1,r1,#2 107 | movmi r1,#0 108 | l1.3368: 109 | ldr r3,gai4_ihevc_tc_table_addr 110 | ulbl2: 111 | add r3, r3, pc 112 | vadd.i16 q2,q3,q2 113 | add r2,r2,r4,lsl #1 114 | vsub.i16 q3,q2,q8 115 | add r4,r2,#2 116 | ldr r1,[r3,r1,lsl #2] 117 | cmp r4,#0x35 118 | movgt r2,#0x35 119 | bgt l1.3412 120 | adds r4,r2,#2 121 | addpl r2,r2,#2 122 | movmi r2,#0 123 | l1.3412: 124 | 125 | 126 | ldr r2,[r3,r2,lsl #2] 127 | cmp r8,#0 128 | vdup.16 q8,r2 129 | vdup.16 q2,r1 130 | rsb r1,r1,#0 131 | vrshr.s16 q3,q3,#3 132 | vdup.16 q9,r1 133 | rsb r1,r2,#0 134 | vzip.16 q2,q8 135 | vdup.16 q10,r1 136 | 137 | vzip.16 q9,q10 138 | 139 | vmin.s16 q8,q3,q2 140 | vmax.s16 q2,q9,q8 141 | vadd.i16 q1,q1,q2 142 | vsub.i16 q0,q0,q2 143 | vqmovun.s16 d2,q1 144 | vqmovun.s16 d0,q0 145 | beq l1.3528 146 | vst1.8 {d2},[r12] 147 | l1.3528: 148 | cmp r9,#0 149 | beq l1.3540 150 | vst1.8 {d0},[r0] 151 | l1.3540: 152 | pop {r4-r12,pc} 153 | 154 | 155 | -------------------------------------------------------------------------------- /common/ihevc_mem_fns.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_mem_fns.h 22 | * 23 | * @brief 24 | * Function declarations used for memory functions 25 | * 26 | * @author 27 | * Naveen SR 28 | * 29 | * @remarks 30 | * None 31 | * 32 | ******************************************************************************* 33 | */ 34 | #ifndef _MEM_FNS_H_ 35 | #define _MEM_FNS_H_ 36 | 37 | typedef void ihevc_memcpy_ft(UWORD8 *pu1_dst, UWORD8 *pu1_src, UWORD32 num_bytes); 38 | 39 | typedef void ihevc_memcpy_mul_8_ft(UWORD8 *pu1_dst, UWORD8 *pu1_src, UWORD32 num_bytes); 40 | /** 41 | ******************************************************************************* 42 | * 43 | * @brief 44 | * memset of a 8,16 or 32 bytes 45 | * 46 | * @par Description: 47 | * Does memset of 8bit data for 8,16 or 32 number of bytes 48 | * 49 | * @param[in] pu1_dst 50 | * UWORD8 pointer to the destination 51 | * 52 | * @param[in] value 53 | * UWORD8 value used for memset 54 | * 55 | * @param[in] num_bytes 56 | * number of bytes to set 57 | * @returns 58 | * 59 | * @remarks 60 | * None 61 | * 62 | ******************************************************************************* 63 | */ 64 | typedef void ihevc_memset_ft(UWORD8 *pu1_dst, UWORD8 value, UWORD32 num_bytes); 65 | 66 | typedef void ihevc_memset_mul_8_ft(UWORD8 *pu1_dst, UWORD8 value, UWORD32 num_bytes); 67 | 68 | /** 69 | ******************************************************************************* 70 | * 71 | * @brief 72 | * memset of 16bit data of a 8,16 or 32 bytes 73 | * 74 | * @par Description: 75 | * Does memset of 16bit data for 8,16 or 32 number of bytes 76 | * 77 | * @param[in] pu2_dst 78 | * UWORD8 pointer to the destination 79 | * 80 | * @param[in] value 81 | * UWORD16 value used for memset 82 | * 83 | * @param[in] num_words 84 | * number of words to set 85 | * @returns 86 | * 87 | * @remarks 88 | * None 89 | * 90 | ******************************************************************************* 91 | */ 92 | typedef void ihevc_memset_16bit_ft(UWORD16 *pu2_dst, UWORD16 value, UWORD32 num_words); 93 | 94 | typedef void ihevc_memset_16bit_mul_8_ft(UWORD16 *pu2_dst, UWORD16 value, UWORD32 num_words); 95 | 96 | /* C function declarations */ 97 | ihevc_memcpy_ft ihevc_memcpy; 98 | ihevc_memcpy_mul_8_ft ihevc_memcpy_mul_8; 99 | ihevc_memset_ft ihevc_memset; 100 | ihevc_memset_mul_8_ft ihevc_memset_mul_8; 101 | ihevc_memset_16bit_ft ihevc_memset_16bit; 102 | ihevc_memset_16bit_mul_8_ft ihevc_memset_16bit_mul_8; 103 | 104 | /* A9 Q function declarations */ 105 | ihevc_memcpy_ft ihevc_memcpy_a9q; 106 | ihevc_memcpy_mul_8_ft ihevc_memcpy_mul_8_a9q; 107 | ihevc_memset_ft ihevc_memset_a9q; 108 | ihevc_memset_mul_8_ft ihevc_memset_mul_8_a9q; 109 | ihevc_memset_16bit_ft ihevc_memset_16bit_a9q; 110 | ihevc_memset_16bit_mul_8_ft ihevc_memset_16bit_mul_8_a9q; 111 | 112 | /* A9 A function declarations */ 113 | ihevc_memcpy_ft ihevc_memcpy_a9a; 114 | ihevc_memcpy_mul_8_ft ihevc_memcpy_mul_8_a9a; 115 | ihevc_memset_ft ihevc_memset_a9a; 116 | ihevc_memset_mul_8_ft ihevc_memset_mul_8_a9a; 117 | ihevc_memset_16bit_ft ihevc_memset_16bit_a9a; 118 | ihevc_memset_16bit_mul_8_ft ihevc_memset_16bit_mul_8_a9a; 119 | 120 | /* SSSE3 function declarations */ 121 | ihevc_memcpy_mul_8_ft ihevc_memcpy_mul_8_ssse3; 122 | ihevc_memset_mul_8_ft ihevc_memset_mul_8_ssse3; 123 | ihevc_memset_16bit_mul_8_ft ihevc_memset_16bit_mul_8_ssse3; 124 | 125 | /* armv8 function declarations */ 126 | ihevc_memcpy_ft ihevc_memcpy_av8; 127 | ihevc_memcpy_mul_8_ft ihevc_memcpy_mul_8_av8; 128 | ihevc_memset_ft ihevc_memset_av8; 129 | ihevc_memset_mul_8_ft ihevc_memset_mul_8_av8; 130 | ihevc_memset_16bit_ft ihevc_memset_16bit_av8; 131 | ihevc_memset_16bit_mul_8_ft ihevc_memset_16bit_mul_8_av8; 132 | #endif //_MEM_FNS_H_ 133 | -------------------------------------------------------------------------------- /decoder/ihevcd_version.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_version.c 22 | * 23 | * @brief 24 | * Contains version info for HEVC decoder 25 | * 26 | * @author 27 | * Harish 28 | * 29 | * @par List of Functions: 30 | * - ihevcd_get_version() 31 | * 32 | * @remarks 33 | * None 34 | * 35 | ******************************************************************************* 36 | */ 37 | /*****************************************************************************/ 38 | /* File Includes */ 39 | /*****************************************************************************/ 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #include "ihevc_typedefs.h" 46 | #include "iv.h" 47 | #include "ivd.h" 48 | #include "ihevcd_cxa.h" 49 | 50 | #include "ihevc_defs.h" 51 | #include "ihevc_debug.h" 52 | #include "ihevc_structs.h" 53 | /** 54 | * Name of the codec 55 | */ 56 | #define CODEC_NAME "HEVCDEC" 57 | /** 58 | * Codec release type, production or evaluation 59 | */ 60 | #define CODEC_RELEASE_TYPE "production" 61 | /** 62 | * Version string. First two digits signify major version and last two minor 63 | * Increment major version for API change or major feature update 64 | */ 65 | #define CODEC_RELEASE_VER "05.00" 66 | /** 67 | * Vendor name 68 | */ 69 | #define CODEC_VENDOR "ITTIAM" 70 | 71 | /** 72 | ******************************************************************************* 73 | * Concatenates various strings to form a version string 74 | ******************************************************************************* 75 | */ 76 | #define MAXVERSION_STRLEN 511 77 | #ifdef __ANDROID__ 78 | #define VERSION(version_string, codec_name, codec_release_type, codec_release_ver, codec_vendor) \ 79 | snprintf(version_string, MAXVERSION_STRLEN, \ 80 | "@(#)Id:%s_%s Ver:%s Released by %s", \ 81 | codec_name, codec_release_type, codec_release_ver, codec_vendor) 82 | #else 83 | #define VERSION(version_string, codec_name, codec_release_type, codec_release_ver, codec_vendor) \ 84 | snprintf(version_string, MAXVERSION_STRLEN, \ 85 | "@(#)Id:%s_%s Ver:%s Released by %s Build: %s @ %s", \ 86 | codec_name, codec_release_type, codec_release_ver, codec_vendor, __DATE__, __TIME__) 87 | #endif 88 | 89 | /** 90 | ******************************************************************************* 91 | * 92 | * @brief 93 | * Fills the version info in the given string 94 | * 95 | * @par Description: 96 | * 97 | * 98 | * @param[in] pc_version_string 99 | * Pointer to hold version info 100 | * 101 | * @param[in] u4_version_buffer_size 102 | * Size of the buffer passed 103 | * 104 | * @returns Status 105 | * 106 | * @remarks 107 | * 108 | * 109 | ******************************************************************************* 110 | */ 111 | IV_API_CALL_STATUS_T ihevcd_get_version(CHAR *pc_version_string, 112 | UWORD32 u4_version_buffer_size) 113 | { 114 | CHAR ac_version_tmp[MAXVERSION_STRLEN + 1]; 115 | UWORD32 u4_len; 116 | VERSION(ac_version_tmp, CODEC_NAME, CODEC_RELEASE_TYPE, CODEC_RELEASE_VER, CODEC_VENDOR); 117 | u4_len = strnlen(ac_version_tmp, MAXVERSION_STRLEN) + 1; 118 | if(u4_version_buffer_size >= u4_len) 119 | { 120 | memcpy(pc_version_string, ac_version_tmp, u4_len); 121 | return IV_SUCCESS; 122 | } 123 | else 124 | { 125 | return IV_FAIL; 126 | } 127 | 128 | } 129 | 130 | 131 | -------------------------------------------------------------------------------- /common/ihevc_mem_fns.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_mem_fns.c 22 | * 23 | * @brief 24 | * Functions used for memory operations 25 | * 26 | * @author 27 | * Ittiam 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | 37 | /*****************************************************************************/ 38 | /* File Includes */ 39 | /*****************************************************************************/ 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | 46 | #include "ihevc_typedefs.h" 47 | #include "ihevc_func_selector.h" 48 | #include "ihevc_mem_fns.h" 49 | 50 | /** 51 | ******************************************************************************* 52 | * 53 | * @brief 54 | * memcpy of a 8,16 or 32 bytes 55 | * 56 | * @par Description: 57 | * Does memcpy of 8bit data from source to destination for 8,16 or 32 number of bytes 58 | * 59 | * @param[in] pu1_dst 60 | * UWORD8 pointer to the destination 61 | * 62 | * @param[in] pu1_src 63 | * UWORD8 pointer to the source 64 | * 65 | * @param[in] num_bytes 66 | * number of bytes to copy 67 | * @returns 68 | * 69 | * @remarks 70 | * None 71 | * 72 | ******************************************************************************* 73 | */ 74 | 75 | void ihevc_memcpy(UWORD8 *pu1_dst, UWORD8 *pu1_src, UWORD32 num_bytes) 76 | { 77 | memcpy(pu1_dst, pu1_src, num_bytes); 78 | } 79 | 80 | 81 | void ihevc_memcpy_mul_8(UWORD8 *pu1_dst, UWORD8 *pu1_src, UWORD32 num_bytes) 82 | { 83 | memcpy(pu1_dst, pu1_src, num_bytes); 84 | } 85 | 86 | /** 87 | ******************************************************************************* 88 | * 89 | * @brief 90 | * memset of a 8,16 or 32 bytes 91 | * 92 | * @par Description: 93 | * Does memset of 8bit data for 8,16 or 32 number of bytes 94 | * 95 | * @param[in] pu1_dst 96 | * UWORD8 pointer to the destination 97 | * 98 | * @param[in] value 99 | * UWORD8 value used for memset 100 | * 101 | * @param[in] num_bytes 102 | * number of bytes to set 103 | * @returns 104 | * 105 | * @remarks 106 | * None 107 | * 108 | ******************************************************************************* 109 | */ 110 | 111 | void ihevc_memset(UWORD8 *pu1_dst, UWORD8 value, UWORD32 num_bytes) 112 | { 113 | memset(pu1_dst, value, num_bytes); 114 | } 115 | 116 | 117 | void ihevc_memset_mul_8(UWORD8 *pu1_dst, UWORD8 value, UWORD32 num_bytes) 118 | { 119 | memset(pu1_dst, value, num_bytes); 120 | } 121 | 122 | /** 123 | ******************************************************************************* 124 | * 125 | * @brief 126 | * memset of 16bit data of a 8,16 or 32 bytes 127 | * 128 | * @par Description: 129 | * Does memset of 16bit data for 8,16 or 32 number of bytes 130 | * 131 | * @param[in] pu2_dst 132 | * UWORD8 pointer to the destination 133 | * 134 | * @param[in] value 135 | * UWORD16 value used for memset 136 | * 137 | * @param[in] num_words 138 | * number of words to set 139 | * @returns 140 | * 141 | * @remarks 142 | * None 143 | * 144 | ******************************************************************************* 145 | */ 146 | 147 | void ihevc_memset_16bit(UWORD16 *pu2_dst, UWORD16 value, UWORD32 num_words) 148 | { 149 | UWORD32 i; 150 | for(i = 0; i < num_words; i++) 151 | { 152 | *pu2_dst++ = value; 153 | } 154 | } 155 | 156 | 157 | 158 | void ihevc_memset_16bit_mul_8(UWORD16 *pu2_dst, UWORD16 value, UWORD32 num_words) 159 | { 160 | UWORD32 i; 161 | for(i = 0; i < num_words; i++) 162 | { 163 | *pu2_dst++ = value; 164 | } 165 | } 166 | 167 | -------------------------------------------------------------------------------- /common/ihevc_chroma_recon.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_chroma_recon.h 22 | * 23 | * @brief 24 | * Functions declarations reconstruction of chroma interleaved data. 25 | * 26 | * @author 27 | * Ittiam 28 | * 29 | * @par List of Functions: 30 | * - ihevc_chroma_recon_4x4_ttype1() 31 | * - ihevc_chroma_recon_4x4() 32 | * - ihevc_chroma_recon_8x8() 33 | * - ihevc_chroma_recon_16x16() 34 | * - ihevc_chroma_recon_32x32() 35 | * 36 | * @remarks 37 | * None 38 | * 39 | ******************************************************************************* 40 | */ 41 | 42 | 43 | #ifndef _IHEVC_CHROMA_RECON_H_ 44 | #define _IHEVC_CHROMA_RECON_H_ 45 | 46 | typedef void ihevc_chroma_recon_4x4_ft(WORD16 *pi2_src, 47 | UWORD8 *pu1_pred, 48 | UWORD8 *pu1_dst, 49 | WORD32 src_strd, 50 | WORD32 pred_strd, 51 | WORD32 dst_strd, 52 | WORD32 zero_cols); 53 | typedef void ihevc_hbd_chroma_recon_4x4_ft(WORD16 *pi2_src, 54 | UWORD16 *pu2_pred, 55 | UWORD16 *pu2_dst, 56 | WORD32 src_strd, 57 | WORD32 pred_strd, 58 | WORD32 dst_strd, 59 | WORD32 zero_cols, 60 | UWORD8 bit_depth); 61 | typedef void ihevc_chroma_recon_8x8_ft(WORD16 *pi2_src, 62 | UWORD8 *pu1_pred, 63 | UWORD8 *pu1_dst, 64 | WORD32 src_strd, 65 | WORD32 pred_strd, 66 | WORD32 dst_strd, 67 | WORD32 zero_cols); 68 | typedef void ihevc_hbd_chroma_recon_8x8_ft(WORD16 *pi2_src, 69 | UWORD16 *pu2_pred, 70 | UWORD16 *pu2_dst, 71 | WORD32 src_strd, 72 | WORD32 pred_strd, 73 | WORD32 dst_strd, 74 | WORD32 zero_cols, 75 | UWORD8 bit_depth); 76 | typedef void ihevc_chroma_recon_16x16_ft(WORD16 *pi2_src, 77 | UWORD8 *pu1_pred, 78 | UWORD8 *pu1_dst, 79 | WORD32 src_strd, 80 | WORD32 pred_strd, 81 | WORD32 dst_strd, 82 | WORD32 zero_cols); 83 | typedef void ihevc_hbd_chroma_recon_16x16_ft(WORD16 *pi2_src, 84 | UWORD16 *pu2_pred, 85 | UWORD16 *pu2_dst, 86 | WORD32 src_strd, 87 | WORD32 pred_strd, 88 | WORD32 dst_strd, 89 | WORD32 zero_cols, 90 | UWORD8 bit_depth); 91 | 92 | ihevc_chroma_recon_4x4_ft ihevc_chroma_recon_4x4; 93 | ihevc_hbd_chroma_recon_4x4_ft ihevc_hbd_chroma_recon_4x4; 94 | ihevc_chroma_recon_8x8_ft ihevc_chroma_recon_8x8; 95 | ihevc_hbd_chroma_recon_8x8_ft ihevc_hbd_chroma_recon_8x8; 96 | ihevc_chroma_recon_16x16_ft ihevc_chroma_recon_16x16; 97 | ihevc_hbd_chroma_recon_16x16_ft ihevc_hbd_chroma_recon_16x16; 98 | 99 | #endif /*_IHEVC_CHROMA_RECON_H_*/ 100 | -------------------------------------------------------------------------------- /common/ihevc_itrans.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_itrans.h 22 | * 23 | * @brief 24 | * Functions declarations for inverse transform 25 | * 26 | * @author 27 | * Ittiam 28 | * 29 | * @remarks 30 | * None 31 | * 32 | ******************************************************************************* 33 | */ 34 | #ifndef _IHEVC_ITRANS_H_ 35 | #define _IHEVC_ITRANS_H_ 36 | 37 | typedef void ihevc_itrans_4x4_ttype1_ft(WORD16 *pi2_src, 38 | WORD16 *pi2_dst, 39 | WORD32 i4_src_strd, 40 | WORD32 i4_dst_strd, 41 | WORD32 i4_shift, 42 | WORD32 i4_zero_cols); 43 | typedef void ihevc_itrans_4x4_ft(WORD16 *pi2_src, 44 | WORD16 *pi2_dst, 45 | WORD32 i4_src_strd, 46 | WORD32 i4_dst_strd, 47 | WORD32 i4_shift, 48 | WORD32 i4_zero_cols); 49 | typedef void ihevc_itrans_8x8_ft(WORD16 *pi2_src, 50 | WORD16 *pi2_dst, 51 | WORD32 i4_src_strd, 52 | WORD32 i4_dst_strd, 53 | WORD32 i4_shift, 54 | WORD32 i4_zero_cols); 55 | typedef void ihevc_itrans_16x16_ft(WORD16 *pi2_src, 56 | WORD16 *pi2_dst, 57 | WORD32 i4_src_strd, 58 | WORD32 i4_dst_strd, 59 | WORD32 i4_shift, 60 | WORD32 i4_zero_cols); 61 | typedef void ihevc_itrans_32x32_ft(WORD16 *pi2_src, 62 | WORD16 *pi2_dst, 63 | WORD32 i4_src_strd, 64 | WORD32 i4_dst_strd, 65 | WORD32 i4_shift, 66 | WORD32 i4_zero_cols); 67 | 68 | /* C function declarations */ 69 | ihevc_itrans_4x4_ttype1_ft ihevc_itrans_4x4_ttype1; 70 | ihevc_itrans_4x4_ft ihevc_itrans_4x4; 71 | ihevc_itrans_8x8_ft ihevc_itrans_8x8; 72 | ihevc_itrans_16x16_ft ihevc_itrans_16x16; 73 | ihevc_itrans_32x32_ft ihevc_itrans_32x32; 74 | 75 | /* A9 Q function declarations */ 76 | ihevc_itrans_4x4_ttype1_ft ihevc_itrans_4x4_ttype1_a9q; 77 | ihevc_itrans_4x4_ft ihevc_itrans_4x4_a9q; 78 | ihevc_itrans_8x8_ft ihevc_itrans_8x8_a9q; 79 | ihevc_itrans_16x16_ft ihevc_itrans_16x16_a9q; 80 | ihevc_itrans_32x32_ft ihevc_itrans_32x32_a9q; 81 | 82 | /* A9 Q function declarations */ 83 | ihevc_itrans_4x4_ttype1_ft ihevc_itrans_4x4_ttype1_neonintr; 84 | ihevc_itrans_4x4_ft ihevc_itrans_4x4_neonintr; 85 | ihevc_itrans_8x8_ft ihevc_itrans_8x8_neonintr; 86 | ihevc_itrans_16x16_ft ihevc_itrans_16x16_neonintr; 87 | ihevc_itrans_32x32_ft ihevc_itrans_32x32_neonintr; 88 | 89 | /* SSSE3 function declarations */ 90 | ihevc_itrans_4x4_ttype1_ft ihevc_itrans_4x4_ttype1_ssse3; 91 | ihevc_itrans_4x4_ft ihevc_itrans_4x4_ssse3; 92 | ihevc_itrans_8x8_ft ihevc_itrans_8x8_ssse3; 93 | ihevc_itrans_16x16_ft ihevc_itrans_16x16_ssse3; 94 | ihevc_itrans_32x32_ft ihevc_itrans_32x32_ssse3; 95 | 96 | /* SSE4.2 function declarations */ 97 | ihevc_itrans_4x4_ttype1_ft ihevc_itrans_4x4_ttype1_sse42; 98 | ihevc_itrans_4x4_ft ihevc_itrans_4x4_sse42; 99 | ihevc_itrans_8x8_ft ihevc_itrans_8x8_sse42; 100 | ihevc_itrans_16x16_ft ihevc_itrans_16x16_sse42; 101 | ihevc_itrans_32x32_ft ihevc_itrans_32x32_sse42; 102 | 103 | /* armv8 function declarations */ 104 | ihevc_itrans_4x4_ttype1_ft ihevc_itrans_4x4_ttype1_av8; 105 | ihevc_itrans_4x4_ft ihevc_itrans_4x4_av8; 106 | ihevc_itrans_8x8_ft ihevc_itrans_8x8_av8; 107 | ihevc_itrans_16x16_ft ihevc_itrans_16x16_av8; 108 | ihevc_itrans_32x32_ft ihevc_itrans_32x32_av8; 109 | #endif /*_IHEVC_ITRANS_H_*/ 110 | -------------------------------------------------------------------------------- /decoder/ihevcd_mv_merge.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevce_mv_merge.h 22 | * 23 | * @brief 24 | * This file contains function prototypes of MV Merge candidates list 25 | * derivation functions and corresponding structure and macrso definations 26 | * 27 | * @author 28 | * Harish 29 | * 30 | * @par List of Functions: 31 | * 32 | * @remarks 33 | * None 34 | * 35 | ******************************************************************************* 36 | */ 37 | 38 | #ifndef _IHEVCD_MV_MERGE_H_ 39 | #define _IHEVCD_MV_MERGE_H_ 40 | 41 | /*****************************************************************************/ 42 | /* Constant Macros */ 43 | /*****************************************************************************/ 44 | 45 | #define MAX_NUM_MV_NBR 5 46 | 47 | /*****************************************************************************/ 48 | /* Function Macros */ 49 | /*****************************************************************************/ 50 | 51 | /*****************************************************************************/ 52 | /* Typedefs */ 53 | /*****************************************************************************/ 54 | 55 | /*****************************************************************************/ 56 | /* Enums */ 57 | /*****************************************************************************/ 58 | typedef enum 59 | { 60 | NBR_A0 = 0, 61 | NBR_A1 = 1, 62 | NBR_B0 = 2, 63 | NBR_B1 = 3, 64 | NBR_B2 = 4, 65 | 66 | /* should be last */ 67 | MAX_NUM_NBRS 68 | }MV_MERGE_NBRS_T; 69 | 70 | /*****************************************************************************/ 71 | /* Structure */ 72 | /*****************************************************************************/ 73 | 74 | /*****************************************************************************/ 75 | /* Extern Variable Declarations */ 76 | /*****************************************************************************/ 77 | 78 | /*****************************************************************************/ 79 | /* Extern Function Declarations */ 80 | /*****************************************************************************/ 81 | void ihevcd_mv_merge(mv_ctxt_t *ps_mv_ctxt, 82 | UWORD32 *pu4_top_pu_idx, 83 | UWORD32 *pu4_left_pu_idx, 84 | WORD32 left_nbr_4x4_strd, 85 | pu_t *ps_pu, 86 | WORD32 part_mode, 87 | WORD32 part_idx, 88 | WORD32 part_wd, 89 | WORD32 part_ht, 90 | WORD32 part_pos_x, 91 | WORD32 part_pos_y, 92 | WORD32 single_mcl_flag, 93 | WORD32 lb_avail, 94 | WORD32 l_avail, 95 | WORD32 tr_avail, 96 | WORD32 t_avail, 97 | WORD32 tl_avail); 98 | void ihevcd_collocated_mvp(mv_ctxt_t *ps_mv_ctxt, 99 | pu_t *ps_pu, 100 | mv_t *ps_mv_col, 101 | WORD32 *pu4_avail_col_flag, 102 | WORD32 use_pu_ref_idx, 103 | WORD32 x_col, 104 | WORD32 y_col); 105 | 106 | void ihevcd_scale_collocated_mv(mv_t *ps_mv, 107 | WORD32 cur_ref_poc, 108 | WORD32 col_ref_poc, 109 | WORD32 col_poc, 110 | WORD32 cur_poc); 111 | #endif /* _IHEVCD_MV_MERGE_H_ */ 112 | -------------------------------------------------------------------------------- /common/x86/ihevc_mem_fns_ssse3_intr.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_mem_fns_atom_intr.c 22 | * 23 | * @brief 24 | * Functions used for memory operations 25 | * 26 | * @author 27 | * Ittiam 28 | * 29 | * @par List of Functions: 30 | * 31 | * @remarks 32 | * None 33 | * 34 | ******************************************************************************* 35 | */ 36 | 37 | /*****************************************************************************/ 38 | /* File Includes */ 39 | /*****************************************************************************/ 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | 46 | #include "ihevc_typedefs.h" 47 | #include "ihevc_func_selector.h" 48 | #include "ihevc_mem_fns.h" 49 | 50 | #include 51 | 52 | /** 53 | ******************************************************************************* 54 | * 55 | * @brief 56 | * memcpy of a 8,16 or 32 bytes 57 | * 58 | * @par Description: 59 | * Does memcpy of 8bit data from source to destination for 8,16 or 32 number of bytes 60 | * 61 | * @param[in] pu1_dst 62 | * UWORD8 pointer to the destination 63 | * 64 | * @param[in] pu1_src 65 | * UWORD8 pointer to the source 66 | * 67 | * @param[in] num_bytes 68 | * number of bytes to copy 69 | * @returns 70 | * 71 | * @remarks 72 | * None 73 | * 74 | ******************************************************************************* 75 | */ 76 | 77 | 78 | 79 | 80 | void ihevc_memcpy_mul_8_ssse3(UWORD8 *pu1_dst, UWORD8 *pu1_src, UWORD32 num_bytes) 81 | { 82 | int col; 83 | for(col = num_bytes; col >= 8; col -= 8) 84 | { 85 | __m128i src_temp16x8b; 86 | src_temp16x8b = _mm_loadl_epi64((__m128i *)(pu1_src)); 87 | pu1_src += 8; 88 | _mm_storel_epi64((__m128i *)(pu1_dst), src_temp16x8b); 89 | pu1_dst += 8; 90 | } 91 | } 92 | 93 | /** 94 | ******************************************************************************* 95 | * 96 | * @brief 97 | * memset of a 8,16 or 32 bytes 98 | * 99 | * @par Description: 100 | * Does memset of 8bit data for 8,16 or 32 number of bytes 101 | * 102 | * @param[in] pu1_dst 103 | * UWORD8 pointer to the destination 104 | * 105 | * @param[in] value 106 | * UWORD8 value used for memset 107 | * 108 | * @param[in] num_bytes 109 | * number of bytes to set 110 | * @returns 111 | * 112 | * @remarks 113 | * None 114 | * 115 | ******************************************************************************* 116 | */ 117 | 118 | 119 | void ihevc_memset_mul_8_ssse3(UWORD8 *pu1_dst, UWORD8 value, UWORD32 num_bytes) 120 | { 121 | int col; 122 | __m128i src_temp16x8b; 123 | src_temp16x8b = _mm_set1_epi8(value); 124 | for(col = num_bytes; col >= 8; col -= 8) 125 | { 126 | _mm_storel_epi64((__m128i *)(pu1_dst), src_temp16x8b); 127 | pu1_dst += 8; 128 | } 129 | } 130 | 131 | /** 132 | ******************************************************************************* 133 | * 134 | * @brief 135 | * memset of 16bit data of a 8,16 or 32 bytes 136 | * 137 | * @par Description: 138 | * Does memset of 16bit data for 8,16 or 32 number of bytes 139 | * 140 | * @param[in] pu2_dst 141 | * UWORD8 pointer to the destination 142 | * 143 | * @param[in] value 144 | * UWORD16 value used for memset 145 | * 146 | * @param[in] num_words 147 | * number of words to set 148 | * @returns 149 | * 150 | * @remarks 151 | * None 152 | * 153 | ******************************************************************************* 154 | */ 155 | 156 | 157 | void ihevc_memset_16bit_mul_8_ssse3(UWORD16 *pu2_dst, UWORD16 value, UWORD32 num_words) 158 | { 159 | int col; 160 | __m128i src_temp16x8b; 161 | src_temp16x8b = _mm_set1_epi16(value); 162 | for(col = num_words; col >= 8; col -= 8) 163 | { 164 | _mm_storeu_si128((__m128i *)(pu2_dst), src_temp16x8b); 165 | pu2_dst += 8; 166 | } 167 | } 168 | 169 | -------------------------------------------------------------------------------- /common/arm/ihevc_deblk_chroma_vert.s: -------------------------------------------------------------------------------- 1 | @/***************************************************************************** 2 | @* 3 | @* Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | @/** 19 | @/******************************************************************************* 20 | @* @file 21 | @* ihevc_deblk_luma_vert.s 22 | @* 23 | @* @brief 24 | @* contains function definitions for inter prediction interpolation. 25 | @* functions are coded using neon intrinsics and can be compiled using 26 | 27 | @* rvct 28 | @* 29 | @* @author 30 | @* anand s 31 | @* 32 | @* @par list of functions: 33 | @* 34 | @* 35 | @* @remarks 36 | @* none 37 | @* 38 | @*******************************************************************************/ 39 | 40 | .equ qp_offset_u_offset, 40 41 | .equ qp_offset_v_offset, 44 42 | .equ tc_offset_div2_offset, 48 43 | .equ filter_p_offset, 52 44 | .equ filter_q_offset, 56 45 | 46 | .text 47 | .align 4 48 | 49 | 50 | 51 | 52 | 53 | .extern gai4_ihevc_qp_table 54 | .extern gai4_ihevc_tc_table 55 | .globl ihevc_deblk_chroma_vert_a9q 56 | 57 | gai4_ihevc_qp_table_addr: 58 | .long gai4_ihevc_qp_table - ulbl1 - 8 59 | 60 | gai4_ihevc_tc_table_addr: 61 | .long gai4_ihevc_tc_table - ulbl2 - 8 62 | 63 | .type ihevc_deblk_chroma_vert_a9q, %function 64 | 65 | ihevc_deblk_chroma_vert_a9q: 66 | push {r4-r12,lr} 67 | sub r8,r0,#4 68 | add r2,r2,r3 69 | vld1.8 {d5},[r8],r1 70 | add r2,r2,#1 71 | vld1.8 {d17},[r8],r1 72 | ldr r7,[sp,#qp_offset_u_offset] 73 | vld1.8 {d16},[r8],r1 74 | ldr r4,[sp,#filter_q_offset] 75 | vld1.8 {d4},[r8] 76 | ldr r5,[sp,#tc_offset_div2_offset] 77 | vtrn.8 d5,d17 78 | adds r3,r7,r2,asr #1 79 | vtrn.8 d16,d4 80 | ldr r7,gai4_ihevc_qp_table_addr 81 | ulbl1: 82 | add r7,r7,pc 83 | ldr r12,[sp,#filter_p_offset] 84 | ldr r6,[sp,#qp_offset_v_offset] 85 | bmi l1.2944 86 | cmp r3,#0x39 87 | ldrle r3,[r7,r3,lsl #2] 88 | subgt r3,r3,#6 89 | l1.2944: 90 | vtrn.16 d5,d16 91 | adds r2,r6,r2,asr #1 92 | vtrn.16 d17,d4 93 | bmi l1.2964 94 | cmp r2,#0x39 95 | ldrle r2,[r7,r2,lsl #2] 96 | subgt r2,r2,#6 97 | l1.2964: 98 | vtrn.32 d5,d17 99 | add r3,r3,r5,lsl #1 100 | vtrn.32 d16,d4 101 | add r6,r3,#2 102 | vmovl.u8 q9,d17 103 | cmp r6,#0x35 104 | movgt r3,#0x35 105 | bgt l1.2996 106 | adds r6,r3,#2 107 | addpl r3,r3,#2 108 | movmi r3,#0 109 | l1.2996: 110 | vsubl.u8 q0,d17,d16 111 | ldr r6,gai4_ihevc_tc_table_addr 112 | ulbl2: 113 | add r6,r6,pc 114 | vshl.i16 q0,q0,#2 115 | add r2,r2,r5,lsl #1 116 | add r5,r2,#2 117 | vaddw.u8 q0,q0,d5 118 | cmp r5,#0x35 119 | ldr r3,[r6,r3,lsl #2] 120 | vsubw.u8 q2,q0,d4 121 | movgt r2,#0x35 122 | bgt l1.3036 123 | adds r5,r2,#2 124 | addpl r2,r2,#2 125 | movmi r2,#0 126 | l1.3036: 127 | 128 | 129 | vrshr.s16 q3,q2,#3 130 | vdup.16 d2,r3 131 | ldr r2,[r6,r2,lsl #2] 132 | rsb r3,r3,#0 133 | cmp r12,#0 134 | vdup.16 d3,r2 135 | rsb r2,r2,#0 136 | vdup.16 d30,r3 137 | vdup.16 d31,r2 138 | 139 | 140 | vmin.s16 q2,q3,q1 141 | vmax.s16 q1,q15,q2 142 | 143 | vmovl.u8 q3,d16 144 | 145 | vadd.i16 q0,q3,q1 146 | vsub.i16 q1,q9,q1 147 | vqmovun.s16 d0,q0 148 | sub r2,r0,#2 149 | vqmovun.s16 d1,q1 150 | vtrn.32 d0,d1 151 | vtrn.8 d0,d1 152 | beq l1.3204 153 | 154 | vst1.16 {d0[0]},[r2],r1 155 | vst1.16 {d1[0]},[r2],r1 156 | vst1.16 {d0[1]},[r2],r1 157 | vst1.16 {d1[1]},[r2] 158 | l1.3204: 159 | cmp r4,#0 160 | beq l1.3228 161 | vst1.16 {d0[2]},[r0],r1 162 | vst1.16 {d1[2]},[r0],r1 163 | vst1.16 {d0[3]},[r0],r1 164 | vst1.16 {d1[3]},[r0] 165 | l1.3228: 166 | pop {r4-r12,pc} 167 | 168 | 169 | 170 | -------------------------------------------------------------------------------- /decoder/ihevcd_itrans_recon_dc.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevcd_itrans_recon_dc.c 22 | * 23 | * @brief 24 | * Contains functions for DC inverse transform and reconstruction 25 | * 26 | * @author 27 | * Ittiam 28 | * 29 | * @par List of Functions: 30 | * - ihevcd_itrans_recon_dc_luma() 31 | * - ihevcd_itrans_recon_dc_chroma() 32 | * 33 | * @remarks 34 | * None 35 | * 36 | ******************************************************************************* 37 | */ 38 | /*****************************************************************************/ 39 | /* File Includes */ 40 | /*****************************************************************************/ 41 | #include 42 | #include 43 | #include 44 | #include 45 | 46 | #include "ihevc_typedefs.h" 47 | #include "iv.h" 48 | #include "ivd.h" 49 | #include "ihevcd_cxa.h" 50 | 51 | #include "ihevc_defs.h" 52 | #include "ihevc_debug.h" 53 | #include "ihevc_structs.h" 54 | #include "ihevc_cabac_tables.h" 55 | #include "ihevc_macros.h" 56 | #include "ihevc_platform_macros.h" 57 | 58 | #include "ihevcd_defs.h" 59 | #include "ihevcd_function_selector.h" 60 | #include "ihevcd_structs.h" 61 | #include "ihevcd_error.h" 62 | #include "ihevcd_bitstream.h" 63 | #include "ihevc_common_tables.h" 64 | 65 | /* Intra pred includes */ 66 | #include "ihevc_intra_pred.h" 67 | 68 | /* Inverse transform common module includes */ 69 | #include "ihevc_trans_tables.h" 70 | #include "ihevc_trans_macros.h" 71 | #include "ihevc_itrans_recon.h" 72 | #include "ihevc_recon.h" 73 | #include "ihevc_chroma_itrans_recon.h" 74 | #include "ihevc_chroma_recon.h" 75 | 76 | /* Decoder includes */ 77 | #include "ihevcd_common_tables.h" 78 | #include "ihevcd_iquant_itrans_recon_ctb.h" 79 | #include "ihevcd_debug.h" 80 | #include "ihevcd_profile.h" 81 | #include "ihevcd_statistics.h" 82 | #include "ihevcd_itrans_recon_dc.h" 83 | 84 | 85 | 86 | void ihevcd_itrans_recon_dc_luma(UWORD8 *pu1_pred, 87 | UWORD8 *pu1_dst, 88 | WORD32 pred_strd, 89 | WORD32 dst_strd, 90 | WORD32 log2_trans_size, 91 | WORD16 i2_coeff_value) 92 | { 93 | WORD32 row, col; 94 | WORD32 add, shift; 95 | WORD32 dc_value, quant_out; 96 | WORD32 trans_size; 97 | 98 | trans_size = (1 << log2_trans_size); 99 | 100 | quant_out = i2_coeff_value; 101 | 102 | shift = IT_SHIFT_STAGE_1; 103 | add = 1 << (shift - 1); 104 | dc_value = CLIP_S16((quant_out * 64 + add) >> shift); 105 | shift = IT_SHIFT_STAGE_2; 106 | add = 1 << (shift - 1); 107 | dc_value = CLIP_S16((dc_value * 64 + add) >> shift); 108 | 109 | for(row = 0; row < trans_size; row++) 110 | for(col = 0; col < trans_size; col++) 111 | pu1_dst[row * dst_strd + col] = CLIP_U8((pu1_pred[row * pred_strd + col] + dc_value)); 112 | 113 | } 114 | 115 | 116 | void ihevcd_itrans_recon_dc_chroma(UWORD8 *pu1_pred, 117 | UWORD8 *pu1_dst, 118 | WORD32 pred_strd, 119 | WORD32 dst_strd, 120 | WORD32 log2_trans_size, 121 | WORD16 i2_coeff_value) 122 | { 123 | WORD32 row, col; 124 | WORD32 add, shift; 125 | WORD32 dc_value, quant_out; 126 | WORD32 trans_size; 127 | 128 | 129 | trans_size = (1 << log2_trans_size); 130 | 131 | quant_out = i2_coeff_value; 132 | 133 | shift = IT_SHIFT_STAGE_1; 134 | add = 1 << (shift - 1); 135 | dc_value = CLIP_S16((quant_out * 64 + add) >> shift); 136 | shift = IT_SHIFT_STAGE_2; 137 | add = 1 << (shift - 1); 138 | dc_value = CLIP_S16((dc_value * 64 + add) >> shift); 139 | 140 | for(row = 0; row < trans_size; row++) 141 | for(col = 0; col < trans_size; col++) 142 | pu1_dst[row * dst_strd + (col << 1)] = CLIP_U8((pu1_pred[row * pred_strd + (col << 1)] + dc_value)); 143 | 144 | } 145 | 146 | 147 | -------------------------------------------------------------------------------- /decoder/ihevcd_ittiam_logo.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /*****************************************************************************/ 19 | /* */ 20 | /* File Name : ihevcd_ittiam_logo.h.h */ 21 | /* */ 22 | /* Description : This file contains all the necessary function headers*/ 23 | /* to insert ittiam logo to a yuv buffer. */ 24 | /* */ 25 | /* List of Functions : None */ 26 | /* */ 27 | /* Issues / Problems : None */ 28 | /* */ 29 | /* Revision History : */ 30 | /* */ 31 | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ 32 | /* 10 10 2005 Ittiam Draft */ 33 | /* */ 34 | /*****************************************************************************/ 35 | 36 | #ifndef LOGO_INSERT_H 37 | #define LOGO_INSERT_H 38 | 39 | //#define LOGO_EN 40 | 41 | #define LOGO_WD 90 42 | #define LOGO_HT 36 43 | 44 | #define LOGO_WD_Y LOGO_WD 45 | #define LOGO_HT_Y LOGO_HT 46 | 47 | #define LOGO_WD_RGBA8888 160 48 | #define LOGO_HT_RGBA8888 64 49 | 50 | #define LOGO_WD_RGB565 160 51 | #define LOGO_HT_RGB565 64 52 | 53 | #define LOGO_WD_444_UV LOGO_WD 54 | #define LOGO_HT_444_UV LOGO_HT 55 | 56 | 57 | #define LOGO_WD_420_UV (LOGO_WD >> 1) 58 | #define LOGO_HT_420_UV (LOGO_HT >> 1) 59 | 60 | #define LOGO_WD_420SP_UV (LOGO_WD) 61 | #define LOGO_HT_420SP_UV (LOGO_HT >> 1) 62 | 63 | #define LOGO_WD_420SP_VU (LOGO_WD) 64 | #define LOGO_HT_420SP_VU (LOGO_HT >> 1) 65 | 66 | #define LOGO_WD_422_UV (LOGO_WD >> 1) 67 | #define LOGO_HT_422_UV (LOGO_HT) 68 | 69 | #define LOGO_WD_422V_UV (LOGO_WD) 70 | #define LOGO_HT_422V_UV (LOGO_HT >> 1) 71 | 72 | #define LOGO_WD_411_UV (LOGO_WD >> 2) 73 | #define LOGO_HT_411_UV (LOGO_HT) 74 | 75 | #define LOGO_CODEC_WD 80 76 | #define LOGO_CODEC_HT 24 77 | 78 | #define LOGO_CODEC_WD_Y LOGO_CODEC_WD 79 | #define LOGO_CODEC_HT_Y LOGO_CODEC_HT 80 | 81 | 82 | #define LOGO_CODEC_WD_444_UV LOGO_CODEC_WD 83 | #define LOGO_CODEC_HT_444_UV LOGO_CODEC_HT 84 | 85 | 86 | #define LOGO_CODEC_WD_420_UV (LOGO_CODEC_WD >> 1) 87 | #define LOGO_CODEC_HT_420_UV (LOGO_CODEC_HT >> 1) 88 | 89 | #define LOGO_CODEC_WD_420SP_UV (LOGO_CODEC_WD) 90 | #define LOGO_CODEC_HT_420SP_UV (LOGO_CODEC_HT >> 1) 91 | 92 | #define LOGO_CODEC_WD_420SP_VU (LOGO_CODEC_WD) 93 | #define LOGO_CODEC_HT_420SP_VU (LOGO_CODEC_HT >> 1) 94 | 95 | #define LOGO_CODEC_WD_422_UV (LOGO_CODEC_WD >> 1) 96 | #define LOGO_CODEC_HT_422_UV (LOGO_CODEC_HT) 97 | 98 | #define LOGO_CODEC_WD_422V_UV (LOGO_CODEC_WD) 99 | #define LOGO_CODEC_HT_422V_UV (LOGO_CODEC_HT >> 1) 100 | 101 | #define LOGO_CODEC_WD_411_UV (LOGO_CODEC_WD >> 2) 102 | #define LOGO_CODEC_HT_411_UV (LOGO_CODEC_HT) 103 | 104 | 105 | 106 | 107 | #define START_X_ITT_LOGO 0 108 | #define START_Y_ITT_LOGO 0 109 | 110 | #define WD_ITT_LOGO 128 111 | #define HT_ITT_LOGO 60 112 | 113 | void ihevcd_insert_logo(UWORD8 *buf_y, UWORD8 *buf_u, UWORD8 *buf_v, 114 | UWORD32 stride, 115 | UWORD32 x_pos, 116 | UWORD32 y_pos, 117 | UWORD32 yuv_fmt, 118 | UWORD32 u4_disp_wd, 119 | UWORD32 u4_disp_ht); 120 | 121 | #ifdef LOGO_EN 122 | #define INSERT_LOGO(buf_y, buf_u, buf_v, stride, x_pos, y_pos, yuv_fmt,disp_wd,disp_ht) ihevcd_insert_logo(buf_y, buf_u, buf_v, stride, x_pos, y_pos, yuv_fmt,disp_wd,disp_ht); 123 | #else 124 | #define INSERT_LOGO(buf_y, buf_u, buf_v, stride, x_pos, y_pos, yuv_fmt,disp_wd,disp_ht) 125 | #endif 126 | 127 | #endif /* LOGO_INSERT_H */ 128 | 129 | -------------------------------------------------------------------------------- /decoder/arm/ihevcd_itrans_recon_dc_luma.s: -------------------------------------------------------------------------------- 1 | @/***************************************************************************** 2 | @* 3 | @* Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | @/** 19 | @/******************************************************************************* 20 | @* @file 21 | @* ihevcd_itrans_recon_dc_luma.s 22 | @* 23 | @* @brief 24 | @* contains function definitions itrans and recon for dc only case 25 | @* 26 | @* @author 27 | @* ittiam 28 | @* 29 | @* @par list of functions: 30 | @* 31 | @* 32 | @* @remarks 33 | @* none 34 | @* 35 | @*******************************************************************************/ 36 | 37 | .text 38 | 39 | 40 | 41 | .globl ihevcd_itrans_recon_dc_luma_a9q 42 | 43 | .type ihevcd_itrans_recon_dc_luma_a9q, %function 44 | 45 | ihevcd_itrans_recon_dc_luma_a9q: 46 | 47 | @void ihevcd_itrans_recon_dc_luma(uword8 *pu1_pred, 48 | @ uword8 *pu1_dst, 49 | @ word32 pred_strd, 50 | @ word32 dst_strd, 51 | @ word32 log2_trans_size, 52 | @ word16 i2_coeff_value) 53 | 54 | @r0:pu1_pred 55 | @r1:pu1_dest 56 | @r2:pred_strd 57 | @r3:dst_strd 58 | 59 | 60 | 61 | push {r0-r11,lr} 62 | vpush {d8-d15} 63 | ldr r4,[sp,#0x74] @loads log2_trans_size 64 | ldr r5,[sp,#0x78] @ loads i2_coeff_value 65 | mov r10,#1 66 | lsl r4,r10,r4 @ trans_size = (1 << log2_trans_size)@ 67 | mov r6,#64 @ 1 << (shift1 - 1)@ 68 | mov r7,#2048 @ 1<<(shift2-1) 69 | 70 | add r8,r6,r5,lsl #6 71 | ssat r8,#16,r8,asr #7 72 | add r5,r7,r8,lsl #6 73 | ssat r6,#16,r5,asr #12 74 | mov r9,r4 75 | mov r8,r4 76 | 77 | @ r6 has the dc_value 78 | @ r4 has the trans_size value 79 | @ r8 has the row value 80 | @ r9 has the col value 81 | vdup.s16 q0,r6 82 | cmp r4,#4 83 | beq row_loop_4 84 | 85 | 86 | row_loop: 87 | mov r9,r4 88 | 89 | 90 | col_loop: 91 | 92 | mov r7,r0 93 | vld1.8 d2,[r7],r2 94 | vld1.8 d3,[r7],r2 95 | vld1.8 d4,[r7],r2 96 | vld1.8 d5,[r7],r2 97 | 98 | vld1.8 d6,[r7],r2 99 | vld1.8 d7,[r7],r2 100 | vld1.8 d8,[r7],r2 101 | vld1.8 d9,[r7] 102 | 103 | add r0,r0,#8 104 | 105 | 106 | vaddw.u8 q15,q0,d2 107 | vaddw.u8 q14,q0,d3 108 | vaddw.u8 q13,q0,d4 109 | vaddw.u8 q12,q0,d5 110 | vaddw.u8 q11,q0,d6 111 | vaddw.u8 q10,q0,d7 112 | vaddw.u8 q9,q0,d8 113 | vaddw.u8 q8,q0,d9 114 | 115 | mov r11,r1 116 | vqmovun.s16 d2,q15 117 | vqmovun.s16 d3,q14 118 | vqmovun.s16 d4,q13 119 | vqmovun.s16 d5,q12 120 | vqmovun.s16 d6,q11 121 | vqmovun.s16 d7,q10 122 | vqmovun.s16 d8,q9 123 | vqmovun.s16 d9,q8 124 | 125 | 126 | vst1.u32 {d2},[r11],r3 127 | vst1.u32 {d3},[r11],r3 128 | vst1.u32 {d4},[r11],r3 129 | vst1.u32 {d5},[r11],r3 130 | vst1.u32 {d6},[r11],r3 131 | vst1.u32 {d7},[r11],r3 132 | vst1.u32 {d8},[r11],r3 133 | vst1.u32 {d9},[r11] 134 | 135 | add r1,r1,#8 136 | 137 | subs r9,r9,#8 138 | bgt col_loop 139 | 140 | subs r8,r8,#8 141 | 142 | add r0,r0,r2,lsl #3 143 | add r1,r1,r3,lsl #3 144 | sub r0,r0,r4 145 | sub r1,r1,r4 146 | bgt row_loop 147 | b end_loops 148 | 149 | 150 | row_loop_4: 151 | mov r9,r10 152 | 153 | 154 | col_loop_4: 155 | 156 | 157 | vld1.8 d2,[r0],r2 158 | vld1.8 d3,[r0],r2 159 | vld1.8 d4,[r0],r2 160 | vld1.8 d5,[r0] 161 | 162 | 163 | 164 | 165 | vaddw.u8 q15,q0,d2 166 | vaddw.u8 q14,q0,d3 167 | vaddw.u8 q13,q0,d4 168 | vaddw.u8 q12,q0,d5 169 | 170 | 171 | 172 | vqmovun.s16 d2,q15 173 | vqmovun.s16 d3,q14 174 | vqmovun.s16 d4,q13 175 | vqmovun.s16 d5,q12 176 | 177 | 178 | 179 | vst1.u32 {d2[0]},[r1],r3 180 | vst1.u32 {d3[0]},[r1],r3 181 | vst1.u32 {d4[0]},[r1],r3 182 | vst1.u32 {d5[0]},[r1] 183 | 184 | end_loops: 185 | vpop {d8-d15} 186 | pop {r0-r11,pc} 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /common/arm/ihevc_intra_pred_chroma_mode_18_34.s: -------------------------------------------------------------------------------- 1 | @/***************************************************************************** 2 | @* 3 | @* Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | @/** 19 | @******************************************************************************* 20 | @* @file 21 | @* ihevc_intra_pred_luma_mode_18_34_neon.s 22 | @* 23 | @* @brief 24 | @* contains function definitions for intra prediction dc filtering. 25 | @* functions are coded using neon intrinsics and can be compiled using 26 | 27 | @* rvct 28 | @* 29 | @* @author 30 | @* yogeswaran rs 31 | @* 32 | @* @par list of functions: 33 | @* 34 | @* 35 | @* @remarks 36 | @* none 37 | @* 38 | @******************************************************************************* 39 | @*/ 40 | @/** 41 | @******************************************************************************* 42 | @* 43 | @* @brief 44 | @* luma intraprediction filter for dc input 45 | @* 46 | @* @par description: 47 | @* 48 | @* @param[in] pu1_ref 49 | @* uword8 pointer to the source 50 | @* 51 | @* @param[out] pu1_dst 52 | @* uword8 pointer to the destination 53 | @* 54 | @* @param[in] src_strd 55 | @* integer source stride 56 | @* 57 | @* @param[in] dst_strd 58 | @* integer destination stride 59 | @* 60 | @* @param[in] pi1_coeff 61 | @* word8 pointer to the planar coefficients 62 | @* 63 | @* @param[in] nt 64 | @* size of tranform block 65 | @* 66 | @* @param[in] mode 67 | @* type of filtering 68 | @* 69 | @* @returns 70 | @* 71 | @* @remarks 72 | @* none 73 | @* 74 | @******************************************************************************* 75 | @*/ 76 | 77 | @void ihevc_intra_pred_chroma_mode_18_34(uword8 *pu1_ref, 78 | @ word32 src_strd, 79 | @ uword8 *pu1_dst, 80 | @ word32 dst_strd, 81 | @ word32 nt, 82 | @ word32 mode) 83 | @ 84 | @**************variables vs registers***************************************** 85 | @r0 => *pu1_ref 86 | @r1 => src_strd 87 | @r2 => *pu1_dst 88 | @r3 => dst_strd 89 | 90 | @stack contents from #104 91 | @ nt 92 | @ mode 93 | @ pi1_coeff 94 | 95 | .equ nt_offset, 104 96 | .equ mode_offset, 108 97 | 98 | .text 99 | .align 4 100 | 101 | 102 | 103 | 104 | .globl ihevc_intra_pred_chroma_mode_18_34_a9q 105 | 106 | .type ihevc_intra_pred_chroma_mode_18_34_a9q, %function 107 | 108 | ihevc_intra_pred_chroma_mode_18_34_a9q: 109 | 110 | stmfd sp!, {r4-r12, r14} @stack stores the values of the arguments 111 | vpush {d8 - d15} 112 | 113 | ldr r4,[sp,#nt_offset] 114 | ldr r5,[sp,#mode_offset] 115 | 116 | cmp r4,#4 117 | beq mode2_4 118 | 119 | mov r12,r4 120 | mov r11,r4 121 | add r0,r0,r4,lsl #2 122 | 123 | cmp r5,#0x22 124 | mov r10,r2 125 | 126 | add r0,r0,#4 127 | 128 | subne r0,r0,#4 129 | moveq r6,#2 130 | movne r6,#-2 131 | mov r8,r0 132 | 133 | 134 | kernel: 135 | 136 | 137 | vld1.8 {d0,d1},[r8],r6 138 | vst1.8 {d0,d1},[r10],r3 139 | vld1.8 {d2,d3},[r8],r6 140 | vst1.8 {d2,d3},[r10],r3 141 | vld1.8 {d4,d5},[r8],r6 142 | vst1.8 {d4,d5},[r10],r3 143 | vld1.8 {d6,d7},[r8],r6 144 | vst1.8 {d6,d7},[r10],r3 145 | vld1.8 {d8,d9},[r8],r6 146 | vst1.8 {d8,d9},[r10],r3 147 | vld1.8 {d10,d11},[r8],r6 148 | vst1.8 {d10,d11},[r10],r3 149 | vld1.8 {d12,d13},[r8],r6 150 | vst1.8 {d12,d13},[r10],r3 151 | vld1.8 {d14,d15},[r8],r6 152 | vst1.8 {d14,d15},[r10],r3 153 | 154 | subs r12,r12,#8 155 | bne kernel 156 | 157 | cmp r11,#16 158 | add r8,r0,#16 159 | add r10,r2,#16 160 | sub r11,#16 161 | mov r12,#16 162 | beq kernel 163 | b end_func 164 | 165 | mode2_4: 166 | 167 | add r0,r0,#20 168 | cmp r5,#0x22 169 | subne r0,r0,#4 170 | 171 | moveq r8,#2 172 | movne r8,#-2 173 | 174 | vld1.8 {d0},[r0],r8 175 | vst1.32 {d0},[r2],r3 176 | 177 | vld1.8 {d0},[r0],r8 178 | vst1.32 {d0},[r2],r3 179 | 180 | vld1.8 {d0},[r0],r8 181 | vst1.32 {d0},[r2],r3 182 | 183 | vld1.8 {d0},[r0],r8 184 | vst1.32 {d0},[r2],r3 185 | 186 | end_func: 187 | vpop {d8 - d15} 188 | ldmfd sp!,{r4-r12,r15} @reload the registers from sp 189 | 190 | 191 | 192 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /decoder/arm/ihevcd_itrans_recon_dc_chroma.s: -------------------------------------------------------------------------------- 1 | @/***************************************************************************** 2 | @* 3 | @* Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | @/** 19 | @/******************************************************************************* 20 | @* @file 21 | @* ihevcd_itrans_recon_dc_chroma.s 22 | @* 23 | @* @brief 24 | @* contains function definitions itrans and recon for dc only case 25 | @* 26 | @* @author 27 | @* ittiam 28 | @* 29 | @* @par list of functions: 30 | @* 31 | @* 32 | @* @remarks 33 | @* none 34 | @* 35 | @*******************************************************************************/ 36 | 37 | .text 38 | 39 | 40 | .globl ihevcd_itrans_recon_dc_chroma_a9q 41 | 42 | .type ihevcd_itrans_recon_dc_chroma_a9q, %function 43 | 44 | ihevcd_itrans_recon_dc_chroma_a9q: 45 | 46 | @void ihevcd_itrans_recon_dc_chroma(uword8 *pu1_pred, 47 | @ uword8 *pu1_dst, 48 | @ word32 pred_strd, 49 | @ word32 dst_strd, 50 | @ word32 log2_trans_size, 51 | @ word16 i2_coeff_value) 52 | 53 | @r0:pu1_pred 54 | @r1:pu1_dest 55 | @r2:pred_strd 56 | @r3:dst_strd 57 | 58 | 59 | 60 | push {r0-r11,lr} 61 | vpush {d8-d15} 62 | ldr r4,[sp,#0x74] @loads log2_trans_size 63 | ldr r5,[sp,#0x78] @ loads i2_coeff_value 64 | mov r10,#1 65 | lsl r4,r10,r4 @ trans_size = (1 << log2_trans_size)@ 66 | mov r6,#64 @ 1 << (shift1 - 1)@ 67 | mov r7,#2048 @ 1<<(shift2-1) 68 | 69 | add r8,r6,r5,lsl #6 70 | ssat r8,#16,r8,asr #7 71 | add r5,r7,r8,lsl #6 72 | ssat r6,#16,r5,asr #12 73 | mov r9,r4 74 | mov r8,r4 75 | 76 | @ r6 has the dc_value 77 | @ r4 has the trans_size value 78 | @ r8 has the row value 79 | @ r9 has the col value 80 | vdup.s16 q0,r6 81 | cmp r4,#4 82 | beq row_loop_4chroma 83 | 84 | 85 | row_loop_chroma: 86 | mov r9,r4 87 | 88 | 89 | col_loop_chroma: 90 | 91 | mov r7,r0 92 | vld2.8 {d2,d3},[r7],r2 93 | vld2.8 {d4,d5},[r7],r2 94 | vld2.8 {d6,d7},[r7],r2 95 | vld2.8 {d8,d9},[r7],r2 96 | 97 | vld2.8 {d10,d11},[r7],r2 98 | vld2.8 {d12,d13},[r7],r2 99 | vld2.8 {d14,d15},[r7],r2 100 | vld2.8 {d16,d17},[r7] 101 | 102 | add r0,r0,#16 103 | 104 | 105 | vaddw.u8 q15,q0,d2 106 | vaddw.u8 q14,q0,d4 107 | vaddw.u8 q13,q0,d6 108 | vaddw.u8 q12,q0,d8 109 | vaddw.u8 q11,q0,d10 110 | vaddw.u8 q10,q0,d12 111 | vaddw.u8 q9,q0,d14 112 | 113 | 114 | mov r11,r1 115 | vqmovun.s16 d2,q15 116 | vqmovun.s16 d4,q14 117 | vqmovun.s16 d6,q13 118 | vqmovun.s16 d8,q12 119 | 120 | vaddw.u8 q15,q0,d16 121 | 122 | vqmovun.s16 d10,q11 123 | vqmovun.s16 d12,q10 124 | vqmovun.s16 d14,q9 125 | vqmovun.s16 d16,q15 126 | 127 | vst2.8 {d2,d3},[r11],r3 128 | vst2.8 {d4,d5},[r11],r3 129 | vst2.8 {d6,d7},[r11],r3 130 | vst2.8 {d8,d9},[r11],r3 131 | 132 | vst2.8 {d10,d11},[r11],r3 133 | vst2.8 {d12,d13},[r11],r3 134 | vst2.8 {d14,d15},[r11],r3 135 | vst2.8 {d16,d17},[r11] 136 | 137 | add r1,r1,#16 138 | 139 | subs r9,r9,#8 140 | bgt col_loop_chroma 141 | 142 | subs r8,r8,#8 143 | 144 | add r0,r0,r2,lsl #3 145 | add r1,r1,r3,lsl #3 146 | sub r0,r0,r4,lsl #1 147 | sub r1,r1,r4,lsl #1 148 | bgt row_loop_chroma 149 | b end_loops_chroma 150 | 151 | 152 | row_loop_4chroma: 153 | mov r9,r10 154 | 155 | 156 | col_loop_4chroma: 157 | 158 | 159 | vld2.8 {d2,d3},[r0],r2 160 | vld2.8 {d4,d5},[r0],r2 161 | vld2.8 {d6,d7},[r0],r2 162 | vld2.8 {d8,d9},[r0] 163 | 164 | 165 | 166 | 167 | vaddw.u8 q15,q0,d2 168 | vaddw.u8 q14,q0,d4 169 | vaddw.u8 q13,q0,d6 170 | vaddw.u8 q12,q0,d8 171 | 172 | 173 | 174 | vqmovun.s16 d2,q15 175 | vqmovun.s16 d4,q14 176 | vqmovun.s16 d6,q13 177 | vqmovun.s16 d8,q12 178 | 179 | 180 | vzip.8 d2,d3 181 | vzip.8 d4,d5 182 | vzip.8 d6,d7 183 | vzip.8 d8,d9 184 | 185 | vst1.u32 {d2},[r1],r3 186 | vst1.u32 {d4},[r1],r3 187 | vst1.u32 {d6},[r1],r3 188 | vst1.u32 {d8},[r1] 189 | 190 | end_loops_chroma: 191 | vpop {d8-d15} 192 | pop {r0-r11,pc} 193 | 194 | 195 | -------------------------------------------------------------------------------- /common/ihevc_disp_mgr.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_disp_mgr.c 22 | * 23 | * @brief 24 | * Contains function definitions for display management 25 | * 26 | * @author 27 | * Srinivas T 28 | * 29 | * @par List of Functions: 30 | * - ihevc_disp_mgr_init() 31 | * - ihevc_disp_mgr_add() 32 | * - ihevc_disp_mgr_get() 33 | * 34 | * @remarks 35 | * None 36 | * 37 | ******************************************************************************* 38 | */ 39 | #include 40 | #include "ihevc_typedefs.h" 41 | #include "ihevc_macros.h" 42 | #include "ihevc_func_selector.h" 43 | #include "ihevc_disp_mgr.h" 44 | 45 | 46 | /** 47 | ******************************************************************************* 48 | * 49 | * @brief 50 | * Initialization function for display buffer manager 51 | * 52 | * @par Description: 53 | * Initializes the display buffer management structure 54 | * 55 | * @param[in] ps_disp_mgr 56 | * Pointer to the display buffer management structure 57 | * 58 | * @returns none 59 | * 60 | * @remarks 61 | * None 62 | * 63 | ******************************************************************************* 64 | */ 65 | void ihevc_disp_mgr_init( 66 | disp_mgr_t *ps_disp_mgr) 67 | { 68 | WORD32 id; 69 | 70 | ps_disp_mgr->u4_last_abs_poc = DEFAULT_POC; 71 | 72 | for(id = 0; id < DISP_MGR_MAX_CNT; id++) 73 | { 74 | ps_disp_mgr->ai4_abs_poc[id] = DEFAULT_POC; 75 | ps_disp_mgr->apv_ptr[id] = NULL; 76 | } 77 | } 78 | 79 | 80 | /** 81 | ******************************************************************************* 82 | * 83 | * @brief 84 | * Adds a buffer to the display manager 85 | * 86 | * @par Description: 87 | * Adds a buffer to the display buffer manager 88 | * 89 | * @param[in] ps_disp_mgr 90 | * Pointer to the diaplay buffer management structure 91 | * 92 | * @param[in] buf_id 93 | * ID of the display buffer 94 | * 95 | * @param[in] abs_poc 96 | * Absolute POC of the display buffer 97 | * 98 | * @param[in] pv_ptr 99 | * Pointer to the display buffer 100 | * 101 | * @returns 0 if success, -1 otherwise 102 | * 103 | * @remarks 104 | * None 105 | * 106 | ******************************************************************************* 107 | */ 108 | WORD32 ihevc_disp_mgr_add(disp_mgr_t *ps_disp_mgr, 109 | WORD32 buf_id, 110 | WORD32 abs_poc, 111 | void *pv_ptr) 112 | { 113 | if(buf_id >= DISP_MGR_MAX_CNT) 114 | { 115 | return (-1); 116 | } 117 | 118 | if(ps_disp_mgr->apv_ptr[buf_id] != NULL) 119 | { 120 | return (-1); 121 | } 122 | 123 | ps_disp_mgr->apv_ptr[buf_id] = pv_ptr; 124 | ps_disp_mgr->ai4_abs_poc[buf_id] = abs_poc; 125 | return 0; 126 | } 127 | 128 | 129 | /** 130 | ******************************************************************************* 131 | * 132 | * @brief 133 | * Gets the next buffer 134 | * 135 | * @par Description: 136 | * Gets the next display buffer 137 | * 138 | * @param[in] ps_disp_mgr 139 | * Pointer to the display buffer structure 140 | * 141 | * @param[out] pi4_buf_id 142 | * Pointer to hold buffer id of the display buffer being returned 143 | * 144 | * @returns Pointer to the next display buffer 145 | * 146 | * @remarks 147 | * None 148 | * 149 | ******************************************************************************* 150 | */ 151 | void* ihevc_disp_mgr_get( 152 | disp_mgr_t *ps_disp_mgr, 153 | WORD32 *pi4_buf_id) 154 | { 155 | WORD32 id; 156 | void *pv_ret_ptr; 157 | WORD32 i4_min_poc; 158 | WORD32 min_poc_id; 159 | 160 | 161 | pv_ret_ptr = NULL; 162 | i4_min_poc = 0x7FFFFFFF; 163 | min_poc_id = -1; 164 | 165 | /* Find minimum POC */ 166 | for(id = 0; id < DISP_MGR_MAX_CNT; id++) 167 | { 168 | if((DEFAULT_POC != ps_disp_mgr->ai4_abs_poc[id]) && 169 | (ps_disp_mgr->ai4_abs_poc[id] <= i4_min_poc)) 170 | { 171 | i4_min_poc = ps_disp_mgr->ai4_abs_poc[id]; 172 | min_poc_id = id; 173 | } 174 | } 175 | *pi4_buf_id = min_poc_id; 176 | /* If all pocs are still default_poc then return NULL */ 177 | if(-1 == min_poc_id) 178 | { 179 | return NULL; 180 | } 181 | 182 | pv_ret_ptr = ps_disp_mgr->apv_ptr[min_poc_id]; 183 | 184 | /* Set abs poc to default and apv_ptr to null so that the buffer is not returned again */ 185 | ps_disp_mgr->apv_ptr[min_poc_id] = NULL; 186 | ps_disp_mgr->ai4_abs_poc[min_poc_id] = DEFAULT_POC; 187 | return pv_ret_ptr; 188 | } 189 | -------------------------------------------------------------------------------- /common/arm64/ihevc_deblk_chroma_horz.s: -------------------------------------------------------------------------------- 1 | ///***************************************************************************** 2 | //* 3 | //* Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | ///******************************************************************************* 19 | //* @file 20 | //* ihevc_deblk_luma_horz.s 21 | //* 22 | //* @brief 23 | //* contains function definitions for inter prediction interpolation. 24 | //* functions are coded using neon intrinsics and can be compiled using 25 | 26 | //* rvct 27 | //* 28 | //* @author 29 | //* anand s 30 | //* 31 | //* @par list of functions: 32 | //* 33 | //* 34 | //* @remarks 35 | //* none 36 | //* 37 | //void ihevc_deblk_chroma_horz(UWORD8 *pu1_src, 38 | // WORD32 src_strd, 39 | // WORD32 quant_param_p, 40 | // WORD32 quant_param_q, 41 | // WORD32 qp_offset_u, 42 | // WORD32 qp_offset_v, 43 | // WORD32 tc_offset_div2, 44 | // WORD32 filter_flag_p, 45 | // WORD32 filter_flag_q) 46 | // 47 | 48 | .text 49 | .align 4 50 | .include "ihevc_neon_macros.s" 51 | 52 | 53 | 54 | .extern gai4_ihevc_qp_table 55 | .extern gai4_ihevc_tc_table 56 | .globl ihevc_deblk_chroma_horz_av8 57 | 58 | .type ihevc_deblk_chroma_horz_av8, %function 59 | 60 | ihevc_deblk_chroma_horz_av8: 61 | sxtw x4,w4 62 | sxtw x5,w5 63 | sxtw x6,w6 64 | ldr w9, [sp] 65 | sxtw x9,w9 66 | push_v_regs 67 | stp x19, x20,[sp,#-16]! 68 | mov x10, x4 69 | mov x8, x7 70 | mov x7, x5 71 | mov x4, x6 72 | 73 | sub x12,x0,x1 74 | ld1 {v0.8b},[x0] 75 | sub x5,x12,x1 76 | add x6,x0,x1 77 | add x1,x2,x3 78 | uxtl v0.8h, v0.8b 79 | ld1 {v2.8b},[x12] 80 | add x2,x1,#1 81 | ld1 {v4.8b},[x5] 82 | ld1 {v16.8b},[x6] 83 | adds x1,x10,x2,asr #1 84 | uxtl v2.8h, v2.8b 85 | adrp x3, :got:gai4_ihevc_qp_table 86 | ldr x3, [x3, #:got_lo12:gai4_ihevc_qp_table] 87 | bmi l1.3312 88 | cmp x1,#0x39 89 | bgt lbl78 90 | ldr w1, [x3,x1,lsl #2] 91 | lbl78: 92 | sub x20,x1,#6 93 | csel x1, x20, x1,gt 94 | l1.3312: 95 | adds x2,x7,x2,asr #1 96 | uxtl v4.8h, v4.8b 97 | bmi l1.3332 98 | cmp x2,#0x39 99 | bgt lbl85 100 | ldr w2, [x3,x2,lsl #2] 101 | lbl85: 102 | sub x20,x2,#6 103 | csel x2, x20, x2,gt 104 | l1.3332: 105 | add x1,x1,x4,lsl #1 106 | sub v6.8h, v0.8h , v2.8h 107 | add x3,x1,#2 108 | cmp x3,#0x35 109 | mov x20,#0x35 110 | csel x1, x20, x1,gt 111 | shl v6.8h, v6.8h,#2 112 | uxtl v16.8h, v16.8b 113 | bgt l1.3368 114 | adds x3,x1,#2 115 | add x20,x1,#2 116 | csel x1, x20, x1,pl 117 | mov x20,#0 118 | csel x1, x20, x1,mi 119 | l1.3368: 120 | adrp x3, :got:gai4_ihevc_tc_table 121 | ldr x3, [x3, #:got_lo12:gai4_ihevc_tc_table] 122 | add v4.8h, v6.8h , v4.8h 123 | add x2,x2,x4,lsl #1 124 | sub v6.8h, v4.8h , v16.8h 125 | add x4,x2,#2 126 | ldr w1, [x3,x1,lsl #2] 127 | cmp x4,#0x35 128 | mov x20,#0x35 129 | csel x2, x20, x2,gt 130 | bgt l1.3412 131 | adds x4,x2,#2 132 | add x20,x2,#2 133 | csel x2, x20, x2,pl 134 | mov x20,#0 135 | csel x2, x20, x2,mi 136 | l1.3412: 137 | 138 | 139 | ldr w2, [x3,x2,lsl #2] 140 | cmp x8,#0 141 | dup v31.8h,w2 142 | dup v30.8h,w1 143 | sub x20,x1,#0 144 | neg x1, x20 145 | srshr v6.8h, v6.8h,#3 146 | dup v28.8h,w1 147 | sub x20,x2,#0 148 | neg x1, x20 149 | zip1 v4.8h, v30.8h, v31.8h 150 | dup v29.8h,w1 151 | 152 | zip1 v18.8h, v28.8h, v29.8h 153 | 154 | smin v16.8h, v6.8h , v4.8h 155 | smax v4.8h, v18.8h , v16.8h 156 | add v2.8h, v2.8h , v4.8h 157 | sub v0.8h, v0.8h , v4.8h 158 | sqxtun v2.8b, v2.8h 159 | sqxtun v0.8b, v0.8h 160 | beq l1.3528 161 | st1 {v2.8b},[x12] 162 | l1.3528: 163 | cmp x9,#0 164 | beq l1.3540 165 | st1 {v0.8b},[x0] 166 | l1.3540: 167 | ldp x19, x20,[sp],#16 168 | pop_v_regs 169 | ret 170 | 171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /common/x86/ihevc_tables_x86_intr.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_tables_x86_intr.c 22 | * 23 | * @brief 24 | * Contains function Definition for intra prediction interpolation filters 25 | * 26 | * 27 | * @author 28 | * Rishab 29 | * 30 | * @par List of Functions: 31 | 32 | * @remarks 33 | * None 34 | * 35 | ******************************************************************************* 36 | */ 37 | 38 | 39 | /*****************************************************************************/ 40 | /* File Includes */ 41 | /*****************************************************************************/ 42 | 43 | #include "ihevc_typedefs.h" 44 | #include "ihevc_platform_macros.h" 45 | #include "ihevc_macros.h" 46 | #include "ihevc_func_selector.h" 47 | #include "ihevc_defs.h" 48 | #include "ihevc_mem_fns.h" 49 | #include "ihevc_tables_x86_intr.h" 50 | 51 | // LUMA INTRA PRED 52 | const UWORD8 IHEVCE_SHUFFLEMASKY1[16] = { 0x03, 0x02, 0x01, 0x00, 53 | 0x02, 0x03, 0x03, 0x04, 54 | 0x08, 0x08, 0x08, 0x08, 55 | 0x08, 0x08, 0x08, 0x08 }; 56 | 57 | const UWORD8 IHEVCE_SHUFFLEMASKY2[16] = { 0x07, 0x06, 0x05, 0x04, 58 | 0x03, 0x02, 0x01, 0x00, 59 | 0x08, 0x08, 0x08, 0x08, 60 | 0x08, 0x08, 0x08, 0x08 }; 61 | 62 | const UWORD8 IHEVCE_SHUFFLEMASKY3[16] = { 0x0f, 0x0e, 0x0d, 0x0c, 63 | 0x0b, 0x0a, 0x09, 0x08, 64 | 0x07, 0x06, 0x05, 0x04, 65 | 0x03, 0x02, 0x01, 0x00 }; 66 | 67 | const UWORD8 IHEVCE_SHUFFLEMASK4[16] = { 0x00, 0x00, 0x00, 0x00, 68 | 0x00, 0x00, 0x00, 0x00, 69 | 0x00, 0x00, 0x00, 0x00, 70 | 0x00, 0x00, 0x00, 0x00 }; 71 | 72 | const UWORD8 IHEVCE_SHUFFLEMASK5[16] = { 0x00, 0x01, 0x08, 0x09, 73 | 0x0f, 0x0f, 0x0f, 0x0f, 74 | 0x0f, 0x0f, 0x0f, 0x0f, 75 | 0x0f, 0x0f, 0x0f, 0x0f }; 76 | /// CHROMA INTRA PRED 77 | const UWORD8 IHEVCE_SHUFFLEMASKY7[16] = { 0x06, 0x07, 0x04, 0x05, 78 | 0x02, 0x03, 0x00, 0x01, 79 | 0x08, 0x08, 0x08, 0x08, 80 | 0x08, 0x08, 0x08, 0x08 }; 81 | 82 | const UWORD8 IHEVCE_SHUFFLEMASKY8[16] = { 0x0e, 0x0f, 0x0c, 0x0d, 83 | 0x0a, 0x0b, 0x08, 0x09, 84 | 0x06, 0x07, 0x04, 0x05, 85 | 0x02, 0x03, 0x00, 0x01 }; 86 | 87 | const UWORD8 IHEVCE_SHUFFLEMASKY9[16] = { 0x00, 0x01, 0x04, 0x05, 88 | 0x08, 0x09, 0x0c, 0x0d, 89 | 0x02, 0x03, 0x06, 0x07, 90 | 0x0a, 0x0b, 0x0e, 0x0f }; 91 | 92 | const UWORD8 IHEVCE_SHUFFLEMASKY11[16] = { 0x01, 0x00, 0x02, 0x01, 93 | 0x03, 0x02, 0x04, 0x03, 94 | 0x05, 0x04, 0x06, 0x05, 95 | 0x07, 0x06, 0x08, 0x07 }; 96 | //INTRAPRED 97 | const UWORD8 inv_angle_shuffle[7][32] = 98 | { 99 | { 3, 0x80, 0x80, 0x80, 1, 2, 4, 5, 6, 7, 9, 10, 11, 12, 14, 15, 0x80, 0x80, 0x80, 0, 1, 2, 4, 5, 6, 7, 9, 10, 11, 12, 14, 15 }, 100 | { 6, 0x80, 0x80, 0x80, 0x80, 0x80, 2, 3, 5, 6, 8, 9, 11, 12, 14, 15, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 1, 2, 4, 5, 7, 8, 10, 11, 13, 14 }, 101 | { 8, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 2, 4, 6, 8, 9, 11, 13, 15, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 1, 3, 5, 7, 8, 10, 12, 14 }, 102 | { 10, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 2, 5, 7, 10, 12, 15, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 1, 4, 6, 9, 11, 14 }, 103 | { 12, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 4, 7, 11, 14, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 2, 5, 9, 12 }, 104 | { 14, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 6, 13, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 3, 10 }, 105 | { 15, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0 } 106 | }; 107 | 108 | /// DEBLOCK TABLES 109 | const WORD8 coef_d[16] = { 0, 1, -2, 1, 1, -2, 1, 0, 0, 1, -2, 1, 1, -2, 1, 0 }; 110 | const WORD8 coef_de1[16] = { 3, -9, 9, -3, 3, -9, 9, -3, 3, -9, 9, -3, 3, -9, 9, -3 }; 111 | const WORD8 coef_dep1[16] = { -2, 1, 1, -2, -2, 1, 1, -2, -2, 1, 1, -2, -2, 1, 1, -2 }; 112 | const WORD32 shuffle_d[4] = { 0x80800403, 0x80800c0b, 0x03000704, 0x0b080f0c }; 113 | const WORD32 shuffle0[2] = { 0x80098001, 0x800e8006 }; 114 | const WORD32 shuffle1[4] = { 0x05040100, 0x0d0c0908, 0x07060302, 0x0f0e0b0a }; 115 | const WORD32 shuffle2[4] = { 0x80808080, 0x03020100, 0x07060504, 0x80808080 }; 116 | const WORD32 shuffle3[4] = { 0x80808080, 0x0b0a0908, 0x0f0e0d0c, 0x80808080 }; 117 | 118 | const WORD8 delta0[16] = { 1, -4, 1, -4, 1, -4, 1, -4, 1, -4, 1, -4, 1, -4, 1, -4 }; 119 | const WORD8 delta1[16] = { 4, -1, 4, -1, 4, -1, 4, -1, 4, -1, 4, -1, 4, -1, 4, -1 }; 120 | const WORD32 shuffle_uv[4] = { 0x03010200, 0x0b090a08, 0x07050604, 0x0f0d0e0c }; 121 | -------------------------------------------------------------------------------- /decoder/ihevcd_fmt_conv.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | 19 | /** 20 | ******************************************************************************* 21 | * @file 22 | * ihevcd_structs.h 23 | * 24 | * @brief 25 | * Structure definitions used in the decoder 26 | * 27 | * @author 28 | * Harish 29 | * 30 | * @par List of Functions: 31 | * 32 | * @remarks 33 | * None 34 | * 35 | ******************************************************************************* 36 | */ 37 | 38 | #ifndef _IHEVCD_FMT_CONV_H_ 39 | #define _IHEVCD_FMT_CONV_H_ 40 | 41 | #define COEFF1 13073 42 | #define COEFF2 -3207 43 | #define COEFF3 -6664 44 | #define COEFF4 16530 45 | 46 | typedef void ihevcd_fmt_conv_420sp_to_rgba8888_ft(UWORD8 *pu1_y_src, 47 | UWORD8 *pu1_uv_src, 48 | UWORD32 *pu4_rgba_dst, 49 | WORD32 wd, 50 | WORD32 ht, 51 | WORD32 src_y_strd, 52 | WORD32 src_uv_strd, 53 | WORD32 dst_strd, 54 | WORD32 is_u_first); 55 | 56 | typedef void ihevcd_fmt_conv_420sp_to_rgb565_ft(UWORD8 *pu1_y_src, 57 | UWORD8 *pu1_uv_src, 58 | UWORD16 *pu2_rgb_dst, 59 | WORD32 wd, 60 | WORD32 ht, 61 | WORD32 src_y_strd, 62 | WORD32 src_uv_strd, 63 | WORD32 dst_strd, 64 | WORD32 is_u_first); 65 | 66 | 67 | typedef void ihevcd_fmt_conv_420sp_to_420sp_ft(UWORD8 *pu1_y_src, 68 | UWORD8 *pu1_uv_src, 69 | UWORD8 *pu1_y_dst, 70 | UWORD8 *pu1_uv_dst, 71 | WORD32 wd, 72 | WORD32 ht, 73 | WORD32 src_y_strd, 74 | WORD32 src_uv_strd, 75 | WORD32 dst_y_strd, 76 | WORD32 dst_uv_strd); 77 | typedef void ihevcd_fmt_conv_420sp_to_420p_ft(UWORD8 *pu1_y_src, 78 | UWORD8 *pu1_uv_src, 79 | UWORD8 *pu1_y_dst, 80 | UWORD8 *pu1_u_dst, 81 | UWORD8 *pu1_v_dst, 82 | WORD32 wd, 83 | WORD32 ht, 84 | WORD32 src_y_strd, 85 | WORD32 src_uv_strd, 86 | WORD32 dst_y_strd, 87 | WORD32 dst_uv_strd, 88 | WORD32 is_u_first, 89 | WORD32 disable_luma_copy); 90 | 91 | /* C function declarations */ 92 | ihevcd_fmt_conv_420sp_to_rgba8888_ft ihevcd_fmt_conv_420sp_to_rgba8888; 93 | ihevcd_fmt_conv_420sp_to_rgb565_ft ihevcd_fmt_conv_420sp_to_rgb565; 94 | ihevcd_fmt_conv_420sp_to_420sp_ft ihevcd_fmt_conv_420sp_to_420sp; 95 | ihevcd_fmt_conv_420sp_to_420p_ft ihevcd_fmt_conv_420sp_to_420p; 96 | 97 | /* A9Q function declarations */ 98 | ihevcd_fmt_conv_420sp_to_rgba8888_ft ihevcd_fmt_conv_420sp_to_rgba8888_a9q; 99 | ihevcd_fmt_conv_420sp_to_420sp_ft ihevcd_fmt_conv_420sp_to_420sp_a9q; 100 | ihevcd_fmt_conv_420sp_to_420p_ft ihevcd_fmt_conv_420sp_to_420p_a9q; 101 | 102 | /* A9A function declarations */ 103 | ihevcd_fmt_conv_420sp_to_rgba8888_ft ihevcd_fmt_conv_420sp_to_rgba8888_a9a; 104 | ihevcd_fmt_conv_420sp_to_420sp_ft ihevcd_fmt_conv_420sp_to_420sp_a9a; 105 | ihevcd_fmt_conv_420sp_to_420p_ft ihevcd_fmt_conv_420sp_to_420p_a9a; 106 | 107 | /* SSSe31 function declarations */ 108 | ihevcd_fmt_conv_420sp_to_420p_ft ihevcd_fmt_conv_420sp_to_420p_ssse3; 109 | 110 | /* SSE4 function declarations */ 111 | ihevcd_fmt_conv_420sp_to_420p_ft ihevcd_fmt_conv_420sp_to_420p_sse42; 112 | 113 | /* armv8 function declarations */ 114 | ihevcd_fmt_conv_420sp_to_rgba8888_ft ihevcd_fmt_conv_420sp_to_rgba8888_av8; 115 | ihevcd_fmt_conv_420sp_to_420sp_ft ihevcd_fmt_conv_420sp_to_420sp_av8; 116 | ihevcd_fmt_conv_420sp_to_420p_ft ihevcd_fmt_conv_420sp_to_420p_av8; 117 | 118 | #endif /* _IHEVCD_FMT_CONV_H_ */ 119 | -------------------------------------------------------------------------------- /common/arm64/ihevc_intra_pred_chroma_mode_18_34.s: -------------------------------------------------------------------------------- 1 | ///***************************************************************************** 2 | //* 3 | //* Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | ///** 19 | //******************************************************************************* 20 | //* @file 21 | //* ihevc_intra_pred_luma_mode_18_34_neon.s 22 | //* 23 | //* @brief 24 | //* contains function definitions for intra prediction dc filtering. 25 | //* functions are coded using neon intrinsics and can be compiled using 26 | 27 | //* rvct 28 | //* 29 | //* @author 30 | //* yogeswaran rs 31 | //* 32 | //* @par list of functions: 33 | //* 34 | //* 35 | //* @remarks 36 | //* none 37 | //* 38 | //******************************************************************************* 39 | //*/ 40 | ///** 41 | //******************************************************************************* 42 | //* 43 | //* @brief 44 | //* luma intraprediction filter for dc input 45 | //* 46 | //* @par description: 47 | //* 48 | //* @param[in] pu1_ref 49 | //* uword8 pointer to the source 50 | //* 51 | //* @param[out] pu1_dst 52 | //* uword8 pointer to the destination 53 | //* 54 | //* @param[in] src_strd 55 | //* integer source stride 56 | //* 57 | //* @param[in] dst_strd 58 | //* integer destination stride 59 | //* 60 | //* @param[in] pi1_coeff 61 | //* word8 pointer to the planar coefficients 62 | //* 63 | //* @param[in] nt 64 | //* size of tranform block 65 | //* 66 | //* @param[in] mode 67 | //* type of filtering 68 | //* 69 | //* @returns 70 | //* 71 | //* @remarks 72 | //* none 73 | //* 74 | //******************************************************************************* 75 | //*/ 76 | 77 | //void ihevc_intra_pred_chroma_mode_18_34(uword8 *pu1_ref, 78 | // word32 src_strd, 79 | // uword8 *pu1_dst, 80 | // word32 dst_strd, 81 | // word32 nt, 82 | // word32 mode) 83 | // 84 | //**************variables vs registers***************************************** 85 | //x0 => *pu1_ref 86 | //x1 => src_strd 87 | //x2 => *pu1_dst 88 | //x3 => dst_strd 89 | 90 | //stack contents from #40 91 | // nt 92 | // mode 93 | // pi1_coeff 94 | 95 | .text 96 | .align 4 97 | .include "ihevc_neon_macros.s" 98 | 99 | 100 | 101 | .globl ihevc_intra_pred_chroma_mode_18_34_av8 102 | 103 | .type ihevc_intra_pred_chroma_mode_18_34_av8, %function 104 | 105 | ihevc_intra_pred_chroma_mode_18_34_av8: 106 | 107 | // stmfd sp!, {x4-x12, x14} //stack stores the values of the arguments 108 | 109 | stp x19, x20,[sp,#-16]! 110 | 111 | 112 | cmp x4,#4 113 | beq mode2_4 114 | 115 | mov x12,x4 116 | mov x11,x4 117 | add x0,x0,x4,lsl #2 118 | 119 | cmp x5,#0x22 120 | mov x10,x2 121 | 122 | add x0,x0,#4 123 | 124 | sub x20,x0,#4 125 | csel x0, x20, x0,ne 126 | mov x20,#2 127 | csel x6, x20, x6,eq 128 | mov x20,#-2 129 | csel x6, x20, x6,ne 130 | mov x8,x0 131 | 132 | 133 | kernel: 134 | 135 | 136 | ld1 {v0.8b, v1.8b},[x8],x6 137 | st1 {v0.8b, v1.8b},[x10],x3 138 | ld1 {v2.8b, v3.8b},[x8],x6 139 | st1 {v2.8b, v3.8b},[x10],x3 140 | ld1 {v4.8b, v5.8b},[x8],x6 141 | st1 {v4.8b, v5.8b},[x10],x3 142 | ld1 {v6.8b, v7.8b},[x8],x6 143 | st1 {v6.8b, v7.8b},[x10],x3 144 | ld1 {v16.8b, v17.8b},[x8],x6 145 | st1 {v16.8b, v17.8b},[x10],x3 146 | ld1 {v18.8b, v19.8b},[x8],x6 147 | st1 {v18.8b, v19.8b},[x10],x3 148 | ld1 {v20.8b, v21.8b},[x8],x6 149 | st1 {v20.8b, v21.8b},[x10],x3 150 | ld1 {v22.8b, v23.8b},[x8],x6 151 | st1 {v22.8b, v23.8b},[x10],x3 152 | 153 | subs x12,x12,#8 154 | bne kernel 155 | 156 | cmp x11,#16 157 | add x8,x0,#16 158 | add x10,x2,#16 159 | sub x11, x11,#16 160 | mov x12,#16 161 | beq kernel 162 | b end_func 163 | 164 | mode2_4: 165 | 166 | add x0,x0,#20 167 | cmp x5,#0x22 168 | sub x20,x0,#4 169 | csel x0, x20, x0,ne 170 | 171 | mov x20,#2 172 | csel x8, x20, x8,eq 173 | mov x20,#-2 174 | csel x8, x20, x8,ne 175 | 176 | ld1 {v0.8b},[x0],x8 177 | st1 {v0.2s},[x2],x3 178 | 179 | ld1 {v0.8b},[x0],x8 180 | st1 {v0.2s},[x2],x3 181 | 182 | ld1 {v0.8b},[x0],x8 183 | st1 {v0.2s},[x2],x3 184 | 185 | ld1 {v0.8b},[x0],x8 186 | st1 {v0.2s},[x2],x3 187 | 188 | end_func: 189 | // ldmfd sp!,{x4-x12,x15} //reload the registers from sp 190 | ldp x19, x20,[sp],#16 191 | 192 | ret 193 | 194 | 195 | 196 | 197 | 198 | 199 | -------------------------------------------------------------------------------- /common/ithread.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /*****************************************************************************/ 19 | /* */ 20 | /* File Name : ithread.c */ 21 | /* */ 22 | /* Description : Contains abstraction for threads, mutex and semaphores*/ 23 | /* */ 24 | /* List of Functions : */ 25 | /* */ 26 | /* Issues / Problems : None */ 27 | /* */ 28 | /* Revision History : */ 29 | /* */ 30 | /* DD MM YYYY Author(s) Changes */ 31 | /* 07 09 2012 Harish Initial Version */ 32 | /*****************************************************************************/ 33 | /*****************************************************************************/ 34 | /* File Includes */ 35 | /*****************************************************************************/ 36 | #include 37 | #include "ihevc_typedefs.h" 38 | #include "ithread.h" 39 | #include 40 | 41 | //#define PTHREAD_AFFINITY 42 | //#define SYSCALL_AFFINITY 43 | 44 | #ifdef PTHREAD_AFFINITY 45 | #define _GNU_SOURCE 46 | #define __USE_GNU 47 | #endif 48 | 49 | #include 50 | #include 51 | #include 52 | #include 53 | 54 | UWORD32 ithread_get_handle_size(void) 55 | { 56 | return sizeof(pthread_t); 57 | } 58 | 59 | UWORD32 ithread_get_mutex_lock_size(void) 60 | { 61 | return sizeof(pthread_mutex_t); 62 | } 63 | 64 | WORD32 ithread_create(void *thread_handle, void *attribute, void *strt, void *argument) 65 | { 66 | return pthread_create((pthread_t *)thread_handle, attribute, (void * (*)(void *))strt, argument); 67 | } 68 | 69 | WORD32 ithread_join(void *thread_handle, void **val_ptr) 70 | { 71 | pthread_t *pthread_handle = (pthread_t *)thread_handle; 72 | return pthread_join(*pthread_handle, val_ptr); 73 | } 74 | 75 | void ithread_exit(void *val_ptr) 76 | { 77 | return pthread_exit(val_ptr); 78 | } 79 | 80 | WORD32 ithread_get_mutex_struct_size(void) 81 | { 82 | return (sizeof(pthread_mutex_t)); 83 | } 84 | WORD32 ithread_mutex_init(void *mutex) 85 | { 86 | return pthread_mutex_init((pthread_mutex_t *)mutex, NULL); 87 | } 88 | 89 | WORD32 ithread_mutex_destroy(void *mutex) 90 | { 91 | return pthread_mutex_destroy((pthread_mutex_t *)mutex); 92 | } 93 | 94 | WORD32 ithread_mutex_lock(void *mutex) 95 | { 96 | return pthread_mutex_lock((pthread_mutex_t *)mutex); 97 | } 98 | 99 | WORD32 ithread_mutex_unlock(void *mutex) 100 | { 101 | return pthread_mutex_unlock((pthread_mutex_t *)mutex); 102 | } 103 | 104 | void ithread_yield(void) 105 | { 106 | sched_yield(); 107 | } 108 | 109 | void ithread_sleep(UWORD32 u4_time) 110 | { 111 | usleep(u4_time * 1000 * 1000); 112 | } 113 | 114 | void ithread_msleep(UWORD32 u4_time_ms) 115 | { 116 | usleep(u4_time_ms * 1000); 117 | } 118 | 119 | void ithread_usleep(UWORD32 u4_time_us) 120 | { 121 | usleep(u4_time_us); 122 | } 123 | 124 | UWORD32 ithread_get_sem_struct_size(void) 125 | { 126 | return (sizeof(sem_t)); 127 | } 128 | 129 | WORD32 ithread_sem_init(void *sem, WORD32 pshared, UWORD32 value) 130 | { 131 | return sem_init((sem_t *)sem, pshared, value); 132 | } 133 | 134 | WORD32 ithread_sem_post(void *sem) 135 | { 136 | return sem_post((sem_t *)sem); 137 | } 138 | 139 | WORD32 ithread_sem_wait(void *sem) 140 | { 141 | return sem_wait((sem_t *)sem); 142 | } 143 | 144 | WORD32 ithread_sem_destroy(void *sem) 145 | { 146 | return sem_destroy((sem_t *)sem); 147 | } 148 | 149 | WORD32 ithread_set_affinity(WORD32 core_id) 150 | { 151 | 152 | #ifdef PTHREAD_AFFINITY 153 | cpu_set_t cpuset; 154 | int num_cores = sysconf(_SC_NPROCESSORS_ONLN); 155 | pthread_t cur_thread = pthread_self(); 156 | 157 | if(core_id >= num_cores) 158 | return -1; 159 | 160 | CPU_ZERO(&cpuset); 161 | CPU_SET(core_id, &cpuset); 162 | 163 | return pthread_setaffinity_np(cur_thread, sizeof(cpu_set_t), &cpuset); 164 | 165 | #elif SYSCALL_AFFINITY 166 | WORD32 i4_sys_res; 167 | 168 | pid_t pid = gettid(); 169 | 170 | 171 | i4_sys_res = syscall(__NR_sched_setaffinity, pid, sizeof(i4_mask), &i4_mask); 172 | if(i4_sys_res) 173 | { 174 | //WORD32 err; 175 | //err = errno; 176 | //perror("Error in setaffinity syscall PERROR : "); 177 | //LOG_ERROR("Error in the syscall setaffinity: mask=0x%x err=0x%x", i4_mask, i4_sys_res); 178 | return -1; 179 | } 180 | #endif 181 | 182 | return core_id; 183 | } 184 | -------------------------------------------------------------------------------- /decoder/arm64/ihevcd_itrans_recon_dc_luma.s: -------------------------------------------------------------------------------- 1 | ///***************************************************************************** 2 | //* 3 | //* Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | ///** 19 | ///******************************************************************************* 20 | //* //file 21 | //* ihevcd_itrans_recon_dc_luma.s 22 | //* 23 | //* //brief 24 | //* contains function definitions itrans and recon for dc only case 25 | //* 26 | //* //author 27 | //* ittiam 28 | //* 29 | //* //par list of functions: 30 | //* 31 | //* 32 | //* //remarks 33 | //* none 34 | //* 35 | //*******************************************************************************/ 36 | 37 | .text 38 | .include "ihevc_neon_macros.s" 39 | 40 | 41 | 42 | .globl ihevcd_itrans_recon_dc_luma_av8 43 | 44 | .type ihevcd_itrans_recon_dc_luma_av8, %function 45 | 46 | ihevcd_itrans_recon_dc_luma_av8: 47 | 48 | //void ihevcd_itrans_recon_dc_luma(uword8 *pu1_pred, 49 | // uword8 *pu1_dst, 50 | // word32 pred_strd, 51 | // word32 dst_strd, 52 | // word32 log2_trans_size, 53 | // word16 i2_coeff_value) 54 | 55 | //x0:pu1_pred 56 | //x1:pu1_dest 57 | //x2:pred_strd 58 | //x3:dst_strd 59 | 60 | 61 | 62 | 63 | stp x19, x20,[sp,#-16]! 64 | sxth x5,w5 65 | 66 | mov x10,#1 67 | lsl x4,x10,x4 // trans_size = (1 << log2_trans_size)// 68 | mov x6,#64 // 1 << (shift1 - 1)// 69 | mov x7,#2048 // 1<<(shift2-1) 70 | 71 | add x8,x6,x5,lsl #6 72 | asr x20, x8, #7 73 | mov x19, #32767 74 | cmp x20,x19 75 | blt lbl37 76 | mov x8,#32767 77 | b lbl37_1 78 | lbl37: 79 | mov x19,#-32768 80 | cmp x20,x19 81 | csel x8, x19, x20, lt 82 | lbl37_1: 83 | 84 | add x5,x7,x8,lsl #6 85 | asr x20, x5, #12 86 | mov x19,#32767 87 | cmp x20,x19 88 | blt lbl39 89 | mov x6,#32767 90 | b lbl39_1 91 | lbl39: 92 | mov x19,#-32768 93 | cmp x20,x19 94 | csel x6, x19, x20, lt 95 | lbl39_1: 96 | 97 | mov x9,x4 98 | mov x8,x4 99 | 100 | // x6 has the dc_value 101 | // x4 has the trans_size value 102 | // x8 has the row value 103 | // x9 has the col value 104 | dup v0.8h,w6 105 | cmp x4,#4 106 | beq row_loop_4 107 | 108 | 109 | row_loop: 110 | mov x9,x4 111 | 112 | 113 | col_loop: 114 | 115 | mov x7,x0 116 | ld1 {v2.8b},[x7],x2 117 | ld1 {v3.8b},[x7],x2 118 | ld1 {v4.8b},[x7],x2 119 | ld1 {v5.8b},[x7],x2 120 | 121 | ld1 {v6.8b},[x7],x2 122 | ld1 {v7.8b},[x7],x2 123 | ld1 {v1.8b},[x7],x2 124 | ld1 {v17.8b},[x7] 125 | 126 | add x0,x0,#8 127 | 128 | 129 | uaddw v30.8h, v0.8h , v2.8b 130 | uaddw v28.8h, v0.8h , v3.8b 131 | uaddw v26.8h, v0.8h , v4.8b 132 | uaddw v24.8h, v0.8h , v5.8b 133 | uaddw v22.8h, v0.8h , v6.8b 134 | uaddw v20.8h, v0.8h , v7.8b 135 | uaddw v18.8h, v0.8h , v1.8b 136 | uaddw v16.8h, v0.8h , v17.8b 137 | 138 | mov x11,x1 139 | sqxtun v2.8b, v30.8h 140 | sqxtun v3.8b, v28.8h 141 | sqxtun v4.8b, v26.8h 142 | sqxtun v5.8b, v24.8h 143 | sqxtun v6.8b, v22.8h 144 | sqxtun v7.8b, v20.8h 145 | sqxtun v1.8b, v18.8h 146 | sqxtun v17.8b, v16.8h 147 | 148 | 149 | st1 {v2.2s},[x11],x3 150 | st1 {v3.2s},[x11],x3 151 | st1 {v4.2s},[x11],x3 152 | st1 {v5.2s},[x11],x3 153 | st1 {v6.2s},[x11],x3 154 | st1 {v7.2s},[x11],x3 155 | st1 {v1.2s},[x11],x3 156 | st1 {v17.2s},[x11] 157 | 158 | add x1,x1,#8 159 | 160 | subs x9,x9,#8 161 | bgt col_loop 162 | 163 | subs x8,x8,#8 164 | 165 | add x0,x0,x2,lsl #3 166 | add x1,x1,x3,lsl #3 167 | sub x0,x0,x4 168 | sub x1,x1,x4 169 | bgt row_loop 170 | b end_loops 171 | 172 | 173 | row_loop_4: 174 | mov x9,x10 175 | 176 | 177 | col_loop_4: 178 | 179 | 180 | ld1 {v2.8b},[x0],x2 181 | ld1 {v3.8b},[x0],x2 182 | ld1 {v4.8b},[x0],x2 183 | ld1 {v5.8b},[x0] 184 | 185 | 186 | 187 | 188 | uaddw v30.8h, v0.8h , v2.8b 189 | uaddw v28.8h, v0.8h , v3.8b 190 | uaddw v26.8h, v0.8h , v4.8b 191 | uaddw v24.8h, v0.8h , v5.8b 192 | 193 | 194 | 195 | sqxtun v2.8b, v30.8h 196 | sqxtun v3.8b, v28.8h 197 | sqxtun v4.8b, v26.8h 198 | sqxtun v5.8b, v24.8h 199 | 200 | 201 | 202 | st1 {v2.s}[0],[x1],x3 203 | st1 {v3.s}[0],[x1],x3 204 | st1 {v4.s}[0],[x1],x3 205 | st1 {v5.s}[0],[x1] 206 | 207 | end_loops: 208 | ldp x19, x20,[sp],#16 209 | 210 | ret 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | -------------------------------------------------------------------------------- /common/ihevc_recon.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore 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 | /** 19 | ******************************************************************************* 20 | * @file 21 | * ihevc_recon.h 22 | * 23 | * @brief 24 | * Functions declarations reconstruction 25 | * 26 | * @author 27 | * Ittiam 28 | * 29 | * @remarks 30 | * None 31 | * 32 | ******************************************************************************* 33 | */ 34 | #ifndef _IHEVC_RECON_H_ 35 | #define _IHEVC_RECON_H_ 36 | 37 | typedef void ihevc_recon_4x4_ttype1_ft(WORD16 *pi2_src, 38 | UWORD8 *pu1_pred, 39 | UWORD8 *pu1_dst, 40 | WORD32 src_strd, 41 | WORD32 pred_strd, 42 | WORD32 dst_strd, 43 | WORD32 zero_cols); 44 | typedef void ihevc_hbd_recon_4x4_ttype1_ft(WORD16 *pi2_src, 45 | UWORD16 *pu2_pred, 46 | UWORD16 *pu2_dst, 47 | WORD32 src_strd, 48 | WORD32 pred_strd, 49 | WORD32 dst_strd, 50 | WORD32 zero_cols, 51 | UWORD8 bit_depth); 52 | typedef void ihevc_recon_4x4_ft(WORD16 *pi2_src, 53 | UWORD8 *pu1_pred, 54 | UWORD8 *pu1_dst, 55 | WORD32 src_strd, 56 | WORD32 pred_strd, 57 | WORD32 dst_strd, 58 | WORD32 zero_cols); 59 | typedef void ihevc_hbd_recon_4x4_ft(WORD16 *pi2_src, 60 | UWORD16 *pu2_pred, 61 | UWORD16 *pu2_dst, 62 | WORD32 src_strd, 63 | WORD32 pred_strd, 64 | WORD32 dst_strd, 65 | WORD32 zero_cols, 66 | UWORD8 bit_depth); 67 | typedef void ihevc_recon_8x8_ft(WORD16 *pi2_src, 68 | UWORD8 *pu1_pred, 69 | UWORD8 *pu1_dst, 70 | WORD32 src_strd, 71 | WORD32 pred_strd, 72 | WORD32 dst_strd, 73 | WORD32 zero_cols); 74 | typedef void ihevc_hbd_recon_8x8_ft(WORD16 *pi2_src, 75 | UWORD16 *pu2_pred, 76 | UWORD16 *pu2_dst, 77 | WORD32 src_strd, 78 | WORD32 pred_strd, 79 | WORD32 dst_strd, 80 | WORD32 zero_cols, 81 | UWORD8 bit_depth); 82 | typedef void ihevc_recon_16x16_ft(WORD16 *pi2_src, 83 | UWORD8 *pu1_pred, 84 | UWORD8 *pu1_dst, 85 | WORD32 src_strd, 86 | WORD32 pred_strd, 87 | WORD32 dst_strd, 88 | WORD32 zero_cols); 89 | typedef void ihevc_hbd_recon_16x16_ft(WORD16 *pi2_src, 90 | UWORD16 *pu2_pred, 91 | UWORD16 *pu2_dst, 92 | WORD32 src_strd, 93 | WORD32 pred_strd, 94 | WORD32 dst_strd, 95 | WORD32 zero_cols, 96 | UWORD8 bit_depth); 97 | typedef void ihevc_recon_32x32_ft(WORD16 *pi2_src, 98 | UWORD8 *pu1_pred, 99 | UWORD8 *pu1_dst, 100 | WORD32 src_strd, 101 | WORD32 pred_strd, 102 | WORD32 dst_strd, 103 | WORD32 zero_cols); 104 | typedef void ihevc_hbd_recon_32x32_ft(WORD16 *pi2_src, 105 | UWORD16 *pu2_pred, 106 | UWORD16 *pu2_dst, 107 | WORD32 src_strd, 108 | WORD32 pred_strd, 109 | WORD32 dst_strd, 110 | WORD32 zero_cols, 111 | UWORD8 bit_depth); 112 | 113 | ihevc_recon_4x4_ttype1_ft ihevc_recon_4x4_ttype1; 114 | ihevc_hbd_recon_4x4_ttype1_ft ihevc_hbd_recon_4x4_ttype1; 115 | ihevc_recon_4x4_ft ihevc_recon_4x4; 116 | ihevc_hbd_recon_4x4_ft ihevc_hbd_recon_4x4; 117 | ihevc_recon_8x8_ft ihevc_recon_8x8; 118 | ihevc_hbd_recon_8x8_ft ihevc_hbd_recon_8x8; 119 | ihevc_recon_16x16_ft ihevc_recon_16x16; 120 | ihevc_hbd_recon_16x16_ft ihevc_hbd_recon_16x16; 121 | ihevc_recon_32x32_ft ihevc_recon_32x32; 122 | ihevc_hbd_recon_32x32_ft ihevc_hbd_recon_32x32; 123 | 124 | #endif /*_IHEVC_RECON_H_*/ 125 | --------------------------------------------------------------------------------