History

interface clean and inside modification

clean and comment some API. move the SKIP mv pred location remove the unused buffer in intra construction.

huili2 committed 12 years ago

Commit 32fd2c41 parent 42389009 files · +162 −185Browse files

Showing the changes to codec/decoder/core/src/mv_pred.cpp (1 of 9 files). Show all

Unified · Split

codec/decoder/core/src/mv_pred.cpp+149−0
@@ -43,6 +43,155 @@ · 42 unmodified lines
43#include "mb_cache.h"43#include "mb_cache.h"
44 44
45namespace WelsDec {45namespace WelsDec {
46void_t PredPSkipMvFromNeighbor (PDqLayer pCurLayer, int16_t iMvp[2]) {
47 bool_t bTopAvail, bLeftTopAvail, bRightTopAvail, bLeftAvail;
48
49 int32_t iCurSliceIdc, iTopSliceIdc, iLeftTopSliceIdc, iRightTopSliceIdc, iLeftSliceIdc;
50 int32_t iLeftTopType, iRightTopType, iTopType, iLeftType;
51 int32_t iCurX, iCurY, iCurXy, iLeftXy, iTopXy, iLeftTopXy, iRightTopXy;
52
53 int8_t iLeftRef;
54 int8_t iTopRef;
55 int8_t iRightTopRef;
56 int8_t iLeftTopRef;
57 int8_t iDiagonalRef;
58 int8_t iMatchRef;
59 int16_t iMvA[2], iMvB[2], iMvC[2], iMvD[2];
60
61 iCurXy = pCurLayer->iMbXyIndex;
62 iCurX = pCurLayer->iMbX;
63 iCurY = pCurLayer->iMbY;
64 iCurSliceIdc = pCurLayer->pSliceIdc[iCurXy];
65
66 if (iCurX != 0) {
67 iLeftXy = iCurXy - 1;
68 iLeftSliceIdc = pCurLayer->pSliceIdc[iLeftXy];
69 bLeftAvail = (iLeftSliceIdc == iCurSliceIdc);
70 } else {
71 bLeftAvail = 0;
72 bLeftTopAvail = 0;
73 }
74
75 if (iCurY != 0) {
76 iTopXy = iCurXy - pCurLayer->iMbWidth;
77 iTopSliceIdc = pCurLayer->pSliceIdc[iTopXy];
78 bTopAvail = (iTopSliceIdc == iCurSliceIdc);
79 if (iCurX != 0) {
80 iLeftTopXy = iTopXy - 1;
81 iLeftTopSliceIdc = pCurLayer->pSliceIdc[iLeftTopXy];
82 bLeftTopAvail = (iLeftTopSliceIdc == iCurSliceIdc);
83 } else {
84 bLeftTopAvail = 0;
85 }
86 if (iCurX != (pCurLayer->iMbWidth - 1)) {
87 iRightTopXy = iTopXy + 1;
88 iRightTopSliceIdc = pCurLayer->pSliceIdc[iRightTopXy];
89 bRightTopAvail = (iRightTopSliceIdc == iCurSliceIdc);
90 } else {
91 bRightTopAvail = 0;
92 }
93 } else {
94 bTopAvail = 0;
95 bLeftTopAvail = 0;
96 bRightTopAvail = 0;
97 }
98
99 iLeftType = ((iCurX != 0 && bLeftAvail) ? pCurLayer->pMbType[iLeftXy] : 0);
100 iTopType = ((iCurY != 0 && bTopAvail) ? pCurLayer->pMbType[iTopXy] : 0);
101 iLeftTopType = ((iCurX != 0 && iCurY != 0 && bLeftTopAvail)
102 ? pCurLayer->pMbType[iLeftTopXy] : 0);
103 iRightTopType = ((iCurX != pCurLayer->iMbWidth - 1 && iCurY != 0 && bRightTopAvail)
104 ? pCurLayer->pMbType[iRightTopXy] : 0);
105
106 /*get neb mv&iRefIdxArray*/
107 /*left*/
108 if (bLeftAvail && IS_INTER (iLeftType)) {
109 ST32 (iMvA, LD32 (pCurLayer->pMv[0][iLeftXy][3]));
110 iLeftRef = pCurLayer->pRefIndex[0][iLeftXy][3];
111 } else {
112 ST32 (iMvA, 0);
113 if (0 == bLeftAvail) { //not available
114 iLeftRef = REF_NOT_AVAIL;
115 } else { //available but is intra mb type
116 iLeftRef = REF_NOT_IN_LIST;
117 }
118 }
119 if (REF_NOT_AVAIL == iLeftRef ||
120 (0 == iLeftRef && 0 == * (int32_t*)iMvA)) {
121 ST32 (iMvp, 0);
122 return;
123 }
124
125 /*top*/
126 if (bTopAvail && IS_INTER (iTopType)) {
127 ST32 (iMvB, LD32 (pCurLayer->pMv[0][iTopXy][12]));
128 iTopRef = pCurLayer->pRefIndex[0][iTopXy][12];
129 } else {
130 ST32 (iMvB, 0);
131 if (0 == bTopAvail) { //not available
132 iTopRef = REF_NOT_AVAIL;
133 } else { //available but is intra mb type
134 iTopRef = REF_NOT_IN_LIST;
135 }
136 }
137 if (REF_NOT_AVAIL == iTopRef ||
138 (0 == iTopRef && 0 == * (int32_t*)iMvB)) {
139 ST32 (iMvp, 0);
140 return;
141 }
142
143 /*right_top*/
144 if (bRightTopAvail && IS_INTER (iRightTopType)) {
145 ST32 (iMvC, LD32 (pCurLayer->pMv[0][iRightTopXy][12]));
146 iRightTopRef = pCurLayer->pRefIndex[0][iRightTopXy][12];
147 } else {
148 ST32 (iMvC, 0);
149 if (0 == bRightTopAvail) { //not available
150 iRightTopRef = REF_NOT_AVAIL;
151 } else { //available but is intra mb type
152 iRightTopRef = REF_NOT_IN_LIST;
153 }
154 }
155
156 /*left_top*/
157 if (bLeftTopAvail && IS_INTER (iLeftTopType)) {
158 ST32 (iMvD, LD32 (pCurLayer->pMv[0][iLeftTopXy][15]));
159 iLeftTopRef = pCurLayer->pRefIndex[0][iLeftTopXy][15];
160 } else {
161 ST32 (iMvD, 0);
162 if (0 == bLeftTopAvail) { //not available
163 iLeftTopRef = REF_NOT_AVAIL;
164 } else { //available but is intra mb type
165 iLeftTopRef = REF_NOT_IN_LIST;
166 }
167 }
168
169 iDiagonalRef = iRightTopRef;
170 if (REF_NOT_AVAIL == iDiagonalRef) {
171 iDiagonalRef = iLeftTopRef;
172 * (int32_t*)iMvC = * (int32_t*)iMvD;
173 }
174
175 if (REF_NOT_AVAIL == iTopRef && REF_NOT_AVAIL == iDiagonalRef && iLeftRef >= REF_NOT_IN_LIST) {
176 ST32 (iMvp, LD32 (iMvA));
177 return;
178 }
179
180 iMatchRef = (0 == iLeftRef) + (0 == iTopRef) + (0 == iDiagonalRef);
181 if (1 == iMatchRef) {
182 if (0 == iLeftRef) {
183 ST32 (iMvp, LD32 (iMvA));
184 } else if (0 == iTopRef) {
185 ST32 (iMvp, LD32 (iMvB));
186 } else {
187 ST32 (iMvp, LD32 (iMvC));
188 }
189 } else {
190 iMvp[0] = WelsMedian (iMvA[0], iMvB[0], iMvC[0]);
191 iMvp[1] = WelsMedian (iMvA[1], iMvB[1], iMvC[1]);
192 }
193}
194
46 195
47//basic iMVs prediction unit for iMVs partition width (4, 2, 1)196//basic iMVs prediction unit for iMVs partition width (4, 2, 1)
48void_t PredMv (int16_t iMotionVector[LIST_A][30][MV_A], int8_t iRefIndex[LIST_A][30],197void_t PredMv (int16_t iMotionVector[LIST_A][30][MV_A], int8_t iRefIndex[LIST_A][30],

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t