Revision ba7ee4a4 libavcodec/vp3.c

View differences:

libavcodec/vp3.c
2641 2641
	skip_bits(&gb, 1);
2642 2642
    s->last_quality_index = s->quality_index;
2643 2643
    s->quality_index = get_bits(&gb, 6);
2644
    if (s->theora >= 0x030300)
2644
    if (s->theora >= 0x030200)
2645 2645
        skip_bits1(&gb);
2646 2646

  
2647 2647
    if (s->avctx->debug & FF_DEBUG_PICT_INFO)
......
2810 2810
    /* FIXME: endianess? */
2811 2811
    s->theora = (major << 16) | (minor << 8) | micro;
2812 2812

  
2813
    /* 3.3.0 aka alpha3 has the same frame orientation as original vp3 */
2813
    /* 3.2.0 aka alpha3 has the same frame orientation as original vp3 */
2814 2814
    /* but previous versions have the image flipped relative to vp3 */
2815
    if (s->theora < 0x030300)
2815
    if (s->theora < 0x030200)
2816 2816
    {
2817 2817
	s->flipped_image = 1;
2818 2818
        av_log(avctx, AV_LOG_DEBUG, "Old (<alpha3) Theora bitstream, flipped image\n");
......
2837 2837
    skip_bits(&gb, 24); /* aspect numerator */
2838 2838
    skip_bits(&gb, 24); /* aspect denumerator */
2839 2839
    
2840
    if (s->theora < 0x030300)
2840
    if (s->theora < 0x030200)
2841 2841
	skip_bits(&gb, 5); /* keyframe frequency force */
2842 2842
    skip_bits(&gb, 8); /* colorspace */
2843 2843
    skip_bits(&gb, 24); /* bitrate */
2844 2844

  
2845 2845
    skip_bits(&gb, 6); /* last(?) quality index */
2846 2846
    
2847
    if (s->theora >= 0x030300)
2847
    if (s->theora >= 0x030200)
2848 2848
    {
2849 2849
	skip_bits(&gb, 5); /* keyframe frequency force */
2850 2850
	skip_bits(&gb, 5); /* spare bits */
......
2855 2855
    avctx->width = s->width;
2856 2856
    avctx->height = s->height;
2857 2857

  
2858
    vp3_decode_init(avctx);
2859

  
2860 2858
    return 0;
2861 2859
}
2862 2860

  
......
2885 2883
static int theora_decode_tables(AVCodecContext *avctx, GetBitContext gb)
2886 2884
{
2887 2885
    Vp3DecodeContext *s = avctx->priv_data;
2888
    int i;
2886
    int i, n;
2887

  
2888
    if (s->theora >= 0x030200) {
2889
        n = get_bits(&gb, 3);
2890
        /* loop filter table */
2891
        for (i = 0; i < 64; i++)
2892
            skip_bits(&gb, n);
2893
    }
2889 2894
    
2895
    if (s->theora >= 0x030200)
2896
        n = get_bits(&gb, 4) + 1;
2897
    else
2898
        n = 16;
2890 2899
    /* quality threshold table */
2891 2900
    for (i = 0; i < 64; i++)
2892
	s->coded_ac_scale_factor[i] = get_bits(&gb, 16);
2901
	s->coded_ac_scale_factor[i] = get_bits(&gb, n);
2893 2902

  
2903
    if (s->theora >= 0x030200)
2904
        n = get_bits(&gb, 4) + 1;
2905
    else
2906
        n = 16;
2894 2907
    /* dc scale factor table */
2895 2908
    for (i = 0; i < 64; i++)
2896
	s->coded_dc_scale_factor[i] = get_bits(&gb, 16);
2909
	s->coded_dc_scale_factor[i] = get_bits(&gb, n);
2897 2910

  
2911
    if (s->theora >= 0x030200)
2912
        n = get_bits(&gb, 9) + 1;
2913
    else
2914
        n = 3;
2915
    if (n != 3) {
2916
        av_log(NULL,AV_LOG_ERROR, "unsupported nbms : %d\n", n);
2917
        return -1;
2918
    }
2898 2919
    /* y coeffs */
2899 2920
    for (i = 0; i < 64; i++)
2900 2921
	s->coded_intra_y_dequant[i] = get_bits(&gb, 8);
......
2946 2967
    {
2947 2968
        case 0x80:
2948 2969
            theora_decode_header(avctx, gb);
2949
	    vp3_decode_init(avctx);
2950 2970
    	    break;
2951 2971
	case 0x81:
2952 2972
	    theora_decode_comments(avctx, gb);
......
2957 2977
    }
2958 2978
  }
2959 2979

  
2980
    vp3_decode_init(avctx);
2960 2981
    return 0;
2961 2982
}
2962 2983

  

Also available in: Unified diff