Mercurial > libavcodec.hg
comparison vp3.c @ 11128:b6a0e8a27941 libavcodec
Export Theora colorspace info if present
author | conrad |
---|---|
date | Fri, 12 Feb 2010 22:01:22 +0000 |
parents | 2f7baf2042a3 |
children | 0bca1b2ac58d |
comparison
equal
deleted
inserted
replaced
11127:2f7baf2042a3 | 11128:b6a0e8a27941 |
---|---|
2107 | 2107 |
2108 #if CONFIG_THEORA_DECODER | 2108 #if CONFIG_THEORA_DECODER |
2109 static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb) | 2109 static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb) |
2110 { | 2110 { |
2111 Vp3DecodeContext *s = avctx->priv_data; | 2111 Vp3DecodeContext *s = avctx->priv_data; |
2112 int visible_width, visible_height; | 2112 int visible_width, visible_height, colorspace; |
2113 | 2113 |
2114 s->theora = get_bits_long(gb, 24); | 2114 s->theora = get_bits_long(gb, 24); |
2115 av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora); | 2115 av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora); |
2116 | 2116 |
2117 /* 3.2.0 aka alpha3 has the same frame orientation as original vp3 */ | 2117 /* 3.2.0 aka alpha3 has the same frame orientation as original vp3 */ |
2144 skip_bits(gb, 24); /* aspect numerator */ | 2144 skip_bits(gb, 24); /* aspect numerator */ |
2145 skip_bits(gb, 24); /* aspect denumerator */ | 2145 skip_bits(gb, 24); /* aspect denumerator */ |
2146 | 2146 |
2147 if (s->theora < 0x030200) | 2147 if (s->theora < 0x030200) |
2148 skip_bits(gb, 5); /* keyframe frequency force */ | 2148 skip_bits(gb, 5); /* keyframe frequency force */ |
2149 skip_bits(gb, 8); /* colorspace */ | 2149 colorspace = get_bits(gb, 8); |
2150 skip_bits(gb, 24); /* bitrate */ | 2150 skip_bits(gb, 24); /* bitrate */ |
2151 | 2151 |
2152 skip_bits(gb, 6); /* quality hint */ | 2152 skip_bits(gb, 6); /* quality hint */ |
2153 | 2153 |
2154 if (s->theora >= 0x030200) | 2154 if (s->theora >= 0x030200) |
2163 if ( visible_width <= s->width && visible_width > s->width-16 | 2163 if ( visible_width <= s->width && visible_width > s->width-16 |
2164 && visible_height <= s->height && visible_height > s->height-16) | 2164 && visible_height <= s->height && visible_height > s->height-16) |
2165 avcodec_set_dimensions(avctx, visible_width, visible_height); | 2165 avcodec_set_dimensions(avctx, visible_width, visible_height); |
2166 else | 2166 else |
2167 avcodec_set_dimensions(avctx, s->width, s->height); | 2167 avcodec_set_dimensions(avctx, s->width, s->height); |
2168 | |
2169 if (colorspace == 1) { | |
2170 avctx->color_primaries = AVCOL_PRI_BT470M; | |
2171 } else if (colorspace == 2) { | |
2172 avctx->color_primaries = AVCOL_PRI_BT470BG; | |
2173 } | |
2174 if (colorspace == 1 || colorspace == 2) { | |
2175 avctx->colorspace = AVCOL_SPC_BT470BG; | |
2176 avctx->color_trc = AVCOL_TRC_BT709; | |
2177 } | |
2168 | 2178 |
2169 return 0; | 2179 return 0; |
2170 } | 2180 } |
2171 | 2181 |
2172 static int theora_decode_tables(AVCodecContext *avctx, GetBitContext *gb) | 2182 static int theora_decode_tables(AVCodecContext *avctx, GetBitContext *gb) |