* The simplest AC-3 encoder.
*/
//#define DEBUG
-//#define DEBUG_BITALLOC
+
#include "libavcore/audioconvert.h"
#include "libavutil/crc.h"
#include "avcodec.h"
exp_strategy[0][ch] = EXP_NEW;
for(i=1;i<AC3_MAX_BLOCKS;i++) {
exp_diff = calc_exp_diff(exp[i][ch], exp[i-1][ch], AC3_MAX_COEFS);
- dprintf(NULL, "exp_diff=%d\n", exp_diff);
if (exp_diff > EXP_DIFF_THRESHOLD)
exp_strategy[i][ch] = EXP_NEW;
else
k += group_size;
}
-#if defined(DEBUG)
- av_log(NULL, AV_LOG_DEBUG, "exponents: strategy=%d\n", exp_strategy);
- for(i=0;i<=nb_groups * group_size;i++) {
- av_log(NULL, AV_LOG_DEBUG, "%d ", encoded_exp[i]);
- }
- av_log(NULL, AV_LOG_DEBUG, "\n");
-#endif
-
return 4 + (nb_groups / 3) * 7;
}
s->nb_coefs[ch]);
}
}
-#if 0
- printf("csnr=%d fsnr=%d frame_bits=%d diff=%d\n",
- coarse_snr_offset, fine_snr_offset, frame_bits,
- 16 * s->frame_size - ((frame_bits + 7) & ~7));
-#endif
return 16 * s->frame_size - frame_bits;
}
s->coarse_snr_offset = coarse_snr_offset;
for(ch=0;ch<s->channels;ch++)
s->fine_snr_offset[ch] = fine_snr_offset;
-#if defined(DEBUG_BITALLOC)
- {
- int j;
-
- for(i=0;i<6;i++) {
- for(ch=0;ch<s->channels;ch++) {
- printf("Block #%d Ch%d:\n", i, ch);
- printf("bap=");
- for(j=0;j<s->nb_coefs[ch];j++) {
- printf("%d ",bap[i][ch][j]);
- }
- printf("\n");
- }
- }
- }
-#endif
+
return 0;
}
}
}
-#if defined(DEBUG)
- {
- static int count = 0;
- av_log(NULL, AV_LOG_DEBUG, "Block #%d (%d)\n", block_num, count++);
- }
-#endif
/* exponent strategy */
for(ch=0;ch<s->fbw_channels;ch++) {
put_bits(&s->pb, 2, exp_strategy[ch]);