comparison h263dec.c @ 144:cb5dabd00ba2 libavcodec

- Bug fix on inter MCBPC table for inter+q. - H.263/H.263+ decoder now knows GOB start codes. - H.263/H.263+ decoder now returns the size of the stream on the first call. - Added show_bits() functions to see the buffer without loosing the bits. - TODO: H.263v1 UMV parsing is buggy.
author pulento
date Sat, 03 Nov 2001 00:49:53 +0000
parents cdd89f96cbe1
children f914f710b8d0
comparison
equal deleted inserted replaced
143:35e3ced6cfd9 144:cb5dabd00ba2
54 default: 54 default:
55 return -1; 55 return -1;
56 } 56 }
57 57
58 /* for h263, we allocate the images after having read the header */ 58 /* for h263, we allocate the images after having read the header */
59 if (MPV_common_init(s) < 0) 59 if (avctx->codec->id != CODEC_ID_H263)
60 return -1; 60 if (MPV_common_init(s) < 0)
61 return -1;
61 62
62 /* XXX: suppress this matrix init, only needed because using mpeg1 63 /* XXX: suppress this matrix init, only needed because using mpeg1
63 dequantize in mmx case */ 64 dequantize in mmx case */
64 for(i=0;i<64;i++) 65 for(i=0;i<64;i++)
65 s->non_intra_matrix[i] = default_non_intra_matrix[i]; 66 s->non_intra_matrix[i] = default_non_intra_matrix[i];
90 91
91 #ifdef DEBUG 92 #ifdef DEBUG
92 printf("*****frame %d size=%d\n", avctx->frame_number, buf_size); 93 printf("*****frame %d size=%d\n", avctx->frame_number, buf_size);
93 printf("bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]); 94 printf("bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]);
94 #endif 95 #endif
95 96
96 /* no supplementary picture */ 97 /* no supplementary picture */
97 if (buf_size == 0) { 98 if (buf_size == 0) {
98 *data_size = 0; 99 *data_size = 0;
99 return 0; 100 return 0;
100 } 101 }
108 ret = mpeg4_decode_picture_header(s); 109 ret = mpeg4_decode_picture_header(s);
109 } else if (s->h263_intel) { 110 } else if (s->h263_intel) {
110 ret = intel_h263_decode_picture_header(s); 111 ret = intel_h263_decode_picture_header(s);
111 } else { 112 } else {
112 ret = h263_decode_picture_header(s); 113 ret = h263_decode_picture_header(s);
114 /* After H263 header decode we have the height, width, */
115 /* and other parameters. So then we could init the picture */
116 if (s->width != avctx->width || s->height != avctx->height) {
117 avctx->width = s->width;
118 avctx->height = s->height;
119 /* FIXME: By the way H263 decoder is evolving it should have */
120 /* an H263EncContext */
121 if (MPV_common_init(s) < 0)
122 return -1;
123 }
113 } 124 }
114 if (ret < 0) 125 if (ret < 0)
115 return -1; 126 return -1;
116 127
117 MPV_frame_start(s); 128 MPV_frame_start(s);
124 for(s->mb_y=0; s->mb_y < s->mb_height; s->mb_y++) { 135 for(s->mb_y=0; s->mb_y < s->mb_height; s->mb_y++) {
125 for(s->mb_x=0; s->mb_x < s->mb_width; s->mb_x++) { 136 for(s->mb_x=0; s->mb_x < s->mb_width; s->mb_x++) {
126 #ifdef DEBUG 137 #ifdef DEBUG
127 printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y); 138 printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y);
128 #endif 139 #endif
140 //fprintf(stderr,"\nFrame: %d\tMB: %d",avctx->frame_number, (s->mb_y * s->mb_width) + s->mb_x);
129 /* DCT & quantize */ 141 /* DCT & quantize */
130 if (s->h263_msmpeg4) { 142 if (s->h263_msmpeg4) {
131 msmpeg4_dc_scale(s); 143 msmpeg4_dc_scale(s);
132 } else if (s->h263_pred) { 144 } else if (s->h263_pred) {
133 h263_dc_scale(s); 145 h263_dc_scale(s);