142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong/* ------------------------------------------------------------------
242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong * Copyright (C) 1998-2009 PacketVideo
342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong *
442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong * Licensed under the Apache License, Version 2.0 (the "License");
542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong * you may not use this file except in compliance with the License.
642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong * You may obtain a copy of the License at
742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong *
842ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong *      http://www.apache.org/licenses/LICENSE-2.0
942ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong *
1042ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong * Unless required by applicable law or agreed to in writing, software
1142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong * distributed under the License is distributed on an "AS IS" BASIS,
1242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
1342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong * express or implied.
1442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong * See the License for the specific language governing permissions
1542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong * and limitations under the License.
1642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong * -------------------------------------------------------------------
1742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong */
1842ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#ifndef _MP4ENC_LIB_H_
1942ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#define _MP4ENC_LIB_H_
2042ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
2142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#include "mp4def.h"     // typedef
2242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#include "mp4lib_int.h" // main video structure
2342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
2442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#ifdef __cplusplus
2542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dongextern "C"
2642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong{
2742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#endif
2842ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
2942ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    /* defined in vop.c */
3042ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    PV_STATUS EncodeVop(VideoEncData *video);
3142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    PV_STATUS EncodeSlice(VideoEncData *video);
3242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    PV_STATUS EncodeVideoPacketHeader(VideoEncData *video, int MB_number,
3342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong                                      int quant_scale, Int insert);
3442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#ifdef ALLOW_VOP_NOT_CODED
3542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    PV_STATUS EncodeVopNotCoded(VideoEncData *video, UChar *bstream, Int *size, ULong modTime);
3642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#endif
3742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
3842ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    /* defined in combined_decode.c */
3942ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    PV_STATUS EncodeFrameCombinedMode(VideoEncData *video);
4042ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    PV_STATUS EncodeSliceCombinedMode(VideoEncData *video);
4142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
4242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    /* defined in datapart_decode.c */
4342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    PV_STATUS EncodeFrameDataPartMode(VideoEncData *video);
4442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    PV_STATUS EncodeSliceDataPartMode(VideoEncData *video);
4542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
4642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    /* defined in fastcodeMB.c */
4742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
4842ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong//void m4v_memset(void *adr_dst, uint8 value, uint32 size);
4942ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
5042ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    PV_STATUS CodeMB_H263(VideoEncData *video, approxDCT *function, Int offsetQP, Int ncoefblck[]);
5142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#ifndef NO_MPEG_QUANT
5242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    PV_STATUS CodeMB_MPEG(VideoEncData *video, approxDCT *function, Int offsetQP, Int ncoefblck[]);
5342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#endif
5442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int getBlockSAV(Short block[]);
5542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int Sad8x8(UChar *rec, UChar *prev, Int lx);
5642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int getBlockSum(UChar *rec, Int lx);
5742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
5842ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    /* defined in dct.c */
5942ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void  blockIdct(Short *block);
6042ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void blockIdct_SSE(Short *input);
6142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void BlockDCTEnc(Short *blockData, Short *blockCoeff);
6242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
6342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    /*---- FastQuant.c -----*/
6442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int cal_dc_scalerENC(Int QP, Int type) ;
6542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int BlockQuantDequantH263Inter(Short *rcoeff, Short *qcoeff, struct QPstruct *QuantParam,
6642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong                                   UChar bitmapcol[ ], UChar *bitmaprow, UInt *bitmapzz,
6742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong                                   Int dctMode, Int comp, Int dummy, UChar shortHeader);
6842ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
6942ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int BlockQuantDequantH263Intra(Short *rcoeff, Short *qcoeff, struct QPstruct *QuantParam,
7042ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong                                   UChar bitmapcol[ ], UChar *bitmaprow, UInt *bitmapzz,
7142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong                                   Int dctMode, Int comp, Int dc_scaler, UChar shortHeader);
7242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
7342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int BlockQuantDequantH263DCInter(Short *rcoeff, Short *qcoeff, struct QPstruct *QuantParam,
7442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong                                     UChar *bitmaprow, UInt *bitmapzz, Int dummy, UChar shortHeader);
7542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
7642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int BlockQuantDequantH263DCIntra(Short *rcoeff, Short *qcoeff, struct QPstruct *QuantParam,
7742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong                                     UChar *bitmaprow, UInt *bitmapzz, Int dc_scaler, UChar shortHeader);
7842ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
7942ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#ifndef NO_MPEG_QUANT
8042ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int BlockQuantDequantMPEGInter(Short *rcoeff, Short *qcoeff, Int QP, Int *qmat,
8142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong                                   UChar bitmapcol[ ], UChar *bitmaprow, UInt *bitmapzz,
8242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong                                   Int DctMode, Int comp, Int dc_scaler);
8342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
8442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int BlockQuantDequantMPEGIntra(Short *rcoeff, Short *qcoeff, Int QP, Int *qmat,
8542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong                                   UChar bitmapcol[ ], UChar *bitmaprow, UInt *bitmapzz,
8642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong                                   Int DctMode, Int comp, Int dc_scaler);
8742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
8842ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int BlockQuantDequantMPEGDCInter(Short *rcoeff, Short *qcoeff, Int QP, Int *qmat,
8942ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong                                     UChar bitmapcol[ ], UChar *bitmaprow, UInt *bitmapzz, Int dummy);
9042ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
9142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int BlockQuantDequantMPEGDCIntra(Short *rcoeff, Short *qcoeff, Int QP, Int *qmat,
9242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong                                     UChar bitmapcol[ ], UChar *bitmaprow, UInt *bitmapzz, Int dc_scaler);
9342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#endif
9442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
9542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    /*---- FastIDCT.c -----*/
9642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void BlockIDCTMotionComp(Short *block, UChar *bitmapcol, UChar bitmaprow,
9742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong                             Int dctMode, UChar *rec, UChar *prev, Int lx_intra_zeroMV);
9842ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
9942ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
10042ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    /* defined in motion_comp.c */
10142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void getMotionCompensatedMB(VideoEncData *video, Int ind_x, Int ind_y, Int offset);
10242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void EncPrediction_INTER(Int xpred, Int ypred, UChar *c_prev, UChar *c_rec,
10342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong                             Int width, Int round1);
10442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
10542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void EncPrediction_INTER4V(Int xpred, Int ypred, MOT *mot, UChar *c_prev, UChar *c_rec,
10642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong                               Int width, Int round1);
10742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
10842ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void EncPrediction_Chrom(Int xpred, Int ypred, UChar *cu_prev, UChar *cv_prev, UChar *cu_rec,
10942ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong                             UChar *cv_rec, Int pitch_uv, Int width_uv, Int height_uv, Int round1);
11042ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
11142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void get_MB(UChar *c_prev, UChar *c_prev_u  , UChar *c_prev_v,
11242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong                Short mb[6][64], Int width, Int width_uv);
11342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
11442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void PutSkippedBlock(UChar *rec, UChar *prev, Int lx);
11542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
11642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    /* defined in motion_est.c */
11742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void MotionEstimation(VideoEncData *video);
11842ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#ifdef HTFM
11942ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void InitHTFM(VideoEncData *video, HTFM_Stat *htfm_stat, double *newvar, Int *collect);
12042ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void UpdateHTFM(VideoEncData *video, double *newvar, double *exp_lamda, HTFM_Stat *htfm_stat);
12142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#endif
12242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
12342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    /* defined in ME_utils.c */
12442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void ChooseMode_C(UChar *Mode, UChar *cur, Int lx, Int min_SAD);
12542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void ChooseMode_MMX(UChar *Mode, UChar *cur, Int lx, Int min_SAD);
12642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void GetHalfPelMBRegion_C(UChar *cand, UChar *hmem, Int lx);
12742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void GetHalfPelMBRegion_SSE(UChar *cand, UChar *hmem, Int lx);
12842ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void GetHalfPelBlkRegion(UChar *cand, UChar *hmem, Int lx);
12942ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void PaddingEdge(Vop *padVop);
13042ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void ComputeMBSum_C(UChar *cur, Int lx, MOT *mot_mb);
13142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void ComputeMBSum_MMX(UChar *cur, Int lx, MOT *mot_mb);
13242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void ComputeMBSum_SSE(UChar *cur, Int lx, MOT *mot_mb);
13342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void GetHalfPelMBRegionPadding(UChar *ncand, UChar *hmem, Int lx, Int *reptl);
13442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void GetHalfPelBlkRegionPadding(UChar *ncand, UChar *hmem, Int lx, Int *reptl);
13542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
13642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    /* defined in findhalfpel.c */
13742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void FindHalfPelMB(VideoEncData *video, UChar *cur, MOT *mot, UChar *ncand,
13842ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong                       Int xpos, Int ypos, Int *xhmin, Int *yhmin, Int hp_guess);
13942ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int  FindHalfPelBlk(VideoEncData *video, UChar *cur, MOT *mot, Int sad16, UChar *ncand8[],
14042ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong                        UChar *mode, Int xpos, Int ypos, Int *xhmin, Int *yhmin, UChar *hp_mem);
14142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
14242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
14342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    /* defined in sad.c */
14442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_MB_HalfPel_Cxhyh(UChar *ref, UChar *blk, Int dmin_lx, void *extra_info);
14542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_MB_HalfPel_Cyh(UChar *ref, UChar *blk, Int dmin_lx, void *extra_info);
14642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_MB_HalfPel_Cxh(UChar *ref, UChar *blk, Int dmin_lx, void *extra_info);
14742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_MB_HalfPel_MMX(UChar *ref, UChar *blk, Int dmin_lx, void *extra_info);
14842ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_MB_HalfPel_SSE(UChar *ref, UChar *blk, Int dmin_lx, void *extra_info);
14942ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_Blk_HalfPel_C(UChar *ref, UChar *blk, Int dmin, Int lx, Int rx, Int xh, Int yh, void *extra_info);
15042ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_Blk_HalfPel_MMX(UChar *ref, UChar *blk, Int dmin, Int lx, void *extra_info);
15142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_Blk_HalfPel_SSE(UChar *ref, UChar *blk, Int dmin, Int lx, void *extra_info);
15242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_Macroblock_C(UChar *ref, UChar *blk, Int dmin_lx, void *extra_info);
15342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_Macroblock_MMX(UChar *ref, UChar *blk, Int dmin_lx, void *extra_info);
15442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_Macroblock_SSE(UChar *ref, UChar *blk, Int dmin_lx, void *extra_info);
15542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_Block_C(UChar *ref, UChar *blk, Int dmin, Int lx, void *extra_info);
15642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_Block_MMX(UChar *ref, UChar *blk, Int dmin, Int lx, void *extra_info);
15742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_Block_SSE(UChar *ref, UChar *blk, Int dmin, Int lx, void *extra_info);
15842ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
15942ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#ifdef HTFM /* Hypothesis Testing Fast Matching */
16042ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_MB_HP_HTFM_Collectxhyh(UChar *ref, UChar *blk, Int dmin_x, void *extra_info);
16142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_MB_HP_HTFM_Collectyh(UChar *ref, UChar *blk, Int dmin_x, void *extra_info);
16242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_MB_HP_HTFM_Collectxh(UChar *ref, UChar *blk, Int dmin_x, void *extra_info);
16342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_MB_HP_HTFMxhyh(UChar *ref, UChar *blk, Int dmin_lx, void *extra_info);
16442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_MB_HP_HTFMyh(UChar *ref, UChar *blk, Int dmin_lx, void *extra_info);
16542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_MB_HP_HTFMxh(UChar *ref, UChar *blk, Int dmin_lx, void *extra_info);
16642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_MB_HTFM_Collect(UChar *ref, UChar *blk, Int dmin_lx, void *extra_info);
16742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_MB_HTFM(UChar *ref, UChar *blk, Int dmin_lx, void *extra_info);
16842ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#endif
16942ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    /* on-the-fly padding */
17042ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_Blk_PADDING(UChar *ref, UChar *cur, Int dmin, Int lx, void *extra_info);
17142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_MB_PADDING(UChar *ref, UChar *cur, Int dmin, Int lx, void *extra_info);
17242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#ifdef HTFM
17342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_MB_PADDING_HTFM_Collect(UChar *ref, UChar *blk, Int dmin, Int lx, void *extra_info);
17442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int SAD_MB_PADDING_HTFM(UChar *ref, UChar *blk, Int dmin, Int lx, void *extra_info);
17542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#endif
17642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
17742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    /* defined in rate_control.c */
17842ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    /* These are APIs to rate control exposed to core encoder module. */
17942ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    PV_STATUS RC_Initialize(void *video);
18042ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    PV_STATUS RC_VopQPSetting(VideoEncData *video, rateControl *rc[]);
18142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    PV_STATUS RC_VopUpdateStat(VideoEncData *video, rateControl *rc);
18242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    PV_STATUS RC_MBQPSetting(VideoEncData *video, rateControl *rc, Int start_packet_header);
18342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    PV_STATUS RC_MBUpdateStat(VideoEncData *video, rateControl *rc, Int Bi, Int Hi);
18442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    PV_STATUS RC_Cleanup(rateControl *rc[], Int numLayers);
18542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
18642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int       RC_GetSkipNextFrame(VideoEncData *video, Int currLayer);
18742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    Int       RC_GetRemainingVops(VideoEncData *video, Int currLayer);
18842ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void      RC_ResetSkipNextFrame(VideoEncData *video, Int currLayer);
18942ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    PV_STATUS RC_UpdateBuffer(VideoEncData *video, Int currLayer, Int num_skip);
19042ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    PV_STATUS RC_UpdateBXRCParams(void *input);
19142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
19242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
19342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    /* defined in vlc_encode.c */
19442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void MBVlcEncodeDataPar_I_VOP(VideoEncData *video, Int ncoefblck[], void *blkCodePtr);
19542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void MBVlcEncodeDataPar_P_VOP(VideoEncData *video, Int ncoefblck[], void *blkCodePtr);
19642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void MBVlcEncodeCombined_I_VOP(VideoEncData *video, Int ncoefblck[], void *blkCodePtr);
19742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void MBVlcEncodeCombined_P_VOP(VideoEncData *video, Int ncoefblck[], void *blkCodePtr);
19842ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void BlockCodeCoeff_ShortHeader(RunLevelBlock *RLB, BitstreamEncVideo *bs, Int j_start, Int j_stop, UChar Mode);
19942ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void BlockCodeCoeff_RVLC(RunLevelBlock *RLB, BitstreamEncVideo *bs, Int j_start, Int j_stop, UChar Mode);
20042ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong    void BlockCodeCoeff_Normal(RunLevelBlock *RLB, BitstreamEncVideo *bs, Int j_start, Int j_stop, UChar Mode);
20142ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
20242ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#ifdef __cplusplus
20342ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong}
20442ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#endif
20542ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
20642ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong#endif /* _MP4ENC_LIB_H_ */
20742ef0c715da879a9878b7bf4eb9c90b21e4ab8aeJames Dong
208