comparison h263.c @ 312:8cf5507e6ca5 libavcodec

mpeg4 mpeg quantizer support
author michaelni
date Sun, 07 Apr 2002 02:03:32 +0000
parents d7f71eb89558
children ce35fd27bbb0
comparison
equal deleted inserted replaced
311:ac677a84d5df 312:8cf5507e6ca5
622 } else if (val >= l) { 622 } else if (val >= l) {
623 val -= m; 623 val -= m;
624 } 624 }
625 625
626 if (val >= 0) { 626 if (val >= 0) {
627 val--;
628 code = (val >> bit_size) + 1;
629 bits = val & (range - 1);
630 sign = 0; 627 sign = 0;
631 } else { 628 } else {
632 val = -val; 629 val = -val;
633 val--;
634 code = (val >> bit_size) + 1;
635 bits = val & (range - 1);
636 sign = 1; 630 sign = 1;
637 } 631 }
632 val--;
633 code = (val >> bit_size) + 1;
634 bits = val & (range - 1);
638 635
639 put_bits(&s->pb, mvtab[code][1] + 1, (mvtab[code][0] << 1) | sign); 636 put_bits(&s->pb, mvtab[code][1] + 1, (mvtab[code][0] << 1) | sign);
640 if (bit_size > 0) { 637 if (bit_size > 0) {
641 put_bits(&s->pb, bit_size, bits); 638 put_bits(&s->pb, bit_size, bits);
642 } 639 }
726 723
727 static void init_uni_dc_tab() 724 static void init_uni_dc_tab()
728 { 725 {
729 int level, uni_code, uni_len; 726 int level, uni_code, uni_len;
730 727
731 for(level=-255; level<256; level++){ 728 for(level=-256; level<256; level++){
732 int size, v, l; 729 int size, v, l;
733 /* find number of bits */ 730 /* find number of bits */
734 size = 0; 731 size = 0;
735 v = abs(level); 732 v = abs(level);
736 while (v) { 733 while (v) {
2507 } else { 2504 } else {
2508 s->quant_precision = 5; 2505 s->quant_precision = 5;
2509 } 2506 }
2510 2507
2511 // FIXME a bunch of grayscale shape things 2508 // FIXME a bunch of grayscale shape things
2512 if(get_bits1(&s->gb)) printf("Quant-Type not supported\n"); /* vol_quant_type */ //FIXME 2509
2510 if(get_bits1(&s->gb)){ /* vol_quant_type */
2511 int i, j, v;
2512 /* load default matrixes */
2513 for(i=0; i<64; i++){
2514 v= ff_mpeg4_default_intra_matrix[i];
2515 s->intra_matrix[i]= v;
2516 s->chroma_intra_matrix[i]= v;
2517
2518 v= ff_mpeg4_default_non_intra_matrix[i];
2519 s->non_intra_matrix[i]= v;
2520 s->chroma_non_intra_matrix[i]= v;
2521 }
2522
2523 /* load custom intra matrix */
2524 if(get_bits1(&s->gb)){
2525 for(i=0; i<64; i++){
2526 v= get_bits(&s->gb, 8);
2527 if(v==0) break;
2528
2529 j= zigzag_direct[i];
2530 s->intra_matrix[j]= v;
2531 s->chroma_intra_matrix[j]= v;
2532 }
2533 }
2534
2535 /* load custom non intra matrix */
2536 if(get_bits1(&s->gb)){
2537 for(i=0; i<64; i++){
2538 v= get_bits(&s->gb, 8);
2539 if(v==0) break;
2540
2541 j= zigzag_direct[i];
2542 s->non_intra_matrix[j]= v;
2543 s->chroma_non_intra_matrix[j]= v;
2544 }
2545
2546 /* replicate last value */
2547 for(; i<64; i++){
2548 j= zigzag_direct[i];
2549 s->non_intra_matrix[j]= v;
2550 s->chroma_non_intra_matrix[j]= v;
2551 }
2552 }
2553
2554 s->dct_unquantize= s->dct_unquantize_mpeg;
2555
2556 // FIXME a bunch of grayscale shape things
2557 }else
2558 s->dct_unquantize= s->dct_unquantize_h263;
2559
2513 if(vo_ver_id != 1) 2560 if(vo_ver_id != 1)
2514 s->quarter_sample= get_bits1(&s->gb); 2561 s->quarter_sample= get_bits1(&s->gb);
2515 else s->quarter_sample=0; 2562 else s->quarter_sample=0;
2516 2563
2517 if(!get_bits1(&s->gb)) printf("Complexity estimation not supported\n"); 2564 if(!get_bits1(&s->gb)) printf("Complexity estimation not supported\n");