comparison vp3.c @ 11638:fb475c791336 libavcodec

vp3: Don't crop if there's a left/top offset, it's wrong Fixes issue1834
author conrad
date Sat, 17 Apr 2010 02:04:35 +0000
parents f7281af560fe
children 5698bf13b8e1
comparison
equal deleted inserted replaced
11637:f7281af560fe 11638:fb475c791336
1950 1950
1951 static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb) 1951 static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
1952 { 1952 {
1953 Vp3DecodeContext *s = avctx->priv_data; 1953 Vp3DecodeContext *s = avctx->priv_data;
1954 int visible_width, visible_height, colorspace; 1954 int visible_width, visible_height, colorspace;
1955 int offset_x = 0, offset_y = 0;
1955 1956
1956 s->theora = get_bits_long(gb, 24); 1957 s->theora = get_bits_long(gb, 24);
1957 av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora); 1958 av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora);
1958 1959
1959 /* 3.2.0 aka alpha3 has the same frame orientation as original vp3 */ 1960 /* 3.2.0 aka alpha3 has the same frame orientation as original vp3 */
1975 1976
1976 if (s->theora >= 0x030200) { 1977 if (s->theora >= 0x030200) {
1977 visible_width = get_bits_long(gb, 24); 1978 visible_width = get_bits_long(gb, 24);
1978 visible_height = get_bits_long(gb, 24); 1979 visible_height = get_bits_long(gb, 24);
1979 1980
1980 skip_bits(gb, 8); /* offset x */ 1981 offset_x = get_bits(gb, 8); /* offset x */
1981 skip_bits(gb, 8); /* offset y */ 1982 offset_y = get_bits(gb, 8); /* offset y, from bottom */
1982 } 1983 }
1983 1984
1984 skip_bits(gb, 32); /* fps numerator */ 1985 skip_bits(gb, 32); /* fps numerator */
1985 skip_bits(gb, 32); /* fps denumerator */ 1986 skip_bits(gb, 32); /* fps denumerator */
1986 skip_bits(gb, 24); /* aspect numerator */ 1987 skip_bits(gb, 24); /* aspect numerator */
2001 } 2002 }
2002 2003
2003 // align_get_bits(gb); 2004 // align_get_bits(gb);
2004 2005
2005 if ( visible_width <= s->width && visible_width > s->width-16 2006 if ( visible_width <= s->width && visible_width > s->width-16
2006 && visible_height <= s->height && visible_height > s->height-16) 2007 && visible_height <= s->height && visible_height > s->height-16
2008 && !offset_x && (offset_y == s->height - visible_height))
2007 avcodec_set_dimensions(avctx, visible_width, visible_height); 2009 avcodec_set_dimensions(avctx, visible_width, visible_height);
2008 else 2010 else
2009 avcodec_set_dimensions(avctx, s->width, s->height); 2011 avcodec_set_dimensions(avctx, s->width, s->height);
2010 2012
2011 if (colorspace == 1) { 2013 if (colorspace == 1) {