• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <stdio.h>
21 #include "iv_datatypedef.h"
22 #include "iv.h"
23 
24 #include "impeg2_buf_mgr.h"
25 #include "impeg2_disp_mgr.h"
26 #include "impeg2_defs.h"
27 #include "impeg2_platform_macros.h"
28 #include "impeg2_inter_pred.h"
29 #include "impeg2_idct.h"
30 #include "impeg2_globals.h"
31 #include "impeg2_mem_func.h"
32 #include "impeg2_format_conv.h"
33 #include "impeg2_macros.h"
34 
35 #include "impeg2d.h"
36 #include "impeg2d_bitstream.h"
37 #include "impeg2d_structs.h"
38 #include "impeg2d_globals.h"
39 #include "impeg2d_mc.h"
40 
41 /*****************************************************************************/
42 /* MC params table                                                           */
43 /*****************************************************************************/
44 const mc_type_consts_t gas_impeg2d_mc_params_luma[][2] =
45 {
46     /* frame prediction in P frame picture */
47     {{1,0,1,1,MB_SIZE,MB_SIZE,0},
48      {1,0,1,1,MB_SIZE,MB_SIZE,0}},
49     /* field prediction in P frame picture */
50     {{2,0,1,2,MB_SIZE/2,MB_SIZE*2,0},
51      {2,0,1,2,MB_SIZE/2,MB_SIZE*2,1}},
52     /* frame prediction in B frame picture */
53     {{1,0,1,1,MB_SIZE,MB_SIZE,0},
54      {1,0,1,1,MB_SIZE,MB_SIZE,0}},
55     /* field prediction in B frame picture */
56     {{2,0,1,2,MB_SIZE/2,MB_SIZE*2,0},
57      {2,0,1,2,MB_SIZE/2,MB_SIZE*2,1}},
58     /* dual prime prediction in P frame picture */
59     {{2,0,1,2,MB_SIZE/2,MB_SIZE*2,0},
60      {2,0,1,2,MB_SIZE/2,MB_SIZE*2,1}},
61 
62     /* field prediction in P field picture */
63     {{1,0,2,2,MB_SIZE,MB_SIZE,0},{1,0,2,2,MB_SIZE,MB_SIZE,0}},
64     /* 16x8 prediction in P field picture */
65     {{1,0,2,2,MB_SIZE/2,MB_SIZE,0},{1,8,2,2,MB_SIZE/2,MB_SIZE,(1*MB_SIZE/2)}},
66     /* field prediction in B field picture */
67     {{1,0,2,2,MB_SIZE,MB_SIZE,0},{1,0,2,2,MB_SIZE,MB_SIZE,0}},
68     /* 16x8 prediction in B field picture */
69     {{1,0,2,2,MB_SIZE/2,MB_SIZE,0},{1,8,2,2,MB_SIZE/2,MB_SIZE,(1*MB_SIZE/2)}},
70     /* dual prime prediction in P field picture */
71     {{1,0,2,2,MB_SIZE,MB_SIZE,0},{1,0,2,2,MB_SIZE,MB_SIZE,0}}
72 
73 };
74 
75 const mc_type_consts_t gas_impeg2d_mc_params_chroma[10][2] =
76 {
77     /* frame prediction in P frame picture */
78     {{1,0,1,1,MB_CHROMA_SIZE,MB_CHROMA_SIZE,0},{1,0,1,1,MB_CHROMA_SIZE,MB_CHROMA_SIZE,0}},
79     /* field prediction in P frame picture */
80     {{2,0,1,2,MB_CHROMA_SIZE/2,MB_CHROMA_SIZE*2,0},{2,0,1,2,MB_CHROMA_SIZE/2,
81     MB_CHROMA_SIZE*2,1}},
82     /* frame prediction in B frame picture */
83     {{1,0,1,1,MB_CHROMA_SIZE,MB_CHROMA_SIZE,0},{1,0,1,1,MB_CHROMA_SIZE,
84     MB_CHROMA_SIZE,0}},
85     /* field prediction in B frame picture */
86     {{2,0,1,2,MB_CHROMA_SIZE/2,MB_CHROMA_SIZE*2,0},{2,0,1,2,MB_CHROMA_SIZE/2,
87     MB_CHROMA_SIZE*2,1}},
88     /* dual prime prediction in P frame picture */
89     {{2,0,1,2,MB_CHROMA_SIZE/2,MB_CHROMA_SIZE*2,0},{2,0,1,2,MB_CHROMA_SIZE/2,
90     MB_CHROMA_SIZE*2,1}},
91 
92     /* field prediction in P field picture */
93     {{1,0,2,2,MB_CHROMA_SIZE,MB_CHROMA_SIZE,0},{1,0,2,2,MB_CHROMA_SIZE,
94     MB_CHROMA_SIZE,0}},
95     /* 16x8 prediction in P field picture */
96     {{1,0,2,2,MB_CHROMA_SIZE/2,MB_CHROMA_SIZE,0},{1,4,2,2,MB_CHROMA_SIZE/2,
97     MB_CHROMA_SIZE,(1*MB_CHROMA_SIZE/2)}},
98     /* field prediction in B field picture */
99     {{1,0,2,2,MB_CHROMA_SIZE,MB_CHROMA_SIZE,0},{1,0,2,2,MB_CHROMA_SIZE,
100     MB_CHROMA_SIZE,0}},
101     /* 16x8 prediction in B field picture */
102     {{1,0,2,2,MB_CHROMA_SIZE/2,MB_CHROMA_SIZE,0},{1,4,2,2,MB_CHROMA_SIZE/2,
103     MB_CHROMA_SIZE,(1*MB_CHROMA_SIZE/2)}},
104     /* dual prime prediction in P field picture */
105     {{1,0,2,2,MB_CHROMA_SIZE,MB_CHROMA_SIZE,0},{1,0,2,2,MB_CHROMA_SIZE,
106     MB_CHROMA_SIZE,0}}
107 
108 };
109 
110 /*****************************************************************************/
111 /* MC function pointer table                                                 */
112 /*****************************************************************************/
113 const dec_mb_params_t gas_impeg2d_func_frm_fw_or_bk[4] =
114 {
115     /*0MV*/
116     {impeg2d_dec_1mv_mb,MC_FRM_FW_OR_BK_1MV,impeg2d_mc_1mv},
117     /* motion_type Field based */
118     {impeg2d_dec_2mv_fw_or_bk_mb,MC_FRM_FW_OR_BK_2MV,impeg2d_mc_fw_or_bk_mb},
119     /* motion_type Frame based */
120     {impeg2d_dec_1mv_mb,MC_FRM_FW_OR_BK_1MV,impeg2d_mc_1mv},
121     /* motion_type Dual prime based */
122     {impeg2d_dec_frm_dual_prime,MC_FRM_FW_DUAL_PRIME_1MV,impeg2d_mc_frm_dual_prime},
123 };
124 
125 const dec_mb_params_t gas_impeg2d_func_fld_fw_or_bk[4] =
126 {
127     /*0MV*/
128     {impeg2d_dec_1mv_mb,MC_FRM_FW_OR_BK_1MV,impeg2d_mc_1mv},
129     /* motion_type Field based */
130     {impeg2d_dec_1mv_mb,MC_FLD_FW_OR_BK_1MV,impeg2d_mc_1mv},
131     /* motion_type 16x8 MC */
132     {impeg2d_dec_2mv_fw_or_bk_mb,MC_FLD_FW_OR_BK_2MV,impeg2d_mc_fw_or_bk_mb},
133     /* motion_type Dual prime based */
134     {impeg2d_dec_fld_dual_prime,MC_FLD_FW_DUAL_PRIME_1MV,impeg2d_mc_fld_dual_prime},
135 };
136 
137 
138 const dec_mb_params_t gas_impeg2d_func_frm_bi_direct[4] =
139 {
140     {NULL,MC_FRM_FW_OR_BK_1MV,NULL},
141     /* motion_type Field based */
142     {impeg2d_dec_4mv_mb,MC_FRM_FW_AND_BK_4MV,impeg2d_mc_4mv},
143     /* motion_type Frame based */
144     {impeg2d_dec_2mv_interp_mb,MC_FRM_FW_AND_BK_2MV,impeg2d_mc_2mv},
145     /* Reserved not applicable */
146     {NULL,MC_FRM_FW_OR_BK_1MV,NULL},
147 };
148 
149 const dec_mb_params_t gas_impeg2d_func_fld_bi_direct[4] =
150 {
151     {NULL,MC_FRM_FW_OR_BK_1MV,NULL},
152     /* motion_type Field based */
153     {impeg2d_dec_2mv_interp_mb,MC_FLD_FW_AND_BK_2MV,impeg2d_mc_2mv},
154     /* motion_type 16x8 MC */
155     {impeg2d_dec_4mv_mb,MC_FLD_FW_AND_BK_4MV,impeg2d_mc_4mv},
156     /* Reserved not applicable */
157     {NULL,MC_FRM_FW_OR_BK_1MV,NULL},
158 };
159