annotate h263dec.c @ 208:2eb04d6be309 libavcodec

(commit by michael) bye bye weird al rounding bug ;)
author arpi_esp
date Tue, 15 Jan 2002 22:22:41 +0000
parents 9bfd3abd85eb
children 840cd25bf259
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
1 /*
986e461dc072 Initial revision
glantau
parents:
diff changeset
2 * H263 decoder
986e461dc072 Initial revision
glantau
parents:
diff changeset
3 * Copyright (c) 2001 Gerard Lantau.
986e461dc072 Initial revision
glantau
parents:
diff changeset
4 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify
986e461dc072 Initial revision
glantau
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
986e461dc072 Initial revision
glantau
parents:
diff changeset
7 * the Free Software Foundation; either version 2 of the License, or
986e461dc072 Initial revision
glantau
parents:
diff changeset
8 * (at your option) any later version.
986e461dc072 Initial revision
glantau
parents:
diff changeset
9 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
986e461dc072 Initial revision
glantau
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
986e461dc072 Initial revision
glantau
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
986e461dc072 Initial revision
glantau
parents:
diff changeset
13 * GNU General Public License for more details.
986e461dc072 Initial revision
glantau
parents:
diff changeset
14 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
986e461dc072 Initial revision
glantau
parents:
diff changeset
16 * along with this program; if not, write to the Free Software
986e461dc072 Initial revision
glantau
parents:
diff changeset
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
986e461dc072 Initial revision
glantau
parents:
diff changeset
18 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
19 #include <stdlib.h>
986e461dc072 Initial revision
glantau
parents:
diff changeset
20 #include <stdio.h>
986e461dc072 Initial revision
glantau
parents:
diff changeset
21 #include <string.h>
986e461dc072 Initial revision
glantau
parents:
diff changeset
22 #include "dsputil.h"
986e461dc072 Initial revision
glantau
parents:
diff changeset
23 #include "avcodec.h"
986e461dc072 Initial revision
glantau
parents:
diff changeset
24 #include "mpegvideo.h"
986e461dc072 Initial revision
glantau
parents:
diff changeset
25
986e461dc072 Initial revision
glantau
parents:
diff changeset
26 //#define DEBUG
986e461dc072 Initial revision
glantau
parents:
diff changeset
27
986e461dc072 Initial revision
glantau
parents:
diff changeset
28 static int h263_decode_init(AVCodecContext *avctx)
986e461dc072 Initial revision
glantau
parents:
diff changeset
29 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
30 MpegEncContext *s = avctx->priv_data;
60
35c1141e23d9 moved matrix init away from MPV_common_init()
glantau
parents: 56
diff changeset
31 int i;
35c1141e23d9 moved matrix init away from MPV_common_init()
glantau
parents: 56
diff changeset
32
67
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
33 s->avctx = avctx;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
34 s->out_format = FMT_H263;
986e461dc072 Initial revision
glantau
parents:
diff changeset
35
986e461dc072 Initial revision
glantau
parents:
diff changeset
36 s->width = avctx->width;
986e461dc072 Initial revision
glantau
parents:
diff changeset
37 s->height = avctx->height;
986e461dc072 Initial revision
glantau
parents:
diff changeset
38
986e461dc072 Initial revision
glantau
parents:
diff changeset
39 /* select sub codec */
986e461dc072 Initial revision
glantau
parents:
diff changeset
40 switch(avctx->codec->id) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
41 case CODEC_ID_H263:
154
f914f710b8d0 - Fixed a bug on H.263 MV prediction for MB on GOBs limits.
pulento
parents: 144
diff changeset
42 s->gob_number = 0;
f914f710b8d0 - Fixed a bug on H.263 MV prediction for MB on GOBs limits.
pulento
parents: 144
diff changeset
43 s->first_gob_line = 0;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
44 break;
67
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
45 case CODEC_ID_MPEG4:
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
46 s->time_increment_bits = 4; /* default value for broken headers */
986e461dc072 Initial revision
glantau
parents:
diff changeset
47 s->h263_pred = 1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
48 break;
986e461dc072 Initial revision
glantau
parents:
diff changeset
49 case CODEC_ID_MSMPEG4:
986e461dc072 Initial revision
glantau
parents:
diff changeset
50 s->h263_msmpeg4 = 1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
51 s->h263_pred = 1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
52 break;
986e461dc072 Initial revision
glantau
parents:
diff changeset
53 case CODEC_ID_H263I:
986e461dc072 Initial revision
glantau
parents:
diff changeset
54 s->h263_intel = 1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
55 break;
986e461dc072 Initial revision
glantau
parents:
diff changeset
56 default:
986e461dc072 Initial revision
glantau
parents:
diff changeset
57 return -1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
58 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
59
986e461dc072 Initial revision
glantau
parents:
diff changeset
60 /* for h263, we allocate the images after having read the header */
144
cb5dabd00ba2 - Bug fix on inter MCBPC table for inter+q.
pulento
parents: 67
diff changeset
61 if (avctx->codec->id != CODEC_ID_H263)
cb5dabd00ba2 - Bug fix on inter MCBPC table for inter+q.
pulento
parents: 67
diff changeset
62 if (MPV_common_init(s) < 0)
cb5dabd00ba2 - Bug fix on inter MCBPC table for inter+q.
pulento
parents: 67
diff changeset
63 return -1;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
64
60
35c1141e23d9 moved matrix init away from MPV_common_init()
glantau
parents: 56
diff changeset
65 /* XXX: suppress this matrix init, only needed because using mpeg1
35c1141e23d9 moved matrix init away from MPV_common_init()
glantau
parents: 56
diff changeset
66 dequantize in mmx case */
35c1141e23d9 moved matrix init away from MPV_common_init()
glantau
parents: 56
diff changeset
67 for(i=0;i<64;i++)
35c1141e23d9 moved matrix init away from MPV_common_init()
glantau
parents: 56
diff changeset
68 s->non_intra_matrix[i] = default_non_intra_matrix[i];
35c1141e23d9 moved matrix init away from MPV_common_init()
glantau
parents: 56
diff changeset
69
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
70 if (s->h263_msmpeg4)
986e461dc072 Initial revision
glantau
parents:
diff changeset
71 msmpeg4_decode_init_vlc(s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
72 else
986e461dc072 Initial revision
glantau
parents:
diff changeset
73 h263_decode_init_vlc(s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
74
986e461dc072 Initial revision
glantau
parents:
diff changeset
75 return 0;
986e461dc072 Initial revision
glantau
parents:
diff changeset
76 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
77
986e461dc072 Initial revision
glantau
parents:
diff changeset
78 static int h263_decode_end(AVCodecContext *avctx)
986e461dc072 Initial revision
glantau
parents:
diff changeset
79 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
80 MpegEncContext *s = avctx->priv_data;
986e461dc072 Initial revision
glantau
parents:
diff changeset
81
986e461dc072 Initial revision
glantau
parents:
diff changeset
82 MPV_common_end(s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
83 return 0;
986e461dc072 Initial revision
glantau
parents:
diff changeset
84 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
85
986e461dc072 Initial revision
glantau
parents:
diff changeset
86 static int h263_decode_frame(AVCodecContext *avctx,
986e461dc072 Initial revision
glantau
parents:
diff changeset
87 void *data, int *data_size,
986e461dc072 Initial revision
glantau
parents:
diff changeset
88 UINT8 *buf, int buf_size)
986e461dc072 Initial revision
glantau
parents:
diff changeset
89 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
90 MpegEncContext *s = avctx->priv_data;
986e461dc072 Initial revision
glantau
parents:
diff changeset
91 int ret;
986e461dc072 Initial revision
glantau
parents:
diff changeset
92 AVPicture *pict = data;
986e461dc072 Initial revision
glantau
parents:
diff changeset
93
986e461dc072 Initial revision
glantau
parents:
diff changeset
94 #ifdef DEBUG
986e461dc072 Initial revision
glantau
parents:
diff changeset
95 printf("*****frame %d size=%d\n", avctx->frame_number, buf_size);
986e461dc072 Initial revision
glantau
parents:
diff changeset
96 printf("bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]);
986e461dc072 Initial revision
glantau
parents:
diff changeset
97 #endif
144
cb5dabd00ba2 - Bug fix on inter MCBPC table for inter+q.
pulento
parents: 67
diff changeset
98
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
99 /* no supplementary picture */
986e461dc072 Initial revision
glantau
parents:
diff changeset
100 if (buf_size == 0) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
101 *data_size = 0;
986e461dc072 Initial revision
glantau
parents:
diff changeset
102 return 0;
986e461dc072 Initial revision
glantau
parents:
diff changeset
103 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
104
986e461dc072 Initial revision
glantau
parents:
diff changeset
105 init_get_bits(&s->gb, buf, buf_size);
986e461dc072 Initial revision
glantau
parents:
diff changeset
106
986e461dc072 Initial revision
glantau
parents:
diff changeset
107 /* let's go :-) */
986e461dc072 Initial revision
glantau
parents:
diff changeset
108 if (s->h263_msmpeg4) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
109 ret = msmpeg4_decode_picture_header(s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
110 } else if (s->h263_pred) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
111 ret = mpeg4_decode_picture_header(s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
112 } else if (s->h263_intel) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
113 ret = intel_h263_decode_picture_header(s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
114 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
115 ret = h263_decode_picture_header(s);
160
1bf8c111691d - Bug fixed on H.263 decoder initialization.
pulento
parents: 154
diff changeset
116 /* After H263 header decode we have the height, width, */
1bf8c111691d - Bug fixed on H.263 decoder initialization.
pulento
parents: 154
diff changeset
117 /* and other parameters. So then we could init the picture */
1bf8c111691d - Bug fixed on H.263 decoder initialization.
pulento
parents: 154
diff changeset
118 /* FIXME: By the way H263 decoder is evolving it should have */
1bf8c111691d - Bug fixed on H.263 decoder initialization.
pulento
parents: 154
diff changeset
119 /* an H263EncContext */
1bf8c111691d - Bug fixed on H.263 decoder initialization.
pulento
parents: 154
diff changeset
120 if (!s->context_initialized) {
144
cb5dabd00ba2 - Bug fix on inter MCBPC table for inter+q.
pulento
parents: 67
diff changeset
121 avctx->width = s->width;
cb5dabd00ba2 - Bug fix on inter MCBPC table for inter+q.
pulento
parents: 67
diff changeset
122 avctx->height = s->height;
160
1bf8c111691d - Bug fixed on H.263 decoder initialization.
pulento
parents: 154
diff changeset
123 if (MPV_common_init(s) < 0)
1bf8c111691d - Bug fixed on H.263 decoder initialization.
pulento
parents: 154
diff changeset
124 return -1;
1bf8c111691d - Bug fixed on H.263 decoder initialization.
pulento
parents: 154
diff changeset
125 } else if (s->width != avctx->width || s->height != avctx->height) {
1bf8c111691d - Bug fixed on H.263 decoder initialization.
pulento
parents: 154
diff changeset
126 /* H.263 could change picture size any time */
1bf8c111691d - Bug fixed on H.263 decoder initialization.
pulento
parents: 154
diff changeset
127 MPV_common_end(s);
144
cb5dabd00ba2 - Bug fix on inter MCBPC table for inter+q.
pulento
parents: 67
diff changeset
128 if (MPV_common_init(s) < 0)
cb5dabd00ba2 - Bug fix on inter MCBPC table for inter+q.
pulento
parents: 67
diff changeset
129 return -1;
cb5dabd00ba2 - Bug fix on inter MCBPC table for inter+q.
pulento
parents: 67
diff changeset
130 }
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
131 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
132 if (ret < 0)
986e461dc072 Initial revision
glantau
parents:
diff changeset
133 return -1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
134
986e461dc072 Initial revision
glantau
parents:
diff changeset
135 MPV_frame_start(s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
136
986e461dc072 Initial revision
glantau
parents:
diff changeset
137 #ifdef DEBUG
986e461dc072 Initial revision
glantau
parents:
diff changeset
138 printf("qscale=%d\n", s->qscale);
986e461dc072 Initial revision
glantau
parents:
diff changeset
139 #endif
986e461dc072 Initial revision
glantau
parents:
diff changeset
140
986e461dc072 Initial revision
glantau
parents:
diff changeset
141 /* decode each macroblock */
986e461dc072 Initial revision
glantau
parents:
diff changeset
142 for(s->mb_y=0; s->mb_y < s->mb_height; s->mb_y++) {
162
de80712db90b - Preliminary RTP friendly mode for H.263.
pulento
parents: 161
diff changeset
143 /* Check for GOB headers on H.263 */
de80712db90b - Preliminary RTP friendly mode for H.263.
pulento
parents: 161
diff changeset
144 /* FIXME: In the future H.263+ will have intra prediction */
de80712db90b - Preliminary RTP friendly mode for H.263.
pulento
parents: 161
diff changeset
145 /* and we are gonna need another way to detect MPEG4 */
de80712db90b - Preliminary RTP friendly mode for H.263.
pulento
parents: 161
diff changeset
146 if (s->mb_y && !s->h263_pred) {
de80712db90b - Preliminary RTP friendly mode for H.263.
pulento
parents: 161
diff changeset
147 s->first_gob_line = h263_decode_gob_header(s);
de80712db90b - Preliminary RTP friendly mode for H.263.
pulento
parents: 161
diff changeset
148 }
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
149 for(s->mb_x=0; s->mb_x < s->mb_width; s->mb_x++) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
150 #ifdef DEBUG
986e461dc072 Initial revision
glantau
parents:
diff changeset
151 printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y);
986e461dc072 Initial revision
glantau
parents:
diff changeset
152 #endif
144
cb5dabd00ba2 - Bug fix on inter MCBPC table for inter+q.
pulento
parents: 67
diff changeset
153 //fprintf(stderr,"\nFrame: %d\tMB: %d",avctx->frame_number, (s->mb_y * s->mb_width) + s->mb_x);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
154 /* DCT & quantize */
986e461dc072 Initial revision
glantau
parents:
diff changeset
155 if (s->h263_msmpeg4) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
156 msmpeg4_dc_scale(s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
157 } else if (s->h263_pred) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
158 h263_dc_scale(s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
159 } else {
986e461dc072 Initial revision
glantau
parents:
diff changeset
160 /* default quantization values */
986e461dc072 Initial revision
glantau
parents:
diff changeset
161 s->y_dc_scale = 8;
986e461dc072 Initial revision
glantau
parents:
diff changeset
162 s->c_dc_scale = 8;
986e461dc072 Initial revision
glantau
parents:
diff changeset
163 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
164
203
9bfd3abd85eb (commit by michael)
arpi_esp
parents: 162
diff changeset
165 #ifdef HAVE_MMX
9bfd3abd85eb (commit by michael)
arpi_esp
parents: 162
diff changeset
166 if (mm_flags & MM_MMX) {
9bfd3abd85eb (commit by michael)
arpi_esp
parents: 162
diff changeset
167 asm volatile(
9bfd3abd85eb (commit by michael)
arpi_esp
parents: 162
diff changeset
168 "pxor %%mm7, %%mm7 \n\t"
9bfd3abd85eb (commit by michael)
arpi_esp
parents: 162
diff changeset
169 "movl $-128*6, %%eax \n\t"
9bfd3abd85eb (commit by michael)
arpi_esp
parents: 162
diff changeset
170 "1: \n\t"
9bfd3abd85eb (commit by michael)
arpi_esp
parents: 162
diff changeset
171 "movq %%mm7, (%0, %%eax) \n\t"
9bfd3abd85eb (commit by michael)
arpi_esp
parents: 162
diff changeset
172 "movq %%mm7, 8(%0, %%eax) \n\t"
9bfd3abd85eb (commit by michael)
arpi_esp
parents: 162
diff changeset
173 "movq %%mm7, 16(%0, %%eax) \n\t"
9bfd3abd85eb (commit by michael)
arpi_esp
parents: 162
diff changeset
174 "movq %%mm7, 24(%0, %%eax) \n\t"
9bfd3abd85eb (commit by michael)
arpi_esp
parents: 162
diff changeset
175 "addl $32, %%eax \n\t"
9bfd3abd85eb (commit by michael)
arpi_esp
parents: 162
diff changeset
176 " js 1b \n\t"
9bfd3abd85eb (commit by michael)
arpi_esp
parents: 162
diff changeset
177 : : "r" (((int)s->block)+128*6)
9bfd3abd85eb (commit by michael)
arpi_esp
parents: 162
diff changeset
178 : "%eax"
9bfd3abd85eb (commit by michael)
arpi_esp
parents: 162
diff changeset
179 );
9bfd3abd85eb (commit by michael)
arpi_esp
parents: 162
diff changeset
180 }else{
9bfd3abd85eb (commit by michael)
arpi_esp
parents: 162
diff changeset
181 memset(s->block, 0, sizeof(s->block));
9bfd3abd85eb (commit by michael)
arpi_esp
parents: 162
diff changeset
182 }
9bfd3abd85eb (commit by michael)
arpi_esp
parents: 162
diff changeset
183 #else
12
4d50c7d89e0f use block[] in structure to have it aligned on 8 bytes for mmx optimizations
glantau
parents: 0
diff changeset
184 memset(s->block, 0, sizeof(s->block));
203
9bfd3abd85eb (commit by michael)
arpi_esp
parents: 162
diff changeset
185 #endif
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
186 s->mv_dir = MV_DIR_FORWARD;
986e461dc072 Initial revision
glantau
parents:
diff changeset
187 s->mv_type = MV_TYPE_16X16;
986e461dc072 Initial revision
glantau
parents:
diff changeset
188 if (s->h263_msmpeg4) {
12
4d50c7d89e0f use block[] in structure to have it aligned on 8 bytes for mmx optimizations
glantau
parents: 0
diff changeset
189 if (msmpeg4_decode_mb(s, s->block) < 0)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
190 return -1;
986e461dc072 Initial revision
glantau
parents:
diff changeset
191 } else {
161
7ce36cf13055 - Added support to Inter4V+Q MBs to H.263 decoder.
pulento
parents: 160
diff changeset
192 if (h263_decode_mb(s, s->block) < 0) {
7ce36cf13055 - Added support to Inter4V+Q MBs to H.263 decoder.
pulento
parents: 160
diff changeset
193 fprintf(stderr,"\nError at MB: %d\n", (s->mb_y * s->mb_width) + s->mb_x);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
194 return -1;
161
7ce36cf13055 - Added support to Inter4V+Q MBs to H.263 decoder.
pulento
parents: 160
diff changeset
195 }
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
196 }
12
4d50c7d89e0f use block[] in structure to have it aligned on 8 bytes for mmx optimizations
glantau
parents: 0
diff changeset
197 MPV_decode_mb(s, s->block);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
198 }
67
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
199 if (avctx->draw_horiz_band) {
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
200 UINT8 *src_ptr[3];
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
201 int y, h, offset;
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
202 y = s->mb_y * 16;
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
203 h = s->height - y;
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
204 if (h > 16)
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
205 h = 16;
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
206 offset = y * s->linesize;
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
207 src_ptr[0] = s->current_picture[0] + offset;
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
208 src_ptr[1] = s->current_picture[1] + (offset >> 2);
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
209 src_ptr[2] = s->current_picture[2] + (offset >> 2);
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
210 avctx->draw_horiz_band(avctx, src_ptr, s->linesize,
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
211 y, s->width, h);
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
212 }
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
213 }
208
2eb04d6be309 (commit by michael)
arpi_esp
parents: 203
diff changeset
214
2eb04d6be309 (commit by michael)
arpi_esp
parents: 203
diff changeset
215 if (s->h263_msmpeg4)
2eb04d6be309 (commit by michael)
arpi_esp
parents: 203
diff changeset
216 if(msmpeg4_decode_ext_header(s, buf_size) < 0) return -1;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
217
986e461dc072 Initial revision
glantau
parents:
diff changeset
218 MPV_frame_end(s);
986e461dc072 Initial revision
glantau
parents:
diff changeset
219
986e461dc072 Initial revision
glantau
parents:
diff changeset
220 pict->data[0] = s->current_picture[0];
986e461dc072 Initial revision
glantau
parents:
diff changeset
221 pict->data[1] = s->current_picture[1];
986e461dc072 Initial revision
glantau
parents:
diff changeset
222 pict->data[2] = s->current_picture[2];
986e461dc072 Initial revision
glantau
parents:
diff changeset
223 pict->linesize[0] = s->linesize;
986e461dc072 Initial revision
glantau
parents:
diff changeset
224 pict->linesize[1] = s->linesize / 2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
225 pict->linesize[2] = s->linesize / 2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
226
986e461dc072 Initial revision
glantau
parents:
diff changeset
227 avctx->quality = s->qscale;
986e461dc072 Initial revision
glantau
parents:
diff changeset
228 *data_size = sizeof(AVPicture);
986e461dc072 Initial revision
glantau
parents:
diff changeset
229 return buf_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
230 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
231
67
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
232 AVCodec mpeg4_decoder = {
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
233 "mpeg4",
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
234 CODEC_TYPE_VIDEO,
67
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
235 CODEC_ID_MPEG4,
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
236 sizeof(MpegEncContext),
986e461dc072 Initial revision
glantau
parents:
diff changeset
237 h263_decode_init,
986e461dc072 Initial revision
glantau
parents:
diff changeset
238 NULL,
986e461dc072 Initial revision
glantau
parents:
diff changeset
239 h263_decode_end,
986e461dc072 Initial revision
glantau
parents:
diff changeset
240 h263_decode_frame,
67
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
241 CODEC_CAP_DRAW_HORIZ_BAND,
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
242 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
243
986e461dc072 Initial revision
glantau
parents:
diff changeset
244 AVCodec h263_decoder = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
245 "h263",
986e461dc072 Initial revision
glantau
parents:
diff changeset
246 CODEC_TYPE_VIDEO,
986e461dc072 Initial revision
glantau
parents:
diff changeset
247 CODEC_ID_H263,
986e461dc072 Initial revision
glantau
parents:
diff changeset
248 sizeof(MpegEncContext),
986e461dc072 Initial revision
glantau
parents:
diff changeset
249 h263_decode_init,
986e461dc072 Initial revision
glantau
parents:
diff changeset
250 NULL,
986e461dc072 Initial revision
glantau
parents:
diff changeset
251 h263_decode_end,
986e461dc072 Initial revision
glantau
parents:
diff changeset
252 h263_decode_frame,
67
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
253 CODEC_CAP_DRAW_HORIZ_BAND,
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
254 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
255
986e461dc072 Initial revision
glantau
parents:
diff changeset
256 AVCodec msmpeg4_decoder = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
257 "msmpeg4",
986e461dc072 Initial revision
glantau
parents:
diff changeset
258 CODEC_TYPE_VIDEO,
986e461dc072 Initial revision
glantau
parents:
diff changeset
259 CODEC_ID_MSMPEG4,
986e461dc072 Initial revision
glantau
parents:
diff changeset
260 sizeof(MpegEncContext),
986e461dc072 Initial revision
glantau
parents:
diff changeset
261 h263_decode_init,
986e461dc072 Initial revision
glantau
parents:
diff changeset
262 NULL,
986e461dc072 Initial revision
glantau
parents:
diff changeset
263 h263_decode_end,
986e461dc072 Initial revision
glantau
parents:
diff changeset
264 h263_decode_frame,
67
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
265 CODEC_CAP_DRAW_HORIZ_BAND,
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
266 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
267
986e461dc072 Initial revision
glantau
parents:
diff changeset
268 AVCodec h263i_decoder = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
269 "h263i",
986e461dc072 Initial revision
glantau
parents:
diff changeset
270 CODEC_TYPE_VIDEO,
986e461dc072 Initial revision
glantau
parents:
diff changeset
271 CODEC_ID_H263I,
986e461dc072 Initial revision
glantau
parents:
diff changeset
272 sizeof(MpegEncContext),
986e461dc072 Initial revision
glantau
parents:
diff changeset
273 h263_decode_init,
986e461dc072 Initial revision
glantau
parents:
diff changeset
274 NULL,
986e461dc072 Initial revision
glantau
parents:
diff changeset
275 h263_decode_end,
986e461dc072 Initial revision
glantau
parents:
diff changeset
276 h263_decode_frame,
67
cdd89f96cbe1 added draw_horiz_band test
glantau
parents: 60
diff changeset
277 CODEC_CAP_DRAW_HORIZ_BAND,
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
278 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
279