comparison mpeg12.c @ 9604:b8357dc014b0 libavcodec

Extract colorspace fields from MPEG1/2.
author michael
date Tue, 05 May 2009 19:53:49 +0000
parents b0e7d5ced43b
children bd3e11b60ccd
comparison
equal deleted inserted replaced
9603:875cd15dfd74 9604:b8357dc014b0
1186 1186
1187 s->mpeg_enc_ctx_allocated = 0; 1187 s->mpeg_enc_ctx_allocated = 0;
1188 s->mpeg_enc_ctx.picture_number = 0; 1188 s->mpeg_enc_ctx.picture_number = 0;
1189 s->repeat_field = 0; 1189 s->repeat_field = 0;
1190 s->mpeg_enc_ctx.codec_id= avctx->codec->id; 1190 s->mpeg_enc_ctx.codec_id= avctx->codec->id;
1191 avctx->color_range= AVCOL_RANGE_MPEG;
1191 return 0; 1192 return 0;
1192 } 1193 }
1193 1194
1194 static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm, 1195 static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm,
1195 const uint8_t *new_perm){ 1196 const uint8_t *new_perm){
1418 int color_description, w, h; 1419 int color_description, w, h;
1419 1420
1420 skip_bits(&s->gb, 3); /* video format */ 1421 skip_bits(&s->gb, 3); /* video format */
1421 color_description= get_bits1(&s->gb); 1422 color_description= get_bits1(&s->gb);
1422 if(color_description){ 1423 if(color_description){
1423 skip_bits(&s->gb, 8); /* color primaries */ 1424 s->avctx->color_primaries= get_bits(&s->gb, 8);
1424 skip_bits(&s->gb, 8); /* transfer_characteristics */ 1425 s->avctx->color_trc = get_bits(&s->gb, 8);
1425 skip_bits(&s->gb, 8); /* matrix_coefficients */ 1426 s->avctx->colorspace = get_bits(&s->gb, 8);
1426 } 1427 }
1427 w= get_bits(&s->gb, 14); 1428 w= get_bits(&s->gb, 14);
1428 skip_bits(&s->gb, 1); //marker 1429 skip_bits(&s->gb, 1); //marker
1429 h= get_bits(&s->gb, 14); 1430 h= get_bits(&s->gb, 14);
1430 skip_bits(&s->gb, 1); //marker 1431 skip_bits(&s->gb, 1); //marker