Home | History | Annotate | Download | only in decoder
      1 /******************************************************************************
      2  *
      3  * Copyright (C) 2015 The Android Open Source Project
      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  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
     19 */
     20 
     21 #ifndef _IH264D_MVPRED_H_
     22 #define _IH264D_MVPRED_H_
     23 
     24 /**
     25 **************************************************************************
     26 * \file ih264d_mvpred.h
     27 *
     28 * \brief
     29 *    This file contains declarations of functions specific to decoding
     30 *    Motion vector.
     31 *
     32 * Detailed_description
     33 *
     34 * \date
     35 *    10-12-2002
     36 *
     37 * \author  Arvind Raman
     38 **************************************************************************
     39 */
     40 #include "ih264d_structs.h"
     41 #include "ih264d_defs.h"
     42 //#include "structs.h"
     43 
     44 /** Reference number that is not valid */
     45 #define OUT_OF_RANGE_REF  -1
     46 
     47 #define ONE_TO_ONE    0
     48 #define FRM_TO_FLD    1
     49 #define FLD_TO_FRM    2
     50 
     51 /**
     52 **************************************************************************
     53 *   \brief   POSITION_IN_MVBANK
     54 *
     55 *   a: Pointer to the top left subMb of the MB in the MV bank array
     56 *   b: Horiz posn in terms of subMbs
     57 *   c: Vert posn in terms of subMbs
     58 *   d: subMb number
     59 **************************************************************************
     60 */
     61 #define POSITION_IN_MVBANK(a, b, c, d) (a) + (c) * (d) + (b)
     62 
     63 
     64 
     65 /**
     66 **************************************************************************
     67 *   \brief   col4x4_t
     68 *
     69 *   Container to return the information related to the co-located 4x4
     70 *   sub-macroblock.
     71 **************************************************************************
     72 */
     73 typedef struct
     74 {
     75   mv_pred_t *ps_mv;     /** Ptr to the Mv bank */
     76   UWORD16 u2_mb_addr_col;       /** Addr of the co-located MB */
     77   WORD16 i2_mv[2];      /** Mv of the colocated MB */
     78   WORD8 i1_ref_idx_col;     /** Ref idx of the co-located picture */
     79   UWORD8 u1_col_pic;        /** Idx of the colocated pic */
     80   UWORD8 u1_yM;     /** "y" coord of the colocated MB addr */
     81   UWORD8 u1_vert_mv_scale;      /** as defined in sec 8.4.1.2.1 */
     82 } col4x4_t;
     83 
     84 
     85 
     86 
     87 
     88 void ih264d_update_nnz_for_skipmb(dec_struct_t * ps_dec,
     89                                   dec_mb_info_t * ps_cur_mb_info,
     90                                   UWORD8 u1_entrpy);
     91 
     92 void ih264d_get_motion_vector_predictor(mv_pred_t * ps_result,
     93                                         mv_pred_t **ps_mv_pred,
     94                                         UWORD8 u1_ref_idx,
     95                                         UWORD8 u1_B,
     96                                         const UWORD8 *pu1_mv_pred_condition);
     97 void ih264d_mbaff_mv_pred(mv_pred_t **ps_mv_pred,
     98                           UWORD8 u1_sub_mb_num,
     99                           mv_pred_t *ps_mv_nmb,
    100                           mv_pred_t *ps_mv_ntop,
    101                           dec_struct_t *ps_dec,
    102                           UWORD8 uc_mb_part_width,
    103                           dec_mb_info_t *ps_cur_mb_info,
    104                           UWORD8* pu0_scale);
    105 void ih264d_non_mbaff_mv_pred(mv_pred_t **ps_mv_pred,
    106                               UWORD8 u1_sub_mb_num,
    107                               mv_pred_t *ps_mv_nmb,
    108                               mv_pred_t *ps_mv_ntop,
    109                               dec_struct_t *ps_dec,
    110                               UWORD8 uc_mb_part_width,
    111                               dec_mb_info_t *ps_cur_mb_info);
    112 UWORD8 ih264d_mvpred_nonmbaff(dec_struct_t *ps_dec,
    113                               dec_mb_info_t *ps_cur_mb_info,
    114                               mv_pred_t *ps_mv_nmb,
    115                               mv_pred_t *ps_mv_ntop,
    116                               mv_pred_t *ps_mv_final_pred,
    117                               UWORD8 u1_sub_mb_num,
    118                               UWORD8 uc_mb_part_width,
    119                               UWORD8 u1_lx_start,
    120                               UWORD8 u1_lxend,
    121                               UWORD8 u1_mb_mc_mode);
    122 
    123 UWORD8 ih264d_mvpred_nonmbaffB(dec_struct_t *ps_dec,
    124                                dec_mb_info_t *ps_cur_mb_info,
    125                                mv_pred_t *ps_mv_nmb,
    126                                mv_pred_t *ps_mv_ntop,
    127                                mv_pred_t *ps_mv_final_pred,
    128                                UWORD8 u1_sub_mb_num,
    129                                UWORD8 uc_mb_part_width,
    130                                UWORD8 u1_lx_start,
    131                                UWORD8 u1_lxend,
    132                                UWORD8 u1_mb_mc_mode);
    133 
    134 UWORD8 ih264d_mvpred_mbaff(dec_struct_t *ps_dec,
    135                            dec_mb_info_t *ps_cur_mb_info,
    136                            mv_pred_t *ps_mv_nmb,
    137                            mv_pred_t *ps_mv_ntop,
    138                            mv_pred_t *ps_mv_final_pred,
    139                            UWORD8 u1_sub_mb_num,
    140                            UWORD8 uc_mb_part_width,
    141                            UWORD8 u1_lx_start,
    142                            UWORD8 u1_lxend,
    143                            UWORD8 u1_mb_mc_mode);
    144 
    145 void ih264d_rep_mv_colz(dec_struct_t *ps_dec,
    146                         mv_pred_t *ps_mv_pred_src,
    147                         mv_pred_t *ps_mv_pred_dst,
    148                         UWORD8 u1_sub_mb_num,
    149                         UWORD8 u1_colz,
    150                         UWORD8 u1_ht,
    151                         UWORD8 u1_wd);
    152 
    153 #endif  /* _IH264D_MVPRED_H_ */
    154