159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/* ------------------------------------------------------------------
259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * Copyright (C) 1998-2009 PacketVideo
359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong *
459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * Licensed under the Apache License, Version 2.0 (the "License");
559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * you may not use this file except in compliance with the License.
659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * You may obtain a copy of the License at
759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong *
859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong *      http://www.apache.org/licenses/LICENSE-2.0
959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong *
1059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * Unless required by applicable law or agreed to in writing, software
1159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * distributed under the License is distributed on an "AS IS" BASIS,
1259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
1359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * express or implied.
1459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * See the License for the specific language governing permissions
1559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * and limitations under the License.
1659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong * -------------------------------------------------------------------
1759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong */
1859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/*  =====================================================================   */
1959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/*  File: FastCodeMB.h                                                      */
2059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/*  Description: This file contains structure and function prototypes used
2159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong            in FastCodeMB() function. When it is decided to use FastCodeMB
2259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong            instead of CodeMB, all of this prototypes should be migrated to
2359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong            mp4enc_lib.h.                                                   */
2459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/*  Rev:                                                                    */
2559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/*  Created: 8/14/01                                                        */
2659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/* //////////////////////////////////////////////////////////////////////// */
2759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
2859f566c4ec3dfc097ad8163523e522280b27e5c3James Dongtypedef struct struct_approxDCT  approxDCT;
2959f566c4ec3dfc097ad8163523e522280b27e5c3James Dongstruct struct_approxDCT
3059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
3159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    const Int *scale;
3259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int(*DCT)(Int block[ ], Int coeff[ ], approxDCT *);
3359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
3459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    // Threshold value for H.263 Quantizer
3559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int th_app_all[8];
3659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int th_app_odd[8];
3759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int th_app_even[8];
3859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int th_app_even1[8];
3959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int th_app_even2[8];
4059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong};
4159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
4259f566c4ec3dfc097ad8163523e522280b27e5c3James Dongstruct QPstruct
4359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong{
4459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int QPx2 ;
4559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int QP;
4659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int QPdiv2;
4759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int QPx2plus;
4859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong    Int Addition;
4959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong};
5059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
5159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/*---- FastCodeMB.c -----*/
5259f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid initCodeMB(approxDCT *function, Int QP);
5359f566c4ec3dfc097ad8163523e522280b27e5c3James DongPV_STATUS CodeMB_H263(VideoEncData *video, approxDCT *function, Int QP, Int ncoefblck[], Int offset);
5459f566c4ec3dfc097ad8163523e522280b27e5c3James DongPV_STATUS CodeMB_MPEG(VideoEncData *video, approxDCT *function, Int QP, Int ncoefblck[], Int offset);
5559f566c4ec3dfc097ad8163523e522280b27e5c3James DongInt getBlockSAV(Int block[]);
5659f566c4ec3dfc097ad8163523e522280b27e5c3James DongInt Sad8x8(UChar *rec, UChar *prev, Int lx);
5759f566c4ec3dfc097ad8163523e522280b27e5c3James DongInt getBlockSum(UChar *rec, Int lx);
5859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
5959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/*---- AppVCA_dct.c -----*/
6059f566c4ec3dfc097ad8163523e522280b27e5c3James DongInt     AppVCA1_dct(Int block[], Int out[ ], approxDCT *function);
6159f566c4ec3dfc097ad8163523e522280b27e5c3James DongInt     AppVCA2_dct(Int block[], Int out[ ], approxDCT *function);
6259f566c4ec3dfc097ad8163523e522280b27e5c3James DongInt     AppVCA3_dct(Int block[], Int out[ ], approxDCT *function);
6359f566c4ec3dfc097ad8163523e522280b27e5c3James DongInt     AppVCA4_dct(Int block[], Int out[ ], approxDCT *function);
6459f566c4ec3dfc097ad8163523e522280b27e5c3James DongInt     AppVCA5_dct(Int block[], Int out[ ], approxDCT *function);
6559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
6659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/*---- FastQuant.c -----*/
6759f566c4ec3dfc097ad8163523e522280b27e5c3James DongInt cal_dc_scalerENC(Int QP, Int type) ;
6859f566c4ec3dfc097ad8163523e522280b27e5c3James DongInt BlockQuantDequantH263Inter(Int *rcoeff, Int *qcoeff, struct QPstruct *QuantParam,
6959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                               UChar bitmapcol[ ], UChar *bitmaprow, UInt *bitmapzz,
7059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                               Int dctMode, Int comp, Int dummy);
7159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
7259f566c4ec3dfc097ad8163523e522280b27e5c3James DongInt BlockQuantDequantH263Intra(Int *rcoeff, Int *qcoeff, struct QPstruct *QuantParam,
7359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                               UChar bitmapcol[ ], UChar *bitmaprow, UInt *bitmapzz,
7459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                               Int dctMode, Int comp, Int dc_scaler);
7559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
7659f566c4ec3dfc097ad8163523e522280b27e5c3James DongInt BlockQuantDequantH263DCInter(Int *rcoeff, Int *qcoeff, struct QPstruct *QuantParam,
7759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                                 UChar *bitmaprow, UInt *bitmapzz, Int dummy);
7859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
7959f566c4ec3dfc097ad8163523e522280b27e5c3James DongInt BlockQuantDequantH263DCIntra(Int *rcoeff, Int *qcoeff, struct QPstruct *QuantParam,
8059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                                 UChar *bitmaprow, UInt *bitmapzz, Int dc_scaler);
8159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
8259f566c4ec3dfc097ad8163523e522280b27e5c3James DongInt BlockQuantDequantMPEGInter(Int *rcoeff, Int *qcoeff, Int QP, Int *qmat,
8359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                               UChar bitmapcol[ ], UChar *bitmaprow, UInt *bitmapzz,
8459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                               Int DctMode, Int comp, Int dc_scaler);
8559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
8659f566c4ec3dfc097ad8163523e522280b27e5c3James DongInt BlockQuantDequantMPEGIntra(Int *rcoeff, Int *qcoeff, Int QP, Int *qmat,
8759f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                               UChar bitmapcol[ ], UChar *bitmaprow, UInt *bitmapzz,
8859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                               Int DctMode, Int comp, Int dc_scaler);
8959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
9059f566c4ec3dfc097ad8163523e522280b27e5c3James DongInt BlockQuantDequantMPEGDCInter(Int *rcoeff, Int *qcoeff, Int QP, Int *qmat,
9159f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                                 UChar bitmapcol[ ], UChar *bitmaprow, UInt *bitmapzz, Int dummy);
9259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
9359f566c4ec3dfc097ad8163523e522280b27e5c3James DongInt BlockQuantDequantMPEGDCIntra(Int *rcoeff, Int *qcoeff, Int QP, Int *qmat,
9459f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                                 UChar bitmapcol[ ], UChar *bitmaprow, UInt *bitmapzz, Int dc_scaler);
9559f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
9659f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/*---- FastIDCT.c -----*/
9759f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid BlockIDCTMotionComp(Int *block, UChar *bitmapcol, UChar bitmaprow,
9859f566c4ec3dfc097ad8163523e522280b27e5c3James Dong                         Int dctMode, UChar *rec, Int lx, Int intra);
9959f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
10059f566c4ec3dfc097ad8163523e522280b27e5c3James Dong/*---- motion_comp.c -----*/
10159f566c4ec3dfc097ad8163523e522280b27e5c3James Dongvoid PutSkippedBlock(UChar *rec, UChar *prev, Int lx);
10259f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
10359f566c4ec3dfc097ad8163523e522280b27e5c3James Dong
104