Revision 05adf49c

View differences:

libavcodec/adpcm.c
862 862
#define DK3_GET_NEXT_NIBBLE() \
863 863
    if (decode_top_nibble_next) \
864 864
    { \
865
        nibble = (last_byte >> 4) & 0x0F; \
865
        nibble = last_byte >> 4; \
866 866
        decode_top_nibble_next = 0; \
867 867
    } \
868 868
    else \
......
950 950
        for(m=32; n>0 && m>0; n--, m--) { /* in QuickTime, IMA is encoded by chuncks of 34 bytes (=64 samples) */
951 951
            *samples = adpcm_ima_expand_nibble(cs, src[0] & 0x0F, 3);
952 952
            samples += avctx->channels;
953
            *samples = adpcm_ima_expand_nibble(cs, (src[0] >> 4) & 0x0F, 3);
953
            *samples = adpcm_ima_expand_nibble(cs, src[0] >> 4  , 3);
954 954
            samples += avctx->channels;
955 955
            src ++;
956 956
        }
......
1053 1053
        *samples++ = c->status[0].sample2;
1054 1054
        if (st) *samples++ = c->status[1].sample2;
1055 1055
        for(;n>0;n--) {
1056
            *samples++ = adpcm_ms_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F);
1056
            *samples++ = adpcm_ms_expand_nibble(&c->status[0 ], src[0] >> 4  );
1057 1057
            *samples++ = adpcm_ms_expand_nibble(&c->status[st], src[0] & 0x0F);
1058 1058
            src ++;
1059 1059
        }
......
1076 1076

  
1077 1077
            /* take care of the top nibble (always left or mono channel) */
1078 1078
            *samples++ = adpcm_ima_expand_nibble(&c->status[0],
1079
                (src[0] >> 4) & 0x0F, 3);
1079
                src[0] >> 4, 3);
1080 1080

  
1081 1081
            /* take care of the bottom nibble, which is right sample for
1082 1082
             * stereo, or another mono sample */
......
1141 1141

  
1142 1142
            if (st) {
1143 1143
                *samples++ = adpcm_ima_expand_nibble(&c->status[0],
1144
                    (src[0] >> 4) & 0x0F, 3);
1144
                    src[0] >> 4  , 3);
1145 1145
                *samples++ = adpcm_ima_expand_nibble(&c->status[1],
1146 1146
                    src[0] & 0x0F, 3);
1147 1147
            } else {
1148 1148
                *samples++ = adpcm_ima_expand_nibble(&c->status[0],
1149
                    (src[0] >> 4) & 0x0F, 3);
1149
                    src[0] >> 4  , 3);
1150 1150
                *samples++ = adpcm_ima_expand_nibble(&c->status[0],
1151 1151
                    src[0] & 0x0F, 3);
1152 1152
            }
......
1204 1204
        src += 2;
1205 1205

  
1206 1206
        for (count1 = 0; count1 < samples_in_chunk/28;count1++) {
1207
            coeff1l = ea_adpcm_table[(*src >> 4) & 0x0F];
1208
            coeff2l = ea_adpcm_table[((*src >> 4) & 0x0F) + 4];
1207
            coeff1l = ea_adpcm_table[ *src >> 4       ];
1208
            coeff2l = ea_adpcm_table[(*src >> 4  ) + 4];
1209 1209
            coeff1r = ea_adpcm_table[*src & 0x0F];
1210 1210
            coeff2r = ea_adpcm_table[(*src & 0x0F) + 4];
1211 1211
            src++;
1212 1212

  
1213
            shift_left = ((*src >> 4) & 0x0F) + 8;
1213
            shift_left  = (*src >> 4  ) + 8;
1214 1214
            shift_right = (*src & 0x0F) + 8;
1215 1215
            src++;
1216 1216

  
......
1283 1283
                        samplesC += avctx->channels;
1284 1284
                    }
1285 1285
                } else {
1286
                    coeff1 = ea_adpcm_table[ (*srcC>>4) & 0x0F     ];
1287
                    coeff2 = ea_adpcm_table[((*srcC>>4) & 0x0F) + 4];
1286
                    coeff1 = ea_adpcm_table[ *srcC>>4     ];
1287
                    coeff2 = ea_adpcm_table[(*srcC>>4) + 4];
1288 1288
                    shift = (*srcC++ & 0x0F) + 8;
1289 1289

  
1290 1290
                    for (count2=0; count2<28; count2++) {
......
1357 1357
        while (src < buf + buf_size) {
1358 1358
            char hi, lo;
1359 1359
            lo = *src & 0x0F;
1360
            hi = (*src >> 4) & 0x0F;
1360
            hi = *src >> 4;
1361 1361

  
1362 1362
            if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV)
1363 1363
                FFSWAP(char, hi, lo);
......
1373 1373
        while (src < buf + buf_size) {
1374 1374
            if (st) {
1375 1375
                *samples++ = adpcm_ct_expand_nibble(&c->status[0],
1376
                    (src[0] >> 4) & 0x0F);
1376
                    src[0] >> 4);
1377 1377
                *samples++ = adpcm_ct_expand_nibble(&c->status[1],
1378 1378
                    src[0] & 0x0F);
1379 1379
            } else {
1380 1380
                *samples++ = adpcm_ct_expand_nibble(&c->status[0],
1381
                    (src[0] >> 4) & 0x0F);
1381
                    src[0] >> 4);
1382 1382
                *samples++ = adpcm_ct_expand_nibble(&c->status[0],
1383 1383
                    src[0] & 0x0F);
1384 1384
            }
......
1398 1398
        if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_4) {
1399 1399
            while (src < buf + buf_size) {
1400 1400
                *samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
1401
                    (src[0] >> 4) & 0x0F, 4, 0);
1401
                    src[0] >> 4, 4, 0);
1402 1402
                *samples++ = adpcm_sbpro_expand_nibble(&c->status[st],
1403 1403
                    src[0] & 0x0F, 4, 0);
1404 1404
                src++;
......
1406 1406
        } else if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_3) {
1407 1407
            while (src < buf + buf_size && samples + 2 < samples_end) {
1408 1408
                *samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
1409
                    (src[0] >> 5) & 0x07, 3, 0);
1409
                     src[0] >> 5        , 3, 0);
1410 1410
                *samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
1411 1411
                    (src[0] >> 2) & 0x07, 3, 0);
1412 1412
                *samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
......
1416 1416
        } else {
1417 1417
            while (src < buf + buf_size && samples + 3 < samples_end) {
1418 1418
                *samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
1419
                    (src[0] >> 6) & 0x03, 2, 2);
1419
                     src[0] >> 6        , 2, 2);
1420 1420
                *samples++ = adpcm_sbpro_expand_nibble(&c->status[st],
1421 1421
                    (src[0] >> 4) & 0x03, 2, 2);
1422 1422
                *samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
......
1494 1494
                *samples++ = adpcm_yamaha_expand_nibble(&c->status[0],
1495 1495
                        src[0] & 0x0F);
1496 1496
                *samples++ = adpcm_yamaha_expand_nibble(&c->status[1],
1497
                        (src[0] >> 4) & 0x0F);
1497
                        src[0] >> 4  );
1498 1498
            } else {
1499 1499
                *samples++ = adpcm_yamaha_expand_nibble(&c->status[0],
1500 1500
                        src[0] & 0x0F);
1501 1501
                *samples++ = adpcm_yamaha_expand_nibble(&c->status[0],
1502
                        (src[0] >> 4) & 0x0F);
1502
                        src[0] >> 4  );
1503 1503
            }
1504 1504
            src++;
1505 1505
        }

Also available in: Unified diff