Mercurial > libavcodec.hg
comparison vp3.c @ 7958:83b22813f23a libavcodec
Remove unused vp3 debugging info
author | conrad |
---|---|
date | Tue, 30 Sep 2008 19:18:22 +0000 |
parents | 3ff31e4454cd |
children | 16b5311fd5c7 |
comparison
equal
deleted
inserted
replaced
7957:fbe8fabdbc63 | 7958:83b22813f23a |
---|---|
41 #include "vp3data.h" | 41 #include "vp3data.h" |
42 #include "xiph.h" | 42 #include "xiph.h" |
43 | 43 |
44 #define FRAGMENT_PIXELS 8 | 44 #define FRAGMENT_PIXELS 8 |
45 | 45 |
46 /* | |
47 * Debugging Variables | |
48 * | |
49 * Define one or more of the following compile-time variables to 1 to obtain | |
50 * elaborate information about certain aspects of the decoding process. | |
51 * | |
52 * DEBUG_VP3: high-level decoding flow | |
53 * DEBUG_INIT: initialization parameters | |
54 * DEBUG_DEQUANTIZERS: display how the dequanization tables are built | |
55 * DEBUG_BLOCK_CODING: unpacking the superblock/macroblock/fragment coding | |
56 * DEBUG_MODES: unpacking the coding modes for individual fragments | |
57 * DEBUG_VECTORS: display the motion vectors | |
58 * DEBUG_TOKEN: display exhaustive information about each DCT token | |
59 * DEBUG_VLC: display the VLCs as they are extracted from the stream | |
60 * DEBUG_DC_PRED: display the process of reversing DC prediction | |
61 * DEBUG_IDCT: show every detail of the IDCT process | |
62 */ | |
63 | |
64 #define DEBUG_VP3 0 | |
65 #define DEBUG_INIT 0 | |
66 #define DEBUG_DEQUANTIZERS 0 | |
67 #define DEBUG_BLOCK_CODING 0 | |
68 #define DEBUG_MODES 0 | |
69 #define DEBUG_VECTORS 0 | |
70 #define DEBUG_TOKEN 0 | |
71 #define DEBUG_VLC 0 | |
72 #define DEBUG_DC_PRED 0 | |
73 #define DEBUG_IDCT 0 | |
74 | |
75 #if DEBUG_VP3 | |
76 #define debug_vp3(args...) av_log(NULL, AV_LOG_DEBUG, ## args) | |
77 #else | |
78 static inline void debug_vp3(const char *format, ...) { } | |
79 #endif | |
80 | |
81 #if DEBUG_INIT | |
82 #define debug_init(args...) av_log(NULL, AV_LOG_DEBUG, ## args) | |
83 #else | |
84 static inline void debug_init(const char *format, ...) { } | |
85 #endif | |
86 | |
87 #if DEBUG_DEQUANTIZERS | |
88 #define debug_dequantizers(args...) av_log(NULL, AV_LOG_DEBUG, ## args) | |
89 #else | |
90 static inline void debug_dequantizers(const char *format, ...) { } | |
91 #endif | |
92 | |
93 #if DEBUG_BLOCK_CODING | |
94 #define debug_block_coding(args...) av_log(NULL, AV_LOG_DEBUG, ## args) | |
95 #else | |
96 static inline void debug_block_coding(const char *format, ...) { } | |
97 #endif | |
98 | |
99 #if DEBUG_MODES | |
100 #define debug_modes(args...) av_log(NULL, AV_LOG_DEBUG, ## args) | |
101 #else | |
102 static inline void debug_modes(const char *format, ...) { } | |
103 #endif | |
104 | |
105 #if DEBUG_VECTORS | |
106 #define debug_vectors(args...) av_log(NULL, AV_LOG_DEBUG, ## args) | |
107 #else | |
108 static inline void debug_vectors(const char *format, ...) { } | |
109 #endif | |
110 | |
111 #if DEBUG_TOKEN | |
112 #define debug_token(args...) av_log(NULL, AV_LOG_DEBUG, ## args) | |
113 #else | |
114 static inline void debug_token(const char *format, ...) { } | |
115 #endif | |
116 | |
117 #if DEBUG_VLC | |
118 #define debug_vlc(args...) av_log(NULL, AV_LOG_DEBUG, ## args) | |
119 #else | |
120 static inline void debug_vlc(const char *format, ...) { } | |
121 #endif | |
122 | |
123 #if DEBUG_DC_PRED | |
124 #define debug_dc_pred(args...) av_log(NULL, AV_LOG_DEBUG, ## args) | |
125 #else | |
126 static inline void debug_dc_pred(const char *format, ...) { } | |
127 #endif | |
128 | |
129 #if DEBUG_IDCT | |
130 #define debug_idct(args...) av_log(NULL, AV_LOG_DEBUG, ## args) | |
131 #else | |
132 static inline void debug_idct(const char *format, ...) { } | |
133 #endif | |
134 | |
135 typedef struct Coeff { | 46 typedef struct Coeff { |
136 struct Coeff *next; | 47 struct Coeff *next; |
137 DCTELEM coeff; | 48 DCTELEM coeff; |
138 uint8_t index; | 49 uint8_t index; |
139 } Coeff; | 50 } Coeff; |
371 | 282 |
372 signed char travel_height_mb[4] = { | 283 signed char travel_height_mb[4] = { |
373 0, 1, 0, -1 | 284 0, 1, 0, -1 |
374 }; | 285 }; |
375 | 286 |
376 debug_vp3(" vp3: initialize block mapping tables\n"); | |
377 | |
378 hilbert_walk_mb[0] = 1; | 287 hilbert_walk_mb[0] = 1; |
379 hilbert_walk_mb[1] = s->macroblock_width; | 288 hilbert_walk_mb[1] = s->macroblock_width; |
380 hilbert_walk_mb[2] = 1; | 289 hilbert_walk_mb[2] = 1; |
381 hilbert_walk_mb[3] = -s->macroblock_width; | 290 hilbert_walk_mb[3] = -s->macroblock_width; |
382 | 291 |
383 /* iterate through each superblock (all planes) and map the fragments */ | 292 /* iterate through each superblock (all planes) and map the fragments */ |
384 for (i = 0; i < s->superblock_count; i++) { | 293 for (i = 0; i < s->superblock_count; i++) { |
385 debug_init(" superblock %d (u starts @ %d, v starts @ %d)\n", | |
386 i, s->u_superblock_start, s->v_superblock_start); | |
387 | |
388 /* time to re-assign the limits? */ | 294 /* time to re-assign the limits? */ |
389 if (i == 0) { | 295 if (i == 0) { |
390 | 296 |
391 /* start of Y superblocks */ | 297 /* start of Y superblocks */ |
392 right_edge = s->fragment_width; | 298 right_edge = s->fragment_width; |
444 | 350 |
445 /* check if the fragment is in bounds */ | 351 /* check if the fragment is in bounds */ |
446 if ((current_width < right_edge) && | 352 if ((current_width < right_edge) && |
447 (current_height < bottom_edge)) { | 353 (current_height < bottom_edge)) { |
448 s->superblock_fragments[mapping_index] = current_fragment; | 354 s->superblock_fragments[mapping_index] = current_fragment; |
449 debug_init(" mapping fragment %d to superblock %d, position %d (%d/%d x %d/%d)\n", | |
450 s->superblock_fragments[mapping_index], i, j, | |
451 current_width, right_edge, current_height, bottom_edge); | |
452 } else { | 355 } else { |
453 s->superblock_fragments[mapping_index] = -1; | 356 s->superblock_fragments[mapping_index] = -1; |
454 debug_init(" superblock %d, position %d has no fragment (%d/%d x %d/%d)\n", | |
455 i, j, | |
456 current_width, right_edge, current_height, bottom_edge); | |
457 } | 357 } |
458 | 358 |
459 mapping_index++; | 359 mapping_index++; |
460 } | 360 } |
461 } | 361 } |
490 | 390 |
491 /* check if the macroblock is in bounds */ | 391 /* check if the macroblock is in bounds */ |
492 if ((current_width < right_edge) && | 392 if ((current_width < right_edge) && |
493 (current_height < bottom_edge)) { | 393 (current_height < bottom_edge)) { |
494 s->superblock_macroblocks[mapping_index] = current_macroblock; | 394 s->superblock_macroblocks[mapping_index] = current_macroblock; |
495 debug_init(" mapping macroblock %d to superblock %d, position %d (%d/%d x %d/%d)\n", | |
496 s->superblock_macroblocks[mapping_index], i, j, | |
497 current_width, right_edge, current_height, bottom_edge); | |
498 } else { | 395 } else { |
499 s->superblock_macroblocks[mapping_index] = -1; | 396 s->superblock_macroblocks[mapping_index] = -1; |
500 debug_init(" superblock %d, position %d has no macroblock (%d/%d x %d/%d)\n", | |
501 i, j, | |
502 current_width, right_edge, current_height, bottom_edge); | |
503 } | 397 } |
504 | 398 |
505 mapping_index++; | 399 mapping_index++; |
506 } | 400 } |
507 } | 401 } |
512 mapping_index = 0; | 406 mapping_index = 0; |
513 for (i = 0; i < s->fragment_height; i += 2) { | 407 for (i = 0; i < s->fragment_height; i += 2) { |
514 | 408 |
515 for (j = 0; j < s->fragment_width; j += 2) { | 409 for (j = 0; j < s->fragment_width; j += 2) { |
516 | 410 |
517 debug_init(" macroblock %d contains fragments: ", current_macroblock); | |
518 s->all_fragments[current_fragment].macroblock = current_macroblock; | 411 s->all_fragments[current_fragment].macroblock = current_macroblock; |
519 s->macroblock_fragments[mapping_index++] = current_fragment; | 412 s->macroblock_fragments[mapping_index++] = current_fragment; |
520 debug_init("%d ", current_fragment); | |
521 | 413 |
522 if (j + 1 < s->fragment_width) { | 414 if (j + 1 < s->fragment_width) { |
523 s->all_fragments[current_fragment + 1].macroblock = current_macroblock; | 415 s->all_fragments[current_fragment + 1].macroblock = current_macroblock; |
524 s->macroblock_fragments[mapping_index++] = current_fragment + 1; | 416 s->macroblock_fragments[mapping_index++] = current_fragment + 1; |
525 debug_init("%d ", current_fragment + 1); | |
526 } else | 417 } else |
527 s->macroblock_fragments[mapping_index++] = -1; | 418 s->macroblock_fragments[mapping_index++] = -1; |
528 | 419 |
529 if (i + 1 < s->fragment_height) { | 420 if (i + 1 < s->fragment_height) { |
530 s->all_fragments[current_fragment + s->fragment_width].macroblock = | 421 s->all_fragments[current_fragment + s->fragment_width].macroblock = |
531 current_macroblock; | 422 current_macroblock; |
532 s->macroblock_fragments[mapping_index++] = | 423 s->macroblock_fragments[mapping_index++] = |
533 current_fragment + s->fragment_width; | 424 current_fragment + s->fragment_width; |
534 debug_init("%d ", current_fragment + s->fragment_width); | |
535 } else | 425 } else |
536 s->macroblock_fragments[mapping_index++] = -1; | 426 s->macroblock_fragments[mapping_index++] = -1; |
537 | 427 |
538 if ((j + 1 < s->fragment_width) && (i + 1 < s->fragment_height)) { | 428 if ((j + 1 < s->fragment_width) && (i + 1 < s->fragment_height)) { |
539 s->all_fragments[current_fragment + s->fragment_width + 1].macroblock = | 429 s->all_fragments[current_fragment + s->fragment_width + 1].macroblock = |
540 current_macroblock; | 430 current_macroblock; |
541 s->macroblock_fragments[mapping_index++] = | 431 s->macroblock_fragments[mapping_index++] = |
542 current_fragment + s->fragment_width + 1; | 432 current_fragment + s->fragment_width + 1; |
543 debug_init("%d ", current_fragment + s->fragment_width + 1); | |
544 } else | 433 } else |
545 s->macroblock_fragments[mapping_index++] = -1; | 434 s->macroblock_fragments[mapping_index++] = -1; |
546 | 435 |
547 /* C planes */ | 436 /* C planes */ |
548 c_fragment = s->fragment_start[1] + | 437 c_fragment = s->fragment_start[1] + |
549 (i * s->fragment_width / 4) + (j / 2); | 438 (i * s->fragment_width / 4) + (j / 2); |
550 s->all_fragments[c_fragment].macroblock = s->macroblock_count; | 439 s->all_fragments[c_fragment].macroblock = s->macroblock_count; |
551 s->macroblock_fragments[mapping_index++] = c_fragment; | 440 s->macroblock_fragments[mapping_index++] = c_fragment; |
552 debug_init("%d ", c_fragment); | |
553 | 441 |
554 c_fragment = s->fragment_start[2] + | 442 c_fragment = s->fragment_start[2] + |
555 (i * s->fragment_width / 4) + (j / 2); | 443 (i * s->fragment_width / 4) + (j / 2); |
556 s->all_fragments[c_fragment].macroblock = s->macroblock_count; | 444 s->all_fragments[c_fragment].macroblock = s->macroblock_count; |
557 s->macroblock_fragments[mapping_index++] = c_fragment; | 445 s->macroblock_fragments[mapping_index++] = c_fragment; |
558 debug_init("%d ", c_fragment); | |
559 | |
560 debug_init("\n"); | |
561 | 446 |
562 if (j + 2 <= s->fragment_width) | 447 if (j + 2 <= s->fragment_width) |
563 current_fragment += 2; | 448 current_fragment += 2; |
564 else | 449 else |
565 current_fragment++; | 450 current_fragment++; |
599 static void init_dequantizer(Vp3DecodeContext *s) | 484 static void init_dequantizer(Vp3DecodeContext *s) |
600 { | 485 { |
601 int ac_scale_factor = s->coded_ac_scale_factor[s->quality_index]; | 486 int ac_scale_factor = s->coded_ac_scale_factor[s->quality_index]; |
602 int dc_scale_factor = s->coded_dc_scale_factor[s->quality_index]; | 487 int dc_scale_factor = s->coded_dc_scale_factor[s->quality_index]; |
603 int i, plane, inter, qri, bmi, bmj, qistart; | 488 int i, plane, inter, qri, bmi, bmj, qistart; |
604 | |
605 debug_vp3(" vp3: initializing dequantization tables\n"); | |
606 | 489 |
607 for(inter=0; inter<2; inter++){ | 490 for(inter=0; inter<2; inter++){ |
608 for(plane=0; plane<3; plane++){ | 491 for(plane=0; plane<3; plane++){ |
609 int sum=0; | 492 int sum=0; |
610 for(qri=0; qri<s->qr_count[inter][plane]; qri++){ | 493 for(qri=0; qri<s->qr_count[inter][plane]; qri++){ |
668 int first_c_fragment_seen; | 551 int first_c_fragment_seen; |
669 | 552 |
670 int i, j; | 553 int i, j; |
671 int current_fragment; | 554 int current_fragment; |
672 | 555 |
673 debug_vp3(" vp3: unpacking superblock coding\n"); | |
674 | |
675 if (s->keyframe) { | 556 if (s->keyframe) { |
676 | |
677 debug_vp3(" keyframe-- all superblocks are fully coded\n"); | |
678 memset(s->superblock_coding, SB_FULLY_CODED, s->superblock_count); | 557 memset(s->superblock_coding, SB_FULLY_CODED, s->superblock_count); |
679 | 558 |
680 } else { | 559 } else { |
681 | 560 |
682 /* unpack the list of partially-coded superblocks */ | 561 /* unpack the list of partially-coded superblocks */ |
689 bit ^= 1; | 568 bit ^= 1; |
690 current_run = get_vlc2(gb, | 569 current_run = get_vlc2(gb, |
691 s->superblock_run_length_vlc.table, 6, 2); | 570 s->superblock_run_length_vlc.table, 6, 2); |
692 if (current_run == 33) | 571 if (current_run == 33) |
693 current_run += get_bits(gb, 12); | 572 current_run += get_bits(gb, 12); |
694 debug_block_coding(" setting superblocks %d..%d to %s\n", | |
695 current_superblock, | |
696 current_superblock + current_run - 1, | |
697 (bit) ? "partially coded" : "not coded"); | |
698 | 573 |
699 /* if any of the superblocks are not partially coded, flag | 574 /* if any of the superblocks are not partially coded, flag |
700 * a boolean to decode the list of fully-coded superblocks */ | 575 * a boolean to decode the list of fully-coded superblocks */ |
701 if (bit == 0) { | 576 if (bit == 0) { |
702 decode_fully_flags = 1; | 577 decode_fully_flags = 1; |
730 current_run = get_vlc2(gb, | 605 current_run = get_vlc2(gb, |
731 s->superblock_run_length_vlc.table, 6, 2); | 606 s->superblock_run_length_vlc.table, 6, 2); |
732 if (current_run == 33) | 607 if (current_run == 33) |
733 current_run += get_bits(gb, 12); | 608 current_run += get_bits(gb, 12); |
734 } | 609 } |
735 | |
736 debug_block_coding(" setting superblock %d to %s\n", | |
737 current_superblock, | |
738 (bit) ? "fully coded" : "not coded"); | |
739 s->superblock_coding[current_superblock] = 2*bit; | 610 s->superblock_coding[current_superblock] = 2*bit; |
740 } | 611 } |
741 current_superblock++; | 612 current_superblock++; |
742 } | 613 } |
743 } | 614 } |
806 s->last_coded_y_fragment = s->first_coded_c_fragment - 1; | 677 s->last_coded_y_fragment = s->first_coded_c_fragment - 1; |
807 first_c_fragment_seen = 1; | 678 first_c_fragment_seen = 1; |
808 } | 679 } |
809 s->coded_fragment_list_index++; | 680 s->coded_fragment_list_index++; |
810 s->macroblock_coding[s->all_fragments[current_fragment].macroblock] = MODE_INTER_NO_MV; | 681 s->macroblock_coding[s->all_fragments[current_fragment].macroblock] = MODE_INTER_NO_MV; |
811 debug_block_coding(" superblock %d is partially coded, fragment %d is coded\n", | |
812 i, current_fragment); | |
813 } else { | 682 } else { |
814 /* not coded; copy this fragment from the prior frame */ | 683 /* not coded; copy this fragment from the prior frame */ |
815 s->all_fragments[current_fragment].coding_method = | 684 s->all_fragments[current_fragment].coding_method = |
816 MODE_COPY; | 685 MODE_COPY; |
817 debug_block_coding(" superblock %d is partially coded, fragment %d is not coded\n", | |
818 i, current_fragment); | |
819 } | 686 } |
820 | 687 |
821 } else { | 688 } else { |
822 | 689 |
823 /* fragments are fully coded in this superblock; actual | 690 /* fragments are fully coded in this superblock; actual |
834 s->last_coded_y_fragment = s->first_coded_c_fragment - 1; | 701 s->last_coded_y_fragment = s->first_coded_c_fragment - 1; |
835 first_c_fragment_seen = 1; | 702 first_c_fragment_seen = 1; |
836 } | 703 } |
837 s->coded_fragment_list_index++; | 704 s->coded_fragment_list_index++; |
838 s->macroblock_coding[s->all_fragments[current_fragment].macroblock] = MODE_INTER_NO_MV; | 705 s->macroblock_coding[s->all_fragments[current_fragment].macroblock] = MODE_INTER_NO_MV; |
839 debug_block_coding(" superblock %d is fully coded, fragment %d is coded\n", | |
840 i, current_fragment); | |
841 } | 706 } |
842 } | 707 } |
843 } | 708 } |
844 } | 709 } |
845 | 710 |
847 /* only Y fragments coded in this frame */ | 712 /* only Y fragments coded in this frame */ |
848 s->last_coded_y_fragment = s->coded_fragment_list_index - 1; | 713 s->last_coded_y_fragment = s->coded_fragment_list_index - 1; |
849 else | 714 else |
850 /* end the list of coded C fragments */ | 715 /* end the list of coded C fragments */ |
851 s->last_coded_c_fragment = s->coded_fragment_list_index - 1; | 716 s->last_coded_c_fragment = s->coded_fragment_list_index - 1; |
852 | |
853 debug_block_coding(" %d total coded fragments, y: %d -> %d, c: %d -> %d\n", | |
854 s->coded_fragment_list_index, | |
855 s->first_coded_y_fragment, | |
856 s->last_coded_y_fragment, | |
857 s->first_coded_c_fragment, | |
858 s->last_coded_c_fragment); | |
859 | 717 |
860 return 0; | 718 return 0; |
861 } | 719 } |
862 | 720 |
863 /* | 721 /* |
871 int current_macroblock; | 729 int current_macroblock; |
872 int current_fragment; | 730 int current_fragment; |
873 int coding_mode; | 731 int coding_mode; |
874 int custom_mode_alphabet[CODING_MODE_COUNT]; | 732 int custom_mode_alphabet[CODING_MODE_COUNT]; |
875 | 733 |
876 debug_vp3(" vp3: unpacking encoding modes\n"); | |
877 | |
878 if (s->keyframe) { | 734 if (s->keyframe) { |
879 debug_vp3(" keyframe-- all blocks are coded as INTRA\n"); | |
880 | |
881 for (i = 0; i < s->fragment_count; i++) | 735 for (i = 0; i < s->fragment_count; i++) |
882 s->all_fragments[i].coding_method = MODE_INTRA; | 736 s->all_fragments[i].coding_method = MODE_INTRA; |
883 | 737 |
884 } else { | 738 } else { |
885 | 739 |
886 /* fetch the mode coding scheme for this frame */ | 740 /* fetch the mode coding scheme for this frame */ |
887 scheme = get_bits(gb, 3); | 741 scheme = get_bits(gb, 3); |
888 debug_modes(" using mode alphabet %d\n", scheme); | |
889 | 742 |
890 /* is it a custom coding scheme? */ | 743 /* is it a custom coding scheme? */ |
891 if (scheme == 0) { | 744 if (scheme == 0) { |
892 debug_modes(" custom mode alphabet ahead:\n"); | |
893 for (i = 0; i < 8; i++) | 745 for (i = 0; i < 8; i++) |
894 custom_mode_alphabet[get_bits(gb, 3)] = i; | 746 custom_mode_alphabet[get_bits(gb, 3)] = i; |
895 } | |
896 | |
897 for (i = 0; i < 8; i++) { | |
898 if(scheme) | |
899 debug_modes(" mode[%d][%d] = %d\n", scheme, i, | |
900 ModeAlphabet[scheme-1][i]); | |
901 else | |
902 debug_modes(" mode[0][%d] = %d\n", i, | |
903 custom_mode_alphabet[i]); | |
904 } | 747 } |
905 | 748 |
906 /* iterate through all of the macroblocks that contain 1 or more | 749 /* iterate through all of the macroblocks that contain 1 or more |
907 * coded fragments */ | 750 * coded fragments */ |
908 for (i = 0; i < s->u_superblock_start; i++) { | 751 for (i = 0; i < s->u_superblock_start; i++) { |
942 if (s->all_fragments[current_fragment].coding_method != | 785 if (s->all_fragments[current_fragment].coding_method != |
943 MODE_COPY) | 786 MODE_COPY) |
944 s->all_fragments[current_fragment].coding_method = | 787 s->all_fragments[current_fragment].coding_method = |
945 coding_mode; | 788 coding_mode; |
946 } | 789 } |
947 | |
948 debug_modes(" coding method for macroblock starting @ fragment %d = %d\n", | |
949 s->macroblock_fragments[current_macroblock * 6], coding_mode); | |
950 } | 790 } |
951 } | 791 } |
952 } | 792 } |
953 | 793 |
954 return 0; | 794 return 0; |
969 int prior_last_motion_x = 0; | 809 int prior_last_motion_x = 0; |
970 int prior_last_motion_y = 0; | 810 int prior_last_motion_y = 0; |
971 int current_macroblock; | 811 int current_macroblock; |
972 int current_fragment; | 812 int current_fragment; |
973 | 813 |
974 debug_vp3(" vp3: unpacking motion vectors\n"); | |
975 if (s->keyframe) { | 814 if (s->keyframe) { |
976 | |
977 debug_vp3(" keyframe-- there are no motion vectors\n"); | |
978 | |
979 } else { | 815 } else { |
980 | |
981 memset(motion_x, 0, 6 * sizeof(int)); | 816 memset(motion_x, 0, 6 * sizeof(int)); |
982 memset(motion_y, 0, 6 * sizeof(int)); | 817 memset(motion_y, 0, 6 * sizeof(int)); |
983 | 818 |
984 /* coding mode 0 is the VLC scheme; 1 is the fixed code scheme */ | 819 /* coding mode 0 is the VLC scheme; 1 is the fixed code scheme */ |
985 coding_mode = get_bits1(gb); | 820 coding_mode = get_bits1(gb); |
986 debug_vectors(" using %s scheme for unpacking motion vectors\n", | |
987 (coding_mode == 0) ? "VLC" : "fixed-length"); | |
988 | 821 |
989 /* iterate through all of the macroblocks that contain 1 or more | 822 /* iterate through all of the macroblocks that contain 1 or more |
990 * coded fragments */ | 823 * coded fragments */ |
991 for (i = 0; i < s->u_superblock_start; i++) { | 824 for (i = 0; i < s->u_superblock_start; i++) { |
992 | 825 |
1109 /* no vector maintenance */ | 942 /* no vector maintenance */ |
1110 break; | 943 break; |
1111 } | 944 } |
1112 | 945 |
1113 /* assign the motion vectors to the correct fragments */ | 946 /* assign the motion vectors to the correct fragments */ |
1114 debug_vectors(" vectors for macroblock starting @ fragment %d (coding method %d):\n", | |
1115 current_fragment, | |
1116 s->macroblock_coding[current_macroblock]); | |
1117 for (k = 0; k < 6; k++) { | 947 for (k = 0; k < 6; k++) { |
1118 current_fragment = | 948 current_fragment = |
1119 s->macroblock_fragments[current_macroblock * 6 + k]; | 949 s->macroblock_fragments[current_macroblock * 6 + k]; |
1120 if (current_fragment == -1) | 950 if (current_fragment == -1) |
1121 continue; | 951 continue; |
1124 current_fragment, s->fragment_count); | 954 current_fragment, s->fragment_count); |
1125 return 1; | 955 return 1; |
1126 } | 956 } |
1127 s->all_fragments[current_fragment].motion_x = motion_x[k]; | 957 s->all_fragments[current_fragment].motion_x = motion_x[k]; |
1128 s->all_fragments[current_fragment].motion_y = motion_y[k]; | 958 s->all_fragments[current_fragment].motion_y = motion_y[k]; |
1129 debug_vectors(" vector %d: fragment %d = (%d, %d)\n", | |
1130 k, current_fragment, motion_x[k], motion_y[k]); | |
1131 } | 959 } |
1132 } | 960 } |
1133 } | 961 } |
1134 } | 962 } |
1135 | 963 |
1177 fragment = &s->all_fragments[fragment_num]; | 1005 fragment = &s->all_fragments[fragment_num]; |
1178 | 1006 |
1179 if (!eob_run) { | 1007 if (!eob_run) { |
1180 /* decode a VLC into a token */ | 1008 /* decode a VLC into a token */ |
1181 token = get_vlc2(gb, table->table, 5, 3); | 1009 token = get_vlc2(gb, table->table, 5, 3); |
1182 debug_vlc(" token = %2d, ", token); | |
1183 /* use the token to get a zero run, a coefficient, and an eob run */ | 1010 /* use the token to get a zero run, a coefficient, and an eob run */ |
1184 if (token <= 6) { | 1011 if (token <= 6) { |
1185 eob_run = eob_run_base[token]; | 1012 eob_run = eob_run_base[token]; |
1186 if (eob_run_get_bits[token]) | 1013 if (eob_run_get_bits[token]) |
1187 eob_run += get_bits(gb, eob_run_get_bits[token]); | 1014 eob_run += get_bits(gb, eob_run_get_bits[token]); |
1206 fragment->next_coeff->index= perm[s->coeff_counts[fragment_num]++]; //FIXME perm here already? | 1033 fragment->next_coeff->index= perm[s->coeff_counts[fragment_num]++]; //FIXME perm here already? |
1207 fragment->next_coeff->next= s->next_coeff; | 1034 fragment->next_coeff->next= s->next_coeff; |
1208 s->next_coeff->next=NULL; | 1035 s->next_coeff->next=NULL; |
1209 fragment->next_coeff= s->next_coeff++; | 1036 fragment->next_coeff= s->next_coeff++; |
1210 } | 1037 } |
1211 debug_vlc(" fragment %d coeff = %d\n", | |
1212 s->coded_fragment_list[i], fragment->next_coeff[coeff_index]); | |
1213 } else { | 1038 } else { |
1214 s->coeff_counts[fragment_num] |= 128; | 1039 s->coeff_counts[fragment_num] |= 128; |
1215 debug_vlc(" fragment %d eob with %d coefficients\n", | |
1216 s->coded_fragment_list[i], s->coeff_counts[fragment_num]&127); | |
1217 eob_run--; | 1040 eob_run--; |
1218 } | 1041 } |
1219 } | 1042 } |
1220 | 1043 |
1221 return eob_run; | 1044 return eob_run; |
1237 /* fetch the DC table indexes */ | 1060 /* fetch the DC table indexes */ |
1238 dc_y_table = get_bits(gb, 4); | 1061 dc_y_table = get_bits(gb, 4); |
1239 dc_c_table = get_bits(gb, 4); | 1062 dc_c_table = get_bits(gb, 4); |
1240 | 1063 |
1241 /* unpack the Y plane DC coefficients */ | 1064 /* unpack the Y plane DC coefficients */ |
1242 debug_vp3(" vp3: unpacking Y plane DC coefficients using table %d\n", | |
1243 dc_y_table); | |
1244 residual_eob_run = unpack_vlcs(s, gb, &s->dc_vlc[dc_y_table], 0, | 1065 residual_eob_run = unpack_vlcs(s, gb, &s->dc_vlc[dc_y_table], 0, |
1245 s->first_coded_y_fragment, s->last_coded_y_fragment, residual_eob_run); | 1066 s->first_coded_y_fragment, s->last_coded_y_fragment, residual_eob_run); |
1246 | 1067 |
1247 /* unpack the C plane DC coefficients */ | 1068 /* unpack the C plane DC coefficients */ |
1248 debug_vp3(" vp3: unpacking C plane DC coefficients using table %d\n", | |
1249 dc_c_table); | |
1250 residual_eob_run = unpack_vlcs(s, gb, &s->dc_vlc[dc_c_table], 0, | 1069 residual_eob_run = unpack_vlcs(s, gb, &s->dc_vlc[dc_c_table], 0, |
1251 s->first_coded_c_fragment, s->last_coded_c_fragment, residual_eob_run); | 1070 s->first_coded_c_fragment, s->last_coded_c_fragment, residual_eob_run); |
1252 | 1071 |
1253 /* fetch the AC table indexes */ | 1072 /* fetch the AC table indexes */ |
1254 ac_y_table = get_bits(gb, 4); | 1073 ac_y_table = get_bits(gb, 4); |
1255 ac_c_table = get_bits(gb, 4); | 1074 ac_c_table = get_bits(gb, 4); |
1256 | 1075 |
1257 /* unpack the group 1 AC coefficients (coeffs 1-5) */ | 1076 /* unpack the group 1 AC coefficients (coeffs 1-5) */ |
1258 for (i = 1; i <= 5; i++) { | 1077 for (i = 1; i <= 5; i++) { |
1259 | |
1260 debug_vp3(" vp3: unpacking level %d Y plane AC coefficients using table %d\n", | |
1261 i, ac_y_table); | |
1262 residual_eob_run = unpack_vlcs(s, gb, &s->ac_vlc_1[ac_y_table], i, | 1078 residual_eob_run = unpack_vlcs(s, gb, &s->ac_vlc_1[ac_y_table], i, |
1263 s->first_coded_y_fragment, s->last_coded_y_fragment, residual_eob_run); | 1079 s->first_coded_y_fragment, s->last_coded_y_fragment, residual_eob_run); |
1264 | 1080 |
1265 debug_vp3(" vp3: unpacking level %d C plane AC coefficients using table %d\n", | |
1266 i, ac_c_table); | |
1267 residual_eob_run = unpack_vlcs(s, gb, &s->ac_vlc_1[ac_c_table], i, | 1081 residual_eob_run = unpack_vlcs(s, gb, &s->ac_vlc_1[ac_c_table], i, |
1268 s->first_coded_c_fragment, s->last_coded_c_fragment, residual_eob_run); | 1082 s->first_coded_c_fragment, s->last_coded_c_fragment, residual_eob_run); |
1269 } | 1083 } |
1270 | 1084 |
1271 /* unpack the group 2 AC coefficients (coeffs 6-14) */ | 1085 /* unpack the group 2 AC coefficients (coeffs 6-14) */ |
1272 for (i = 6; i <= 14; i++) { | 1086 for (i = 6; i <= 14; i++) { |
1273 | |
1274 debug_vp3(" vp3: unpacking level %d Y plane AC coefficients using table %d\n", | |
1275 i, ac_y_table); | |
1276 residual_eob_run = unpack_vlcs(s, gb, &s->ac_vlc_2[ac_y_table], i, | 1087 residual_eob_run = unpack_vlcs(s, gb, &s->ac_vlc_2[ac_y_table], i, |
1277 s->first_coded_y_fragment, s->last_coded_y_fragment, residual_eob_run); | 1088 s->first_coded_y_fragment, s->last_coded_y_fragment, residual_eob_run); |
1278 | 1089 |
1279 debug_vp3(" vp3: unpacking level %d C plane AC coefficients using table %d\n", | |
1280 i, ac_c_table); | |
1281 residual_eob_run = unpack_vlcs(s, gb, &s->ac_vlc_2[ac_c_table], i, | 1090 residual_eob_run = unpack_vlcs(s, gb, &s->ac_vlc_2[ac_c_table], i, |
1282 s->first_coded_c_fragment, s->last_coded_c_fragment, residual_eob_run); | 1091 s->first_coded_c_fragment, s->last_coded_c_fragment, residual_eob_run); |
1283 } | 1092 } |
1284 | 1093 |
1285 /* unpack the group 3 AC coefficients (coeffs 15-27) */ | 1094 /* unpack the group 3 AC coefficients (coeffs 15-27) */ |
1286 for (i = 15; i <= 27; i++) { | 1095 for (i = 15; i <= 27; i++) { |
1287 | |
1288 debug_vp3(" vp3: unpacking level %d Y plane AC coefficients using table %d\n", | |
1289 i, ac_y_table); | |
1290 residual_eob_run = unpack_vlcs(s, gb, &s->ac_vlc_3[ac_y_table], i, | 1096 residual_eob_run = unpack_vlcs(s, gb, &s->ac_vlc_3[ac_y_table], i, |
1291 s->first_coded_y_fragment, s->last_coded_y_fragment, residual_eob_run); | 1097 s->first_coded_y_fragment, s->last_coded_y_fragment, residual_eob_run); |
1292 | 1098 |
1293 debug_vp3(" vp3: unpacking level %d C plane AC coefficients using table %d\n", | |
1294 i, ac_c_table); | |
1295 residual_eob_run = unpack_vlcs(s, gb, &s->ac_vlc_3[ac_c_table], i, | 1099 residual_eob_run = unpack_vlcs(s, gb, &s->ac_vlc_3[ac_c_table], i, |
1296 s->first_coded_c_fragment, s->last_coded_c_fragment, residual_eob_run); | 1100 s->first_coded_c_fragment, s->last_coded_c_fragment, residual_eob_run); |
1297 } | 1101 } |
1298 | 1102 |
1299 /* unpack the group 4 AC coefficients (coeffs 28-63) */ | 1103 /* unpack the group 4 AC coefficients (coeffs 28-63) */ |
1300 for (i = 28; i <= 63; i++) { | 1104 for (i = 28; i <= 63; i++) { |
1301 | |
1302 debug_vp3(" vp3: unpacking level %d Y plane AC coefficients using table %d\n", | |
1303 i, ac_y_table); | |
1304 residual_eob_run = unpack_vlcs(s, gb, &s->ac_vlc_4[ac_y_table], i, | 1105 residual_eob_run = unpack_vlcs(s, gb, &s->ac_vlc_4[ac_y_table], i, |
1305 s->first_coded_y_fragment, s->last_coded_y_fragment, residual_eob_run); | 1106 s->first_coded_y_fragment, s->last_coded_y_fragment, residual_eob_run); |
1306 | 1107 |
1307 debug_vp3(" vp3: unpacking level %d C plane AC coefficients using table %d\n", | |
1308 i, ac_c_table); | |
1309 residual_eob_run = unpack_vlcs(s, gb, &s->ac_vlc_4[ac_c_table], i, | 1108 residual_eob_run = unpack_vlcs(s, gb, &s->ac_vlc_4[ac_c_table], i, |
1310 s->first_coded_c_fragment, s->last_coded_c_fragment, residual_eob_run); | 1109 s->first_coded_c_fragment, s->last_coded_c_fragment, residual_eob_run); |
1311 } | 1110 } |
1312 | 1111 |
1313 return 0; | 1112 return 0; |
1392 /* there is a last DC predictor for each of the 3 frame types */ | 1191 /* there is a last DC predictor for each of the 3 frame types */ |
1393 short last_dc[3]; | 1192 short last_dc[3]; |
1394 | 1193 |
1395 int transform = 0; | 1194 int transform = 0; |
1396 | 1195 |
1397 debug_vp3(" vp3: reversing DC prediction\n"); | |
1398 | |
1399 vul = vu = vur = vl = 0; | 1196 vul = vu = vur = vl = 0; |
1400 last_dc[0] = last_dc[1] = last_dc[2] = 0; | 1197 last_dc[0] = last_dc[1] = last_dc[2] = 0; |
1401 | 1198 |
1402 /* for each fragment row... */ | 1199 /* for each fragment row... */ |
1403 for (y = 0; y < fragment_height; y++) { | 1200 for (y = 0; y < fragment_height; y++) { |
1408 /* reverse prediction if this block was coded */ | 1205 /* reverse prediction if this block was coded */ |
1409 if (s->all_fragments[i].coding_method != MODE_COPY) { | 1206 if (s->all_fragments[i].coding_method != MODE_COPY) { |
1410 | 1207 |
1411 current_frame_type = | 1208 current_frame_type = |
1412 compatible_frame[s->all_fragments[i].coding_method]; | 1209 compatible_frame[s->all_fragments[i].coding_method]; |
1413 debug_dc_pred(" frag %d: orig DC = %d, ", | |
1414 i, DC_COEFF(i)); | |
1415 | 1210 |
1416 transform= 0; | 1211 transform= 0; |
1417 if(x){ | 1212 if(x){ |
1418 l= i-1; | 1213 l= i-1; |
1419 vl = DC_COEFF(l); | 1214 vl = DC_COEFF(l); |
1437 if(FRAME_CODED(ur) && COMPATIBLE_FRAME(ur)) | 1232 if(FRAME_CODED(ur) && COMPATIBLE_FRAME(ur)) |
1438 transform |= PUR; | 1233 transform |= PUR; |
1439 } | 1234 } |
1440 } | 1235 } |
1441 | 1236 |
1442 debug_dc_pred("transform = %d, ", transform); | |
1443 | |
1444 if (transform == 0) { | 1237 if (transform == 0) { |
1445 | 1238 |
1446 /* if there were no fragments to predict from, use last | 1239 /* if there were no fragments to predict from, use last |
1447 * DC saved */ | 1240 * DC saved */ |
1448 predicted_dc = last_dc[current_frame_type]; | 1241 predicted_dc = last_dc[current_frame_type]; |
1449 debug_dc_pred("from last DC (%d) = %d\n", | |
1450 current_frame_type, DC_COEFF(i)); | |
1451 | |
1452 } else { | 1242 } else { |
1453 | 1243 |
1454 /* apply the appropriate predictor transform */ | 1244 /* apply the appropriate predictor transform */ |
1455 predicted_dc = | 1245 predicted_dc = |
1456 (predictor_transform[transform][0] * vul) + | 1246 (predictor_transform[transform][0] * vul) + |
1469 predicted_dc = vl; | 1259 predicted_dc = vl; |
1470 else if (FFABS(predicted_dc - vul) > 128) | 1260 else if (FFABS(predicted_dc - vul) > 128) |
1471 predicted_dc = vul; | 1261 predicted_dc = vul; |
1472 } | 1262 } |
1473 | 1263 |
1474 debug_dc_pred("from pred DC = %d\n", | |
1475 DC_COEFF(i)); | 1264 DC_COEFF(i)); |
1476 } | 1265 } |
1477 | 1266 |
1478 /* at long last, apply the predictor */ | 1267 /* at long last, apply the predictor */ |
1479 if(s->coeffs[i].index){ | 1268 if(s->coeffs[i].index){ |
1619 }else{ | 1408 }else{ |
1620 dequantizer = s->qmat[0][plane]; | 1409 dequantizer = s->qmat[0][plane]; |
1621 } | 1410 } |
1622 | 1411 |
1623 /* dequantize the DCT coefficients */ | 1412 /* dequantize the DCT coefficients */ |
1624 debug_idct("fragment %d, coding mode %d, DC = %d, dequant = %d:\n", | |
1625 i, s->all_fragments[i].coding_method, | |
1626 DC_COEFF(i), dequantizer[0]); | |
1627 | |
1628 if(s->avctx->idct_algo==FF_IDCT_VP3){ | 1413 if(s->avctx->idct_algo==FF_IDCT_VP3){ |
1629 Coeff *coeff= s->coeffs + i; | 1414 Coeff *coeff= s->coeffs + i; |
1630 memset(block, 0, sizeof(block)); | 1415 memset(block, 0, sizeof(block)); |
1631 while(coeff->next){ | 1416 while(coeff->next){ |
1632 block[coeff->index]= coeff->coeff * dequantizer[coeff->index]; | 1417 block[coeff->index]= coeff->coeff * dequantizer[coeff->index]; |
1654 s->dsp.idct_add( | 1439 s->dsp.idct_add( |
1655 output_plane + s->all_fragments[i].first_pixel, | 1440 output_plane + s->all_fragments[i].first_pixel, |
1656 stride, | 1441 stride, |
1657 block); | 1442 block); |
1658 } | 1443 } |
1659 | |
1660 debug_idct("block after idct_%s():\n", | |
1661 (s->all_fragments[i].coding_method == MODE_INTRA)? | |
1662 "put" : "add"); | |
1663 for (m = 0; m < 8; m++) { | |
1664 for (n = 0; n < 8; n++) { | |
1665 debug_idct(" %3d", *(output_plane + | |
1666 s->all_fragments[i].first_pixel + (m * stride + n))); | |
1667 } | |
1668 debug_idct("\n"); | |
1669 } | |
1670 debug_idct("\n"); | |
1671 | |
1672 } else { | 1444 } else { |
1673 | 1445 |
1674 /* copy directly from the previous frame */ | 1446 /* copy directly from the previous frame */ |
1675 s->dsp.put_pixels_tab[1][0]( | 1447 s->dsp.put_pixels_tab[1][0]( |
1676 output_plane + s->all_fragments[i].first_pixel, | 1448 output_plane + s->all_fragments[i].first_pixel, |
1858 for (x = 0; x < s->fragment_width; x++) { | 1630 for (x = 0; x < s->fragment_width; x++) { |
1859 s->all_fragments[i++].first_pixel = | 1631 s->all_fragments[i++].first_pixel = |
1860 s->golden_frame.linesize[0] * y * FRAGMENT_PIXELS - | 1632 s->golden_frame.linesize[0] * y * FRAGMENT_PIXELS - |
1861 s->golden_frame.linesize[0] + | 1633 s->golden_frame.linesize[0] + |
1862 x * FRAGMENT_PIXELS; | 1634 x * FRAGMENT_PIXELS; |
1863 debug_init(" fragment %d, first pixel @ %d\n", | |
1864 i-1, s->all_fragments[i-1].first_pixel); | |
1865 } | 1635 } |
1866 } | 1636 } |
1867 | 1637 |
1868 /* U plane */ | 1638 /* U plane */ |
1869 i = s->fragment_start[1]; | 1639 i = s->fragment_start[1]; |
1871 for (x = 0; x < s->fragment_width / 2; x++) { | 1641 for (x = 0; x < s->fragment_width / 2; x++) { |
1872 s->all_fragments[i++].first_pixel = | 1642 s->all_fragments[i++].first_pixel = |
1873 s->golden_frame.linesize[1] * y * FRAGMENT_PIXELS - | 1643 s->golden_frame.linesize[1] * y * FRAGMENT_PIXELS - |
1874 s->golden_frame.linesize[1] + | 1644 s->golden_frame.linesize[1] + |
1875 x * FRAGMENT_PIXELS; | 1645 x * FRAGMENT_PIXELS; |
1876 debug_init(" fragment %d, first pixel @ %d\n", | |
1877 i-1, s->all_fragments[i-1].first_pixel); | |
1878 } | 1646 } |
1879 } | 1647 } |
1880 | 1648 |
1881 /* V plane */ | 1649 /* V plane */ |
1882 i = s->fragment_start[2]; | 1650 i = s->fragment_start[2]; |
1884 for (x = 0; x < s->fragment_width / 2; x++) { | 1652 for (x = 0; x < s->fragment_width / 2; x++) { |
1885 s->all_fragments[i++].first_pixel = | 1653 s->all_fragments[i++].first_pixel = |
1886 s->golden_frame.linesize[2] * y * FRAGMENT_PIXELS - | 1654 s->golden_frame.linesize[2] * y * FRAGMENT_PIXELS - |
1887 s->golden_frame.linesize[2] + | 1655 s->golden_frame.linesize[2] + |
1888 x * FRAGMENT_PIXELS; | 1656 x * FRAGMENT_PIXELS; |
1889 debug_init(" fragment %d, first pixel @ %d\n", | |
1890 i-1, s->all_fragments[i-1].first_pixel); | |
1891 } | 1657 } |
1892 } | 1658 } |
1893 } | 1659 } |
1894 | 1660 |
1895 /* FIXME: this should be merged with the above! */ | 1661 /* FIXME: this should be merged with the above! */ |
1905 for (x = 0; x < s->fragment_width; x++) { | 1671 for (x = 0; x < s->fragment_width; x++) { |
1906 s->all_fragments[i++].first_pixel = | 1672 s->all_fragments[i++].first_pixel = |
1907 s->golden_frame.linesize[0] * y * FRAGMENT_PIXELS - | 1673 s->golden_frame.linesize[0] * y * FRAGMENT_PIXELS - |
1908 s->golden_frame.linesize[0] + | 1674 s->golden_frame.linesize[0] + |
1909 x * FRAGMENT_PIXELS; | 1675 x * FRAGMENT_PIXELS; |
1910 debug_init(" fragment %d, first pixel @ %d\n", | |
1911 i-1, s->all_fragments[i-1].first_pixel); | |
1912 } | 1676 } |
1913 } | 1677 } |
1914 | 1678 |
1915 /* U plane */ | 1679 /* U plane */ |
1916 i = s->fragment_start[1]; | 1680 i = s->fragment_start[1]; |
1918 for (x = 0; x < s->fragment_width / 2; x++) { | 1682 for (x = 0; x < s->fragment_width / 2; x++) { |
1919 s->all_fragments[i++].first_pixel = | 1683 s->all_fragments[i++].first_pixel = |
1920 s->golden_frame.linesize[1] * y * FRAGMENT_PIXELS - | 1684 s->golden_frame.linesize[1] * y * FRAGMENT_PIXELS - |
1921 s->golden_frame.linesize[1] + | 1685 s->golden_frame.linesize[1] + |
1922 x * FRAGMENT_PIXELS; | 1686 x * FRAGMENT_PIXELS; |
1923 debug_init(" fragment %d, first pixel @ %d\n", | |
1924 i-1, s->all_fragments[i-1].first_pixel); | |
1925 } | 1687 } |
1926 } | 1688 } |
1927 | 1689 |
1928 /* V plane */ | 1690 /* V plane */ |
1929 i = s->fragment_start[2]; | 1691 i = s->fragment_start[2]; |
1931 for (x = 0; x < s->fragment_width / 2; x++) { | 1693 for (x = 0; x < s->fragment_width / 2; x++) { |
1932 s->all_fragments[i++].first_pixel = | 1694 s->all_fragments[i++].first_pixel = |
1933 s->golden_frame.linesize[2] * y * FRAGMENT_PIXELS - | 1695 s->golden_frame.linesize[2] * y * FRAGMENT_PIXELS - |
1934 s->golden_frame.linesize[2] + | 1696 s->golden_frame.linesize[2] + |
1935 x * FRAGMENT_PIXELS; | 1697 x * FRAGMENT_PIXELS; |
1936 debug_init(" fragment %d, first pixel @ %d\n", | |
1937 i-1, s->all_fragments[i-1].first_pixel); | |
1938 } | 1698 } |
1939 } | 1699 } |
1940 } | 1700 } |
1941 | 1701 |
1942 /* | 1702 /* |
1995 | 1755 |
1996 /* fragment count covers all 8x8 blocks for all 3 planes */ | 1756 /* fragment count covers all 8x8 blocks for all 3 planes */ |
1997 s->fragment_count = s->fragment_width * s->fragment_height * 3 / 2; | 1757 s->fragment_count = s->fragment_width * s->fragment_height * 3 / 2; |
1998 s->fragment_start[1] = s->fragment_width * s->fragment_height; | 1758 s->fragment_start[1] = s->fragment_width * s->fragment_height; |
1999 s->fragment_start[2] = s->fragment_width * s->fragment_height * 5 / 4; | 1759 s->fragment_start[2] = s->fragment_width * s->fragment_height * 5 / 4; |
2000 | |
2001 debug_init(" Y plane: %d x %d\n", s->width, s->height); | |
2002 debug_init(" C plane: %d x %d\n", c_width, c_height); | |
2003 debug_init(" Y superblocks: %d x %d, %d total\n", | |
2004 s->y_superblock_width, s->y_superblock_height, y_superblock_count); | |
2005 debug_init(" C superblocks: %d x %d, %d total\n", | |
2006 s->c_superblock_width, s->c_superblock_height, c_superblock_count); | |
2007 debug_init(" total superblocks = %d, U starts @ %d, V starts @ %d\n", | |
2008 s->superblock_count, s->u_superblock_start, s->v_superblock_start); | |
2009 debug_init(" macroblocks: %d x %d, %d total\n", | |
2010 s->macroblock_width, s->macroblock_height, s->macroblock_count); | |
2011 debug_init(" %d fragments, %d x %d, u starts @ %d, v starts @ %d\n", | |
2012 s->fragment_count, | |
2013 s->fragment_width, | |
2014 s->fragment_height, | |
2015 s->fragment_start[1], | |
2016 s->fragment_start[2]); | |
2017 | 1760 |
2018 s->all_fragments = av_malloc(s->fragment_count * sizeof(Vp3Fragment)); | 1761 s->all_fragments = av_malloc(s->fragment_count * sizeof(Vp3Fragment)); |
2019 s->coeff_counts = av_malloc(s->fragment_count * sizeof(*s->coeff_counts)); | 1762 s->coeff_counts = av_malloc(s->fragment_count * sizeof(*s->coeff_counts)); |
2020 s->coeffs = av_malloc(s->fragment_count * sizeof(Coeff) * 65); | 1763 s->coeffs = av_malloc(s->fragment_count * sizeof(Coeff) * 65); |
2021 s->coded_fragment_list = av_malloc(s->fragment_count * sizeof(int)); | 1764 s->coded_fragment_list = av_malloc(s->fragment_count * sizeof(int)); |
2567 | 2310 |
2568 for(i=0;i<3;i++) { | 2311 for(i=0;i<3;i++) { |
2569 init_get_bits(&gb, header_start[i], header_len[i]); | 2312 init_get_bits(&gb, header_start[i], header_len[i]); |
2570 | 2313 |
2571 ptype = get_bits(&gb, 8); | 2314 ptype = get_bits(&gb, 8); |
2572 debug_vp3("Theora headerpacket type: %x\n", ptype); | |
2573 | 2315 |
2574 if (!(ptype & 0x80)) | 2316 if (!(ptype & 0x80)) |
2575 { | 2317 { |
2576 av_log(avctx, AV_LOG_ERROR, "Invalid extradata!\n"); | 2318 av_log(avctx, AV_LOG_ERROR, "Invalid extradata!\n"); |
2577 // return -1; | 2319 // return -1; |