comparison truemotion1.c @ 1654:1c123e036890 libavcodec

this should make the decoder safe for big-endian platforms
author melanson
date Thu, 04 Dec 2003 14:14:43 +0000
parents bdade3baabfc
children a660ef952580
comparison
equal deleted inserted replaced
1653:11433ade9e06 1654:1c123e036890
162 s->ydt[i] &= 0xFFFE; 162 s->ydt[i] &= 0xFFFE;
163 s->ydt[i] /= 2; 163 s->ydt[i] /= 2;
164 } 164 }
165 } 165 }
166 166
167 #ifdef WORDS_BIGENDIAN
168 static int make_ydt_entry(int p2, int p1, int16_t *ydt)
169 #else
167 static int make_ydt_entry(int p1, int p2, int16_t *ydt) 170 static int make_ydt_entry(int p1, int p2, int16_t *ydt)
171 #endif
168 { 172 {
169 int lo, hi; 173 int lo, hi;
170 174
171 lo = ydt[p1]; 175 lo = ydt[p1];
172 lo += (lo << 5) + (lo << 10); 176 lo += (lo << 5) + (lo << 10);
173 hi = ydt[p2]; 177 hi = ydt[p2];
174 hi += (hi << 5) + (hi << 10); 178 hi += (hi << 5) + (hi << 10);
175 return ((lo + (hi << 16)) << 1); 179 return ((lo + (hi << 16)) << 1);
176 } 180 }
177 181
182 #ifdef WORDS_BIGENDIAN
183 static int make_cdt_entry(int p2, int p1, int16_t *cdt)
184 #else
178 static int make_cdt_entry(int p1, int p2, int16_t *cdt) 185 static int make_cdt_entry(int p1, int p2, int16_t *cdt)
186 #endif
179 { 187 {
180 int r, b, lo; 188 int r, b, lo;
181 189
182 b = cdt[p2]; 190 b = cdt[p2];
183 r = cdt[p1] << 10; 191 r = cdt[p1] << 10;
436 444
437 switch (y & 3) { 445 switch (y & 3) {
438 case 0: 446 case 0:
439 /* if macroblock width is 2, apply C-Y-C-Y; else 447 /* if macroblock width is 2, apply C-Y-C-Y; else
440 * apply C-Y-Y */ 448 * apply C-Y-Y */
441 if ((s->block_type == BLOCK_2x2) || 449 if (s->block_width == 2) {
442 (s->block_type == BLOCK_2x4)) {
443 APPLY_C_PREDICTOR(); 450 APPLY_C_PREDICTOR();
444 APPLY_Y_PREDICTOR(); 451 APPLY_Y_PREDICTOR();
445 OUTPUT_PIXEL_PAIR(); 452 OUTPUT_PIXEL_PAIR();
446 APPLY_C_PREDICTOR(); 453 APPLY_C_PREDICTOR();
447 APPLY_Y_PREDICTOR(); 454 APPLY_Y_PREDICTOR();