Revision 22c0b03c

View differences:

libavcodec/ac3enc.c
24 24
 * The simplest AC-3 encoder.
25 25
 */
26 26
//#define DEBUG
27
//#define DEBUG_BITALLOC
27

  
28 28
#include "libavcore/audioconvert.h"
29 29
#include "libavutil/crc.h"
30 30
#include "avcodec.h"
......
256 256
    exp_strategy[0][ch] = EXP_NEW;
257 257
    for(i=1;i<AC3_MAX_BLOCKS;i++) {
258 258
        exp_diff = calc_exp_diff(exp[i][ch], exp[i-1][ch], AC3_MAX_COEFS);
259
        dprintf(NULL, "exp_diff=%d\n", exp_diff);
260 259
        if (exp_diff > EXP_DIFF_THRESHOLD)
261 260
            exp_strategy[i][ch] = EXP_NEW;
262 261
        else
......
358 357
        k += group_size;
359 358
    }
360 359

  
361
#if defined(DEBUG)
362
    av_log(NULL, AV_LOG_DEBUG, "exponents: strategy=%d\n", exp_strategy);
363
    for(i=0;i<=nb_groups * group_size;i++) {
364
        av_log(NULL, AV_LOG_DEBUG, "%d ", encoded_exp[i]);
365
    }
366
    av_log(NULL, AV_LOG_DEBUG, "\n");
367
#endif
368

  
369 360
    return 4 + (nb_groups / 3) * 7;
370 361
}
371 362

  
......
474 465
                                                 s->nb_coefs[ch]);
475 466
        }
476 467
    }
477
#if 0
478
    printf("csnr=%d fsnr=%d frame_bits=%d diff=%d\n",
479
           coarse_snr_offset, fine_snr_offset, frame_bits,
480
           16 * s->frame_size - ((frame_bits + 7) & ~7));
481
#endif
482 468
    return 16 * s->frame_size - frame_bits;
483 469
}
484 470

  
......
593 579
    s->coarse_snr_offset = coarse_snr_offset;
594 580
    for(ch=0;ch<s->channels;ch++)
595 581
        s->fine_snr_offset[ch] = fine_snr_offset;
596
#if defined(DEBUG_BITALLOC)
597
    {
598
        int j;
599

  
600
        for(i=0;i<6;i++) {
601
            for(ch=0;ch<s->channels;ch++) {
602
                printf("Block #%d Ch%d:\n", i, ch);
603
                printf("bap=");
604
                for(j=0;j<s->nb_coefs[ch];j++) {
605
                    printf("%d ",bap[i][ch][j]);
606
                }
607
                printf("\n");
608
            }
609
        }
610
    }
611
#endif
582

  
612 583
    return 0;
613 584
}
614 585

  
......
861 832
          }
862 833
      }
863 834

  
864
#if defined(DEBUG)
865
    {
866
      static int count = 0;
867
      av_log(NULL, AV_LOG_DEBUG, "Block #%d (%d)\n", block_num, count++);
868
    }
869
#endif
870 835
    /* exponent strategy */
871 836
    for(ch=0;ch<s->fbw_channels;ch++) {
872 837
        put_bits(&s->pb, 2, exp_strategy[ch]);

Also available in: Unified diff