Revision 7da4dc17

View differences:

libavcodec/ac3enc.c
975 975
       offset until we can pack everything in the requested frame size */
976 976

  
977 977
    bits_left = 8 * s->frame_size - (s->frame_bits + s->exponent_bits);
978

  
978 979
    snr_offset = s->coarse_snr_offset << 4;
980

  
979 981
    while (snr_offset >= 0 &&
980
           bit_alloc(s, mask, psd, bap, snr_offset) > bits_left)
982
           bit_alloc(s, mask, psd, bap, snr_offset) > bits_left) {
981 983
        snr_offset -= 64;
984
    }
982 985
    if (snr_offset < 0) {
983 986
        return AVERROR(EINVAL);
984 987
    }
988

  
985 989
    while (snr_offset + 64 <= 1023 &&
986
           bit_alloc(s, mask, psd, bap1,
987
                     snr_offset + 64) <= bits_left) {
990
           bit_alloc(s, mask, psd, bap1, snr_offset + 64) <= bits_left) {
988 991
        snr_offset += 64;
989 992
        memcpy(bap, bap1, sizeof(bap1));
990 993
    }
......
994 997
        memcpy(bap, bap1, sizeof(bap1));
995 998
    }
996 999
    while (snr_offset + 4 <= 1023 &&
997
           bit_alloc(s, mask, psd, bap1,
998
                     snr_offset + 4) <= bits_left) {
1000
           bit_alloc(s, mask, psd, bap1, snr_offset + 4) <= bits_left) {
999 1001
        snr_offset += 4;
1000 1002
        memcpy(bap, bap1, sizeof(bap1));
1001 1003
    }
1002 1004
    while (snr_offset + 1 <= 1023 &&
1003
           bit_alloc(s, mask, psd, bap1,
1004
                     snr_offset + 1) <= bits_left) {
1005
           bit_alloc(s, mask, psd, bap1, snr_offset + 1) <= bits_left) {
1005 1006
        snr_offset++;
1006 1007
        memcpy(bap, bap1, sizeof(bap1));
1007 1008
    }

Also available in: Unified diff