18d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S/******************************************************************************
28d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S *
38d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S * Copyright (C) 2015 The Android Open Source Project
48d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S *
58d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S * Licensed under the Apache License, Version 2.0 (the "License");
68d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S * you may not use this file except in compliance with the License.
78d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S * You may obtain a copy of the License at:
88d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S *
98d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S * http://www.apache.org/licenses/LICENSE-2.0
108d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S *
118d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S * Unless required by applicable law or agreed to in writing, software
128d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S * distributed under the License is distributed on an "AS IS" BASIS,
138d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
148d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S * See the License for the specific language governing permissions and
158d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S * limitations under the License.
168d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S *
178d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S *****************************************************************************
188d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
198d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*/
208d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
218d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S/**
228d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*******************************************************************************
238d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @file
248d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  ih264e_modify_frm_rate.c
258d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
268d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @brief
278d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  Functions used to modify frame rate
288d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
298d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @author
308d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  ittiam
318d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
328d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @par List of Functions:
338d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  - ih264e_pd_frm_rate_get_init_free_memtab()
348d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  - ih264e_init_pd_frm_rate()
358d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  - ih264e_update_pd_frm_rate()
368d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  - ih264e_get_pd_avg_frm_rate()
378d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
388d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @remarks
398d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  None
408d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
418d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*******************************************************************************
428d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*/
438d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
448d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S/*****************************************************************************/
458d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S/* File Includes                                                             */
468d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S/*****************************************************************************/
478d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
488d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S/* User include files */
498d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "irc_datatypes.h"
508d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "iv2.h"
518d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "ive2.h"
528d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "ih264_defs.h"
538d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "ih264_structs.h"
548d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "ih264_trans_quant_itrans_iquant.h"
558d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "ih264_inter_pred_filters.h"
568d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "ih264_mem_fns.h"
578d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "ih264_padding.h"
588d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "ih264_intra_pred_filters.h"
598d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "ih264_deblk_edge_filters.h"
603749f6f435e79624f72841e866245d84195551cdHarinarayanan K K#include "ih264_cabac_tables.h"
618d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "ih264e_error.h"
628d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "ih264e_bitstream.h"
638d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "ih264e_defs.h"
648d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "ime_distortion_metrics.h"
653749f6f435e79624f72841e866245d84195551cdHarinarayanan K K#include "ime_defs.h"
668d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "ime_structs.h"
678d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "irc_cntrl_param.h"
688d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "irc_frame_info_collector.h"
698d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "ih264e_rate_control.h"
703749f6f435e79624f72841e866245d84195551cdHarinarayanan K K#include "ih264e_cabac_structs.h"
718d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "ih264e_structs.h"
728d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "ih264e_rc_mem_interface.h"
738d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "ih264e_time_stamp.h"
748d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S#include "ih264e_modify_frm_rate.h"
758d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
768d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
778d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S/*****************************************************************************/
788d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S/* Function Definitions                                                      */
798d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S/*****************************************************************************/
808d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
818d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S/**
828d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*******************************************************************************
838d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
848d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @brief Function to init pd frame rate memtab
858d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
868d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @par Description
878d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  Function to init pull down frame rate memtab
888d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
898d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @param[in] pps_pd_frm_rate
908d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  pull down frame rate context
918d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
928d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @param[in] ps_memtab
938d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  Handle to memtab
948d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
958d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @param[in] e_func_type
968d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  Function type (get memtab/ update memtab)
978d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
988d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @returns  Number of memtabs used
998d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
1008d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @remarks  None
1018d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
1028d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*******************************************************************************
1038d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*/
1048d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha SWORD32 ih264e_pd_frm_rate_get_init_free_memtab(pd_frm_rate_handle *pps_pd_frm_rate,
1058d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S                                               itt_memtab_t *ps_memtab,
1068d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S                                               ITT_FUNC_TYPE_E e_func_type)
1078d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S{
1088d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    WORD32 i4_mem_tab_idx = 0;
109c22addc6ee9c96f2996001362dbe39dd5e14038dMartin Storsjo    pd_frm_rate_t s_temp_pd_frm_rate_t;
1108d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
1118d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    /* Hack for al alloc, during which we dont have any state memory.
1128d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S     Dereferencing can cause issues */
1138d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    if (e_func_type == GET_NUM_MEMTAB || e_func_type == FILL_MEMTAB)
1148d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S        (*pps_pd_frm_rate) = &s_temp_pd_frm_rate_t;
1158d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
1168d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    /* for src rate control state structure */
1178d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    if (e_func_type != GET_NUM_MEMTAB)
1188d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    {
1198d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S        fill_memtab(&ps_memtab[i4_mem_tab_idx], sizeof(pd_frm_rate_t),
1208d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S                    ALIGN_128_BYTE, PERSISTENT, DDR);
1218d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S        use_or_fill_base(&ps_memtab[0], (void**) pps_pd_frm_rate, e_func_type);
1228d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    }
1238d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    i4_mem_tab_idx++;
1248d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
1258d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    return (i4_mem_tab_idx);
1268d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S}
1278d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
1288d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S/**
1298d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*******************************************************************************
1308d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
1318d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @brief Initializes the pull down frame rate state structure based on input
1328d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  frame rate
1338d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
1348d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @par Description
1358d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  Initializes the pull down frame rate state structure based on input frame rate
1368d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
1378d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @param[in] ps_pd_frm_rate
1388d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  Pull down frame rate context
1398d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
1408d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @param[in] u4_input_frm_rate
1418d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  Input frame rate in frame per 1000sec
1428d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
1438d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @returns none
1448d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
1458d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @remarks
1468d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
1478d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*******************************************************************************
1488d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*/
1498d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha Svoid ih264e_init_pd_frm_rate(pd_frm_rate_t *ps_pd_frm_rate,
1508d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S                             UWORD32 u4_input_frm_rate)
1518d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S{
1528d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    WORD32 i;
1538d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
1548d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    ps_pd_frm_rate->u4_input_frm_rate = u4_input_frm_rate;
1558d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
1568d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    for (i = 0; i < (WORD32) (u4_input_frm_rate / 1000); i++)
1578d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    {
1588d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S        ps_pd_frm_rate->u4_cur_frm_rate[i] = u4_input_frm_rate;
1598d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    }
1608d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
1618d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    ps_pd_frm_rate->u4_frm_num = 0;
1628d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
1638d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    ps_pd_frm_rate->u4_tot_frm_encoded = 0;
1648d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S}
1658d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
1668d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S/**
1678d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*******************************************************************************
1688d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
1698d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @brief Function to update pull down frame rate
1708d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
1718d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @par   Description
1728d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  For each frame a run time frame rate value is sent based on whether a frame
1738d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  is skipped or not. If it is skipped for pull down then the current frame
1748d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  rate for the pull down period is signaled as 4/5th of the original frame
1758d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  rate. Thus when this is averaged the frame rate gradually switches from the
1768d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  input frame rate to 4/5th of input frame rate as and when more 3:2 pull
1778d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  down patterns are detected
1788d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
1798d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @param[in] ps_pd_frm_rate
1808d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  Pull down frame rate context
1818d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
1828d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @param[in] u4_input_frm_rate
1838d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  Input frame rate in frame per 1000sec
1848d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
1858d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @returns none
1868d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
1878d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @remarks
1888d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
1898d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*******************************************************************************
1908d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*/
1918d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha Svoid ih264e_update_pd_frm_rate(pd_frm_rate_t *ps_pd_frm_rate,
1928d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S                               UWORD32 u4_cur_frm_rate)
1938d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S{
1948d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    ps_pd_frm_rate->u4_cur_frm_rate[ps_pd_frm_rate->u4_frm_num] = u4_cur_frm_rate;
1958d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
1968d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    ps_pd_frm_rate->u4_frm_num++;
1978d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
1988d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    /* Increment the frame number */
1998d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    if (ps_pd_frm_rate->u4_tot_frm_encoded < (ps_pd_frm_rate->u4_input_frm_rate / 1000))
2008d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    {
2018d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S        ps_pd_frm_rate->u4_tot_frm_encoded++;
2028d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    }
2038d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
2048d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    /* Reset frm_num to zero  */
2058d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    if (ps_pd_frm_rate->u4_frm_num >= (ps_pd_frm_rate->u4_input_frm_rate / 1000))
2068d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    {
2078d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S        ps_pd_frm_rate->u4_frm_num = 0;
2088d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    }
2098d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S}
2108d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
2118d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S/**
2128d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*******************************************************************************
2138d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
2148d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @brief returns average frame rate in 1 sec duration
2158d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
2168d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @par Description
2178d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  Averages the last N frame in period(1 sec) and then gives that
2188d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  as the current frames frame rate. Thus this averages out the sudden
2198d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  variation in frame rate
2208d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
2218d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @param[in] ps_pd_frm_rate
2228d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*  Handle to pull down frame rate context
2238d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
2248d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @returns average frame rate
2258d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
2268d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S* @remarks
2278d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*
2288d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*******************************************************************************
2298d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S*/
2308d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha SUWORD32 ih264e_get_pd_avg_frm_rate(pd_frm_rate_t *ps_pd_frm_rate)
2318d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S{
2328d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    WORD32 i;
2338d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    WORD32 i4_avg_frm_rate = 0;
2348d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
2358d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    for (i = 0; i < (WORD32) ps_pd_frm_rate->u4_tot_frm_encoded; i++)
2368d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    {
2378d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S        i4_avg_frm_rate += ps_pd_frm_rate->u4_cur_frm_rate[i];
2388d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    }
2398d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
2408d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    i4_avg_frm_rate = i4_avg_frm_rate / ps_pd_frm_rate->u4_tot_frm_encoded;
2418d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S
2428d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S    return i4_avg_frm_rate;
2438d3d303c7942ced6a987a52db8977d768dc3605fHamsalekha S}
244