[FFmpeg-soc] [soc]: r3393 - aacenc/aacenc.c
kostya
subversion at mplayerhq.hu
Sun Aug 17 11:30:47 CEST 2008
Author: kostya
Date: Sun Aug 17 11:30:47 2008
New Revision: 3393
Log:
Change band info run algorithm so it needs one loop less
Modified:
aacenc/aacenc.c
Modified: aacenc/aacenc.c
==============================================================================
--- aacenc/aacenc.c (original)
+++ aacenc/aacenc.c Sun Aug 17 11:30:47 2008
@@ -422,8 +422,8 @@ static void encode_window_bands_info(AAC
BandCodingPath path[64];
int band_bits[64][12];
int maxval;
- int w, swb, cb, ccb, start, start2, size;
- int i, j, k;
+ int w, swb, cb, start, start2, size;
+ int i, j;
const int max_sfb = cpe->ch[channel].ics.max_sfb;
const int run_bits = cpe->ch[channel].ics.num_windows == 1 ? 5 : 3;
const int run_esc = (1 << run_bits) - 1;
@@ -457,32 +457,22 @@ static void encode_window_bands_info(AAC
for(i = 1; i <= max_sfb; i++)
path[i].bits = INT_MAX;
for(i = 0; i < max_sfb; i++){
- for(j = 1; j <= max_sfb - i; j++){
- bits = INT_MAX;
- ccb = 0;
- for(cb = 0; cb < 12; cb++){
- int sum = 0;
- for(k = 0; k < j; k++){
- if(band_bits[i + k][cb] == INT_MAX){
- sum = INT_MAX;
- break;
- }
- sum += band_bits[i + k][cb];
- }
- if(sum < bits){
- bits = sum;
- ccb = cb;
+ for(cb = 0; cb < 12; cb++){
+ int sum = 0;
+ for(j = 1; j <= max_sfb - i; j++){
+ if(band_bits[i+j-1][cb] == INT_MAX)
+ break;
+ sum += band_bits[i+j-1][cb];
+ bits = sum + path[i].bits + run_value_bits[cpe->ch[channel].ics.num_windows == 8][j];
+ if(bits < path[i+j].bits){
+ path[i+j].bits = bits;
+ path[i+j].codebook = cb;
+ path[i+j].prev_idx = i;
}
}
- assert(bits != INT_MAX);
- bits += path[i].bits + run_value_bits[cpe->ch[channel].ics.num_windows == 8][j];
- if(bits < path[i+j].bits){
- path[i+j].bits = bits;
- path[i+j].codebook = ccb;
- path[i+j].prev_idx = i;
- }
}
}
+ assert(path[max_sfb].bits != INT_MAX);
//convert resulting path from backward-linked list
stack_len = 0;
More information about the FFmpeg-soc
mailing list