Mercurial > libavcodec.hg
comparison mpeg12.c @ 1376:5d2435fb733d libavcodec
ATI VCR2 decoding support
author | michaelni |
---|---|
date | Thu, 24 Jul 2003 23:32:12 +0000 |
parents | b52e62d17bbb |
children | 326852ff8fee |
comparison
equal
deleted
inserted
replaced
1375:c93d893f6d2b | 1376:5d2435fb733d |
---|---|
926 | 926 |
927 switch(s->pict_type) { | 927 switch(s->pict_type) { |
928 default: | 928 default: |
929 case I_TYPE: | 929 case I_TYPE: |
930 if (get_bits1(&s->gb) == 0) { | 930 if (get_bits1(&s->gb) == 0) { |
931 if (get_bits1(&s->gb) == 0) | 931 if (get_bits1(&s->gb) == 0){ |
932 fprintf("invalid mb type in I Frame at %d %d\n", s->mb_x, s->mb_y); | |
932 return -1; | 933 return -1; |
934 } | |
933 mb_type = MB_TYPE_QUANT | MB_TYPE_INTRA; | 935 mb_type = MB_TYPE_QUANT | MB_TYPE_INTRA; |
934 } else { | 936 } else { |
935 mb_type = MB_TYPE_INTRA; | 937 mb_type = MB_TYPE_INTRA; |
936 } | 938 } |
937 break; | 939 break; |
2146 s->mpeg2 = 0; | 2148 s->mpeg2 = 0; |
2147 avctx->sub_id = 1; /* indicates mpeg1 */ | 2149 avctx->sub_id = 1; /* indicates mpeg1 */ |
2148 return 0; | 2150 return 0; |
2149 } | 2151 } |
2150 | 2152 |
2153 static int vcr2_init_sequence(AVCodecContext *avctx) | |
2154 { | |
2155 Mpeg1Context *s1 = avctx->priv_data; | |
2156 MpegEncContext *s = &s1->mpeg_enc_ctx; | |
2157 int i, v, j; | |
2158 float aspect; | |
2159 | |
2160 /* start new mpeg1 context decoding */ | |
2161 s->out_format = FMT_MPEG1; | |
2162 if (s1->mpeg_enc_ctx_allocated) { | |
2163 MPV_common_end(s); | |
2164 } | |
2165 s->width = avctx->width; | |
2166 s->height = avctx->height; | |
2167 avctx->has_b_frames= 0; //true? | |
2168 s->avctx = avctx; | |
2169 | |
2170 if (MPV_common_init(s) < 0) | |
2171 return -1; | |
2172 s1->mpeg_enc_ctx_allocated = 1; | |
2173 | |
2174 for(i=0;i<64;i++) { | |
2175 int j= s->dsp.idct_permutation[i]; | |
2176 v = ff_mpeg1_default_intra_matrix[i]; | |
2177 s->intra_matrix[j] = v; | |
2178 s->chroma_intra_matrix[j] = v; | |
2179 | |
2180 v = ff_mpeg1_default_non_intra_matrix[i]; | |
2181 s->inter_matrix[j] = v; | |
2182 s->chroma_inter_matrix[j] = v; | |
2183 } | |
2184 | |
2185 /* we set mpeg2 parameters so that it emulates mpeg1 */ | |
2186 s->progressive_sequence = 1; | |
2187 s->progressive_frame = 1; | |
2188 s->picture_structure = PICT_FRAME; | |
2189 s->frame_pred_frame_dct = 1; | |
2190 s->mpeg2 = 1; | |
2191 avctx->sub_id = 2; /* indicates mpeg1 */ | |
2192 return 0; | |
2193 } | |
2194 | |
2195 | |
2151 static void mpeg_decode_user_data(AVCodecContext *avctx, | 2196 static void mpeg_decode_user_data(AVCodecContext *avctx, |
2152 const uint8_t *buf, int buf_size) | 2197 const uint8_t *buf, int buf_size) |
2153 { | 2198 { |
2154 const uint8_t *p; | 2199 const uint8_t *p; |
2155 int len, flags; | 2200 int len, flags; |
2258 *data_size = sizeof(AVPicture); | 2303 *data_size = sizeof(AVPicture); |
2259 goto the_end; | 2304 goto the_end; |
2260 } | 2305 } |
2261 } | 2306 } |
2262 #endif | 2307 #endif |
2308 | |
2309 if(s->mpeg_enc_ctx_allocated==0 && avctx->codec_tag == ff_get_fourcc("VCR2")) | |
2310 vcr2_init_sequence(avctx); | |
2311 | |
2263 for(;;) { | 2312 for(;;) { |
2264 /* find start next code */ | 2313 /* find start next code */ |
2265 start_code = find_start_code(&buf_ptr, buf_end); | 2314 start_code = find_start_code(&buf_ptr, buf_end); |
2266 if (start_code < 0){ | 2315 if (start_code < 0){ |
2267 if (slice_end(avctx, picture)) { | 2316 if (slice_end(avctx, picture)) { |