Skip to content

Commit

Permalink
libavcenc: Remove duplicate code and improve readability
Browse files Browse the repository at this point in the history
This commit does not introduce any new functionality w.r.t previous
commit. But it fixes few things. They are listed below:
1. Guard Bands in header files are fixed
2. Header files contains function definition comments. These are same
as in source file. Maintaining same comment at two locations is
unnecessary. These are removed.
3. Improved consistency and code indentation
4. Removed comments that dont align with implementation
5. Grouped headers of a workspace together
  • Loading branch information
ram-mohan committed Sep 29, 2023
1 parent b982d8c commit ce6b940
Show file tree
Hide file tree
Showing 91 changed files with 3,497 additions and 7,715 deletions.
41 changes: 26 additions & 15 deletions encoder/arm/ih264e_function_selector.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@
* Contains functions to initialize function pointers used in h264
*
* @author
* Ittiam
* ittiam
*
* @par List of Functions:
* - ih264e_init_function_ptr
* - ih264e_default_arch
*
* @remarks
* None
* none
*
*******************************************************************************
*/
Expand All @@ -52,38 +54,46 @@
#include "ih264_typedefs.h"
#include "iv2.h"
#include "ive2.h"
#include "ih264_defs.h"
#include "ih264_size_defs.h"
#include "ih264e_defs.h"
#include "ih264e_error.h"
#include "ih264e_bitstream.h"
#include "ime_distortion_metrics.h"
#include "ime_defs.h"
#include "ime_structs.h"

#include "ih264_macros.h"
#include "ih264_error.h"
#include "ih264_defs.h"
#include "ih264_mem_fns.h"
#include "ih264_padding.h"
#include "ih264_structs.h"
#include "ih264_size_defs.h"
#include "ih264_trans_quant_itrans_iquant.h"
#include "ih264_inter_pred_filters.h"
#include "ih264_mem_fns.h"
#include "ih264_padding.h"
#include "ih264_intra_pred_filters.h"
#include "ih264_deblk_edge_filters.h"
#include "ih264_cabac_tables.h"
#include "ih264_macros.h"
#include "ih264_platform_macros.h"

#include "ime_defs.h"
#include "ime_distortion_metrics.h"
#include "ime_structs.h"

#include "irc_cntrl_param.h"
#include "irc_frame_info_collector.h"

#include "ih264e_error.h"
#include "ih264e_defs.h"
#include "ih264e_rate_control.h"
#include "ih264e_bitstream.h"
#include "ih264e_cabac_structs.h"
#include "ih264e_structs.h"
#include "ih264e_cabac.h"
#include "ih264e_platform_macros.h"


/*****************************************************************************/
/* Function Definitions */
/*****************************************************************************/

/**
*******************************************************************************
*
* @brief Initialize the intra/inter/transform/deblk function pointers of
* codec context
* @brief Initialize the intra/inter/transform/deblk/entropy function pointers
*
* @par Description: the current routine initializes the function pointers of
* codec context basing on the architecture in use
Expand All @@ -100,6 +110,7 @@
void ih264e_init_function_ptr(void *pv_codec)
{
codec_t *ps_codec = (codec_t *)pv_codec;

ih264e_init_function_ptr_generic(ps_codec);
switch(ps_codec->s_cfg.e_arch)
{
Expand Down
88 changes: 46 additions & 42 deletions encoder/arm/ih264e_function_selector_a9q.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
/**
*******************************************************************************
* @file
* ih264e_function_selector_generic.c
* ih264e_function_selector_a9q.c
*
* @brief
* Contains functions to initialize function pointers of codec context
*
* @author
* Ittiam
* ittiam
*
* @par List of Functions:
* - ih264e_init_function_ptr_generic
* - ih264e_init_function_ptr_neon_a9q
*
* @remarks
* None
* none
*
*******************************************************************************
*/
Expand All @@ -42,52 +42,59 @@
/* File Includes */
/*****************************************************************************/

