Mercurial > libavcodec.hg
comparison h263.c @ 1057:bb5de8a59da8 libavcodec
* static,const,compiler warning cleanup
author | kabi |
---|---|
date | Mon, 10 Feb 2003 09:35:32 +0000 |
parents | f07fd48c23d4 |
children | b32afefe7d33 |
comparison
equal
deleted
inserted
replaced
1056:eb403f8158eb | 1057:bb5de8a59da8 |
---|---|
454 #ifdef CONFIG_ENCODERS | 454 #ifdef CONFIG_ENCODERS |
455 void mpeg4_encode_mb(MpegEncContext * s, | 455 void mpeg4_encode_mb(MpegEncContext * s, |
456 DCTELEM block[6][64], | 456 DCTELEM block[6][64], |
457 int motion_x, int motion_y) | 457 int motion_x, int motion_y) |
458 { | 458 { |
459 int cbpc, cbpy, i, pred_x, pred_y; | 459 int cbpc, cbpy, pred_x, pred_y; |
460 int bits; | 460 int bits; |
461 PutBitContext * const pb2 = s->data_partitioning ? &s->pb2 : &s->pb; | 461 PutBitContext * const pb2 = s->data_partitioning ? &s->pb2 : &s->pb; |
462 PutBitContext * const tex_pb = s->data_partitioning && s->pict_type!=B_TYPE ? &s->tex_pb : &s->pb; | 462 PutBitContext * const tex_pb = s->data_partitioning && s->pict_type!=B_TYPE ? &s->tex_pb : &s->pb; |
463 PutBitContext * const dc_pb = s->data_partitioning && s->pict_type!=I_TYPE ? &s->pb2 : &s->pb; | 463 PutBitContext * const dc_pb = s->data_partitioning && s->pict_type!=I_TYPE ? &s->pb2 : &s->pb; |
464 const int interleaved_stats= (s->flags&CODEC_FLAG_PASS1) && !s->data_partitioning ? 1 : 0; | 464 const int interleaved_stats= (s->flags&CODEC_FLAG_PASS1) && !s->data_partitioning ? 1 : 0; |
465 const int dquant_code[5]= {1,0,9,2,3}; | 465 const int dquant_code[5]= {1,0,9,2,3}; |
466 | 466 |
467 // printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y); | 467 // printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y); |
468 if (!s->mb_intra) { | 468 if (!s->mb_intra) { |
469 /* compute cbp */ | 469 /* compute cbp */ |
470 int cbp = 0; | 470 int i, cbp = 0; |
471 for (i = 0; i < 6; i++) { | 471 for (i = 0; i < 6; i++) { |
472 if (s->block_last_index[i] >= 0) | 472 if (s->block_last_index[i] >= 0) |
473 cbp |= 1 << (5 - i); | 473 cbp |= 1 << (5 - i); |
474 } | 474 } |
475 | 475 |
726 } else { | 726 } else { |
727 int cbp; | 727 int cbp; |
728 int dc_diff[6]; //dc values with the dc prediction subtracted | 728 int dc_diff[6]; //dc values with the dc prediction subtracted |
729 int dir[6]; //prediction direction | 729 int dir[6]; //prediction direction |
730 int zigzag_last_index[6]; | 730 int zigzag_last_index[6]; |
731 UINT8 *scan_table[6]; | 731 UINT8 *scan_table[6]; |
732 int i; | |
732 | 733 |
733 for(i=0; i<6; i++){ | 734 for(i=0; i<6; i++){ |
734 const int level= block[i][0]; | 735 const int level= block[i][0]; |
735 UINT16 *dc_ptr; | 736 UINT16 *dc_ptr; |
736 | 737 |
1008 *dc_val_ptr = &dc_val[x + y * wrap]; | 1009 *dc_val_ptr = &dc_val[x + y * wrap]; |
1009 return pred_dc; | 1010 return pred_dc; |
1010 } | 1011 } |
1011 | 1012 |
1012 | 1013 |
1013 void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n) | 1014 static void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n) |
1014 { | 1015 { |
1015 int x, y, wrap, a, c, pred_dc, scale, i; | 1016 int x, y, wrap, a, c, pred_dc, scale, i; |
1016 INT16 *dc_val, *ac_val, *ac_val1; | 1017 INT16 *dc_val, *ac_val, *ac_val1; |
1017 | 1018 |
1018 /* find prediction */ | 1019 /* find prediction */ |
4351 } | 4352 } |
4352 | 4353 |
4353 // FIXME a bunch of grayscale shape things | 4354 // FIXME a bunch of grayscale shape things |
4354 | 4355 |
4355 if((s->mpeg_quant=get_bits1(gb))){ /* vol_quant_type */ | 4356 if((s->mpeg_quant=get_bits1(gb))){ /* vol_quant_type */ |
4356 int i, j, v; | 4357 int i, v; |
4357 | 4358 |
4358 /* load default matrixes */ | 4359 /* load default matrixes */ |
4359 for(i=0; i<64; i++){ | 4360 for(i=0; i<64; i++){ |
4360 int j= s->idct_permutation[i]; | 4361 int j= s->idct_permutation[i]; |
4361 v= ff_mpeg4_default_intra_matrix[i]; | 4362 v= ff_mpeg4_default_intra_matrix[i]; |
4368 } | 4369 } |
4369 | 4370 |
4370 /* load custom intra matrix */ | 4371 /* load custom intra matrix */ |
4371 if(get_bits1(gb)){ | 4372 if(get_bits1(gb)){ |
4372 int last=0; | 4373 int last=0; |
4373 for(i=0; i<64; i++){ | 4374 for(i=0; i<64; i++){ |
4375 int j; | |
4374 v= get_bits(gb, 8); | 4376 v= get_bits(gb, 8); |
4375 if(v==0) break; | 4377 if(v==0) break; |
4376 | 4378 |
4377 last= v; | 4379 last= v; |
4378 j= s->idct_permutation[ ff_zigzag_direct[i] ]; | 4380 j= s->idct_permutation[ ff_zigzag_direct[i] ]; |
4380 s->chroma_intra_matrix[j]= v; | 4382 s->chroma_intra_matrix[j]= v; |
4381 } | 4383 } |
4382 | 4384 |
4383 /* replicate last value */ | 4385 /* replicate last value */ |
4384 for(; i<64; i++){ | 4386 for(; i<64; i++){ |
4385 j= s->idct_permutation[ ff_zigzag_direct[i] ]; | 4387 int j= s->idct_permutation[ ff_zigzag_direct[i] ]; |
4386 s->intra_matrix[j]= v; | 4388 s->intra_matrix[j]= v; |
4387 s->chroma_intra_matrix[j]= v; | 4389 s->chroma_intra_matrix[j]= v; |
4388 } | 4390 } |
4389 } | 4391 } |
4390 | 4392 |
4391 /* load custom non intra matrix */ | 4393 /* load custom non intra matrix */ |
4392 if(get_bits1(gb)){ | 4394 if(get_bits1(gb)){ |
4393 int last=0; | 4395 int last=0; |
4394 for(i=0; i<64; i++){ | 4396 for(i=0; i<64; i++){ |
4397 int j; | |
4395 v= get_bits(gb, 8); | 4398 v= get_bits(gb, 8); |
4396 if(v==0) break; | 4399 if(v==0) break; |
4397 | 4400 |
4398 last= v; | 4401 last= v; |
4399 j= s->idct_permutation[ ff_zigzag_direct[i] ]; | 4402 j= s->idct_permutation[ ff_zigzag_direct[i] ]; |
4401 s->chroma_inter_matrix[j]= v; | 4404 s->chroma_inter_matrix[j]= v; |
4402 } | 4405 } |
4403 | 4406 |
4404 /* replicate last value */ | 4407 /* replicate last value */ |
4405 for(; i<64; i++){ | 4408 for(; i<64; i++){ |
4406 j= s->idct_permutation[ ff_zigzag_direct[i] ]; | 4409 int j= s->idct_permutation[ ff_zigzag_direct[i] ]; |
4407 s->inter_matrix[j]= last; | 4410 s->inter_matrix[j]= last; |
4408 s->chroma_inter_matrix[j]= last; | 4411 s->chroma_inter_matrix[j]= last; |
4409 } | 4412 } |
4410 } | 4413 } |
4411 | 4414 |