comparison h264.c @ 1269:2498a7045b37 libavcodec

bigendian fix
author michaelni
date Fri, 16 May 2003 19:18:53 +0000
parents ec946cb74397
children 8988af3ae1e8
comparison
equal deleted inserted replaced
1268:fb865ca0c251 1269:2498a7045b37
294 static VLC run_vlc[6]; 294 static VLC run_vlc[6];
295 static VLC run7_vlc; 295 static VLC run7_vlc;
296 296
297 static void svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp); 297 static void svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp);
298 static void svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc); 298 static void svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc);
299
300 static inline uint32_t pack16to32(int a, int b){
301 #ifdef WORDS_BIGENDIAN
302 return (b&0xFFFF) + (a<<16);
303 #else
304 return (a&0xFFFF) + (b<<16);
305 #endif
306 }
299 307
300 /** 308 /**
301 * fill a rectangle. 309 * fill a rectangle.
302 * @param h height of the recatangle, should be a constant 310 * @param h height of the recatangle, should be a constant
303 * @param w width of the recatangle, should be a constant 311 * @param w width of the recatangle, should be a constant
3224 mb_type|= MB_TYPE_INTERLACED; 3232 mb_type|= MB_TYPE_INTERLACED;
3225 3233
3226 fill_caches(h, mb_type); //FIXME check what is needed and what not ... 3234 fill_caches(h, mb_type); //FIXME check what is needed and what not ...
3227 pred_pskip_motion(h, &mx, &my); 3235 pred_pskip_motion(h, &mx, &my);
3228 fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, 0, 1); 3236 fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, 0, 1);
3229 fill_rectangle( h->mv_cache[0][scan8[0]], 4, 4, 8, (mx&0xFFFF)+(my<<16), 4); 3237 fill_rectangle( h->mv_cache[0][scan8[0]], 4, 4, 8, pack16to32(mx,my), 4);
3230 write_back_motion(h, mb_type); 3238 write_back_motion(h, mb_type);
3231 3239
3232 s->current_picture.mb_type[mb_xy]= mb_type; //FIXME SKIP type 3240 s->current_picture.mb_type[mb_xy]= mb_type; //FIXME SKIP type
3233 h->slice_table[ mb_xy ]= h->slice_num; 3241 h->slice_table[ mb_xy ]= h->slice_num;
3234 3242
3454 pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my); 3462 pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my);
3455 mx += get_se_golomb(&s->gb); 3463 mx += get_se_golomb(&s->gb);
3456 my += get_se_golomb(&s->gb); 3464 my += get_se_golomb(&s->gb);
3457 tprintf("final mv:%d %d\n", mx, my); 3465 tprintf("final mv:%d %d\n", mx, my);
3458 3466
3459 fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, (mx&0xFFFF) + (my<<16), 4); 3467 fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4);
3460 } 3468 }
3461 } 3469 }
3462 } 3470 }
3463 else if(IS_16X8(mb_type)){ 3471 else if(IS_16X8(mb_type)){
3464 for(list=0; list<2; list++){ 3472 for(list=0; list<2; list++){
3477 pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my); 3485 pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my);
3478 mx += get_se_golomb(&s->gb); 3486 mx += get_se_golomb(&s->gb);
3479 my += get_se_golomb(&s->gb); 3487 my += get_se_golomb(&s->gb);
3480 tprintf("final mv:%d %d\n", mx, my); 3488 tprintf("final mv:%d %d\n", mx, my);
3481 3489
3482 fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, (mx&0xFFFF) + (my<<16), 4); 3490 fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx,my), 4);
3483 } 3491 }
3484 } 3492 }
3485 } 3493 }
3486 }else{ 3494 }else{
3487 assert(IS_8X16(mb_type)); 3495 assert(IS_8X16(mb_type));
3501 pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my); 3509 pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my);
3502 mx += get_se_golomb(&s->gb); 3510 mx += get_se_golomb(&s->gb);
3503 my += get_se_golomb(&s->gb); 3511 my += get_se_golomb(&s->gb);
3504 tprintf("final mv:%d %d\n", mx, my); 3512 tprintf("final mv:%d %d\n", mx, my);
3505 3513
3506 fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, (mx&0xFFFF) + (my<<16), 4); 3514 fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx,my), 4);
3507 } 3515 }
3508 } 3516 }
3509 } 3517 }
3510 } 3518 }
3511 } 3519 }
3997 static int decode_nal_units(H264Context *h, uint8_t *buf, int buf_size){ 4005 static int decode_nal_units(H264Context *h, uint8_t *buf, int buf_size){
3998 MpegEncContext * const s = &h->s; 4006 MpegEncContext * const s = &h->s;
3999 AVCodecContext * const avctx= s->avctx; 4007 AVCodecContext * const avctx= s->avctx;
4000 int buf_index=0; 4008 int buf_index=0;
4001 int i; 4009 int i;
4002 #if 0 4010 #if 0
4003 for(i=0; i<32; i++){ 4011 for(i=0; i<32; i++){
4004 printf("%X ", buf[i]); 4012 printf("%X ", buf[i]);
4005 } 4013 }
4006 #endif 4014 #endif
4007 for(;;){ 4015 for(;;){