/* System Include files */
/* System Include Files */
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>

/* User Include files */
/* User Include Files */
#include "ih264_typedefs.h"
#include "iv2.h"
#include "ive2.h"
#include "ih264_defs.h"
#include "ih264_size_defs.h"
#include "ih264e_defs.h"
#include "ih264e_error.h"
#include "ih264e_bitstream.h"
#include "ime_distortion_metrics.h"
#include "ime_defs.h"
#include "ime_structs.h"

#include "ih264_error.h"
#include "ih264_defs.h"
#include "ih264_mem_fns.h"
#include "ih264_padding.h"
#include "ih264_structs.h"
#include "ih264_trans_quant_itrans_iquant.h"
#include "ih264_inter_pred_filters.h"
#include "ih264_mem_fns.h"
#include "ih264_padding.h"
#include "ih264_intra_pred_filters.h"
#include "ih264_deblk_edge_filters.h"
#include "ih264_cavlc_tables.h"
#include "ih264_cabac_tables.h"

#include "ime_defs.h"
#include "ime_distortion_metrics.h"
#include "ime_structs.h"

#include "irc_cntrl_param.h"
#include "irc_frame_info_collector.h"

#include "ih264e_error.h"
#include "ih264e_defs.h"
#include "ih264e_rate_control.h"
#include "ih264e_bitstream.h"
#include "ih264e_cabac_structs.h"
#include "ih264e_structs.h"
#include "ih264e_platform_macros.h"
#include "ih264e_cabac.h"
#include "ih264e_half_pel.h"
#include "ih264e_intra_modes_eval.h"
#include "ih264e_core_coding.h"
#include "ih264_cavlc_tables.h"
#include "ih264e_cavlc.h"
#include "ih264e_intra_modes_eval.h"
#include "ih264e_cabac.h"
#include "ih264e_fmt_conv.h"
#include "ih264e_half_pel.h"
#include "ih264e_platform_macros.h"


/*****************************************************************************/
/* Function Definitions */
/*****************************************************************************/

/**
*******************************************************************************
*
* @brief Initialize the intra/inter/transform/deblk function pointers of
* codec context
* @brief Initialize the intra/inter/transform/deblk/entropy function pointers
*
* @par Description: the current routine initializes the function pointers of
* codec context basing on the architecture in use
Expand All @@ -104,9 +111,6 @@
void ih264e_init_function_ptr_neon_a9q(codec_t *ps_codec)
{
WORD32 i= 0;
/* curr proc ctxt */
process_ctxt_t *ps_proc = NULL;
me_ctxt_t *ps_me_ctxt = NULL;

/* Init function pointers for intra pred leaf level functions luma
* Intra 16x16 */
Expand Down Expand Up @@ -146,21 +150,21 @@ void ih264e_init_function_ptr_neon_a9q(codec_t *ps_codec)
ps_codec->apf_intra_pred_c[3] = ih264_intra_pred_chroma_8x8_mode_plane_a9q;

/* Init forward transform fn ptr */
ps_codec->pf_resi_trans_quant_8x8 = ih264_resi_trans_quant_8x8;
ps_codec->pf_resi_trans_quant_4x4 = ih264_resi_trans_quant_4x4_a9;
ps_codec->pf_resi_trans_quant_chroma_4x4 = ih264_resi_trans_quant_chroma_4x4_a9;
ps_codec->pf_hadamard_quant_4x4 = ih264_hadamard_quant_4x4_a9;
ps_codec->pf_hadamard_quant_2x2_uv = ih264_hadamard_quant_2x2_uv_a9;
ps_codec->pf_resi_trans_quant_8x8 = ih264_resi_trans_quant_8x8;
ps_codec->pf_resi_trans_quant_4x4 = ih264_resi_trans_quant_4x4_a9;
ps_codec->pf_resi_trans_quant_chroma_4x4 = ih264_resi_trans_quant_chroma_4x4_a9;
ps_codec->pf_hadamard_quant_4x4 = ih264_hadamard_quant_4x4_a9;
ps_codec->pf_hadamard_quant_2x2_uv = ih264_hadamard_quant_2x2_uv_a9;

/* Init inverse transform fn ptr */
ps_codec->pf_iquant_itrans_recon_8x8 = ih264_iquant_itrans_recon_8x8;
ps_codec->pf_iquant_itrans_recon_4x4 = ih264_iquant_itrans_recon_4x4_a9;
ps_codec->pf_iquant_itrans_recon_4x4_dc = ih264_iquant_itrans_recon_4x4_dc_a9;
ps_codec->pf_iquant_itrans_recon_chroma_4x4 = ih264_iquant_itrans_recon_chroma_4x4_a9;
ps_codec->pf_iquant_itrans_recon_chroma_4x4_dc = ih264_iquant_itrans_recon_chroma_4x4_dc_a9;
ps_codec->pf_ihadamard_scaling_4x4 = ih264_ihadamard_scaling_4x4_a9;
ps_codec->pf_ihadamard_scaling_2x2_uv = ih264_ihadamard_scaling_2x2_uv_a9;
ps_codec->pf_interleave_copy = ih264_interleave_copy_a9;
ps_codec->pf_iquant_itrans_recon_8x8 = ih264_iquant_itrans_recon_8x8;
ps_codec->pf_iquant_itrans_recon_4x4 = ih264_iquant_itrans_recon_4x4_a9;
ps_codec->pf_iquant_itrans_recon_4x4_dc = ih264_iquant_itrans_recon_4x4_dc_a9;
ps_codec->pf_iquant_itrans_recon_chroma_4x4 = ih264_iquant_itrans_recon_chroma_4x4_a9;
ps_codec->pf_iquant_itrans_recon_chroma_4x4_dc = ih264_iquant_itrans_recon_chroma_4x4_dc_a9;
ps_codec->pf_ihadamard_scaling_4x4 = ih264_ihadamard_scaling_4x4_a9;
ps_codec->pf_ihadamard_scaling_2x2_uv = ih264_ihadamard_scaling_2x2_uv_a9;
ps_codec->pf_interleave_copy = ih264_interleave_copy_a9;

/* Init fn ptr luma core coding */
ps_codec->luma_energy_compaction[0] = ih264e_code_luma_intra_macroblock_16x16;
Expand Down Expand Up @@ -218,8 +222,9 @@ void ih264e_init_function_ptr_neon_a9q(codec_t *ps_codec)
/* sad me level functions */
for (i = 0; i < (MAX_PROCESS_CTXT); i++)
{
ps_proc = &ps_codec->as_process[i];
ps_me_ctxt = &ps_proc->s_me_ctxt;
process_ctxt_t *ps_proc = &ps_codec->as_process[i];
me_ctxt_t *ps_me_ctxt = &ps_proc->s_me_ctxt;

ps_me_ctxt->pf_ime_compute_sad_16x16[0] = ime_compute_sad_16x16_a9q;
ps_me_ctxt->pf_ime_compute_sad_16x16[1] = ime_compute_sad_16x16_fast_a9q;
ps_me_ctxt->pf_ime_compute_sad_16x8 = ime_compute_sad_16x8_a9q;
Expand All @@ -242,6 +247,5 @@ void ih264e_init_function_ptr_neon_a9q(codec_t *ps_codec)
/* Halp pel generation function - encoder level */
ps_codec->pf_ih264e_sixtapfilter_horz = ih264e_sixtapfilter_horz_a9q;
ps_codec->pf_ih264e_sixtap_filter_2dvh_vert = ih264e_sixtap_filter_2dvh_vert_a9q;

}

Loading

0 comments on commit ce6b940

Please sign in to comment.