Revision aa170ed6 libavcodec/wavpack.c

View differences:

libavcodec/wavpack.c
469 469
    float   *dstfl = dst;
470 470

  
471 471
    if(s->samples_left == s->samples)
472
    s->one = s->zero = s->zeroes = 0;
472
        s->one = s->zero = s->zeroes = 0;
473 473
    do{
474 474
        L = wv_get_value(s, gb, 0, &last);
475 475
        if(last) break;
......
561 561

  
562 562
    s->samples_left -= count;
563 563
    if(!s->samples_left){
564
    if(crc != s->CRC){
565
        av_log(s->avctx, AV_LOG_ERROR, "CRC error\n");
566
        return -1;
567
    }
568
    if(s->got_extra_bits && crc_extra_bits != s->crc_extra_bits){
569
        av_log(s->avctx, AV_LOG_ERROR, "Extra bits CRC error\n");
570
        return -1;
571
    }
572
    wv_reset_saved_context(s);
564
        if(crc != s->CRC){
565
            av_log(s->avctx, AV_LOG_ERROR, "CRC error\n");
566
            return -1;
567
        }
568
        if(s->got_extra_bits && crc_extra_bits != s->crc_extra_bits){
569
            av_log(s->avctx, AV_LOG_ERROR, "Extra bits CRC error\n");
570
            return -1;
571
        }
572
        wv_reset_saved_context(s);
573 573
    }else{
574 574
        s->pos = pos;
575 575
        s->sc.crc = crc;
......
595 595
    float   *dstfl = dst;
596 596

  
597 597
    if(s->samples_left == s->samples)
598
    s->one = s->zero = s->zeroes = 0;
598
        s->one = s->zero = s->zeroes = 0;
599 599
    do{
600 600
        T = wv_get_value(s, gb, 0, &last);
601 601
        S = 0;
......
634 634

  
635 635
    s->samples_left -= count;
636 636
    if(!s->samples_left){
637
    if(crc != s->CRC){
638
        av_log(s->avctx, AV_LOG_ERROR, "CRC error\n");
639
        return -1;
640
    }
641
    if(s->got_extra_bits && crc_extra_bits != s->crc_extra_bits){
642
        av_log(s->avctx, AV_LOG_ERROR, "Extra bits CRC error\n");
643
        return -1;
644
    }
645
    wv_reset_saved_context(s);
637
        if(crc != s->CRC){
638
            av_log(s->avctx, AV_LOG_ERROR, "CRC error\n");
639
            return -1;
640
        }
641
        if(s->got_extra_bits && crc_extra_bits != s->crc_extra_bits){
642
            av_log(s->avctx, AV_LOG_ERROR, "Extra bits CRC error\n");
643
            return -1;
644
        }
645
        wv_reset_saved_context(s);
646 646
    }else{
647 647
        s->pos = pos;
648 648
        s->sc.crc = crc;
......
693 693
    }
694 694

  
695 695
    if(!s->samples_left){
696
    memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr));
697
    memset(s->ch, 0, sizeof(s->ch));
698
    s->extra_bits = 0;
699
    s->and = s->or = s->shift = 0;
700
    s->got_extra_bits = 0;
696
        memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr));
697
        memset(s->ch, 0, sizeof(s->ch));
698
        s->extra_bits = 0;
699
        s->and = s->or = s->shift = 0;
700
        s->got_extra_bits = 0;
701 701
    }
702 702

  
703 703
    s->samples = AV_RL32(buf); buf += 4;
......
921 921
        if(id & WP_IDF_ODD) buf++;
922 922
    }
923 923
    if(!s->samples_left){
924
    if(!got_terms){
925
        av_log(avctx, AV_LOG_ERROR, "No block with decorrelation terms\n");
926
        return -1;
927
    }
928
    if(!got_weights){
929
        av_log(avctx, AV_LOG_ERROR, "No block with decorrelation weights\n");
930
        return -1;
931
    }
932
    if(!got_samples){
933
        av_log(avctx, AV_LOG_ERROR, "No block with decorrelation samples\n");
934
        return -1;
935
    }
936
    if(!got_entropy){
937
        av_log(avctx, AV_LOG_ERROR, "No block with entropy info\n");
938
        return -1;
939
    }
940
    if(s->hybrid && !got_hybrid){
941
        av_log(avctx, AV_LOG_ERROR, "Hybrid config not found\n");
942
        return -1;
943
    }
944
    if(!got_bs){
945
        av_log(avctx, AV_LOG_ERROR, "Packed samples not found\n");
946
        return -1;
947
    }
948
    if(!got_float && avctx->sample_fmt == SAMPLE_FMT_FLT){
949
        av_log(avctx, AV_LOG_ERROR, "Float information not found\n");
950
        return -1;
951
    }
952
    if(s->got_extra_bits && avctx->sample_fmt != SAMPLE_FMT_FLT){
953
        const int size = get_bits_left(&s->gb_extra_bits);
954
        const int wanted = s->samples * s->extra_bits << s->stereo_in;
955
        if(size < wanted){
956
            av_log(avctx, AV_LOG_ERROR, "Too small EXTRABITS\n");
957
            s->got_extra_bits = 0;
924
        if(!got_terms){
925
            av_log(avctx, AV_LOG_ERROR, "No block with decorrelation terms\n");
926
            return -1;
958 927
        }
959
    }
960
    s->samples_left = s->samples;
928
        if(!got_weights){
929
            av_log(avctx, AV_LOG_ERROR, "No block with decorrelation weights\n");
930
            return -1;
931
        }
932
        if(!got_samples){
933
            av_log(avctx, AV_LOG_ERROR, "No block with decorrelation samples\n");
934
            return -1;
935
        }
936
        if(!got_entropy){
937
            av_log(avctx, AV_LOG_ERROR, "No block with entropy info\n");
938
            return -1;
939
        }
940
        if(s->hybrid && !got_hybrid){
941
            av_log(avctx, AV_LOG_ERROR, "Hybrid config not found\n");
942
            return -1;
943
        }
944
        if(!got_bs){
945
            av_log(avctx, AV_LOG_ERROR, "Packed samples not found\n");
946
            return -1;
947
        }
948
        if(!got_float && avctx->sample_fmt == SAMPLE_FMT_FLT){
949
            av_log(avctx, AV_LOG_ERROR, "Float information not found\n");
950
            return -1;
951
        }
952
        if(s->got_extra_bits && avctx->sample_fmt != SAMPLE_FMT_FLT){
953
            const int size = get_bits_left(&s->gb_extra_bits);
954
            const int wanted = s->samples * s->extra_bits << s->stereo_in;
955
            if(size < wanted){
956
                av_log(avctx, AV_LOG_ERROR, "Too small EXTRABITS\n");
957
                s->got_extra_bits = 0;
958
            }
959
        }
960
        s->samples_left = s->samples;
961 961
    }else{
962 962
        init_get_bits(&s->gb, avpkt->data + s->sc.offset, s->sc.size);
963 963
        skip_bits_long(&s->gb, s->sc.bits_used);

Also available in: Unified diff