Originally committed as revision 4855 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diego Biurrun authored on 2006/01/15 00:00:10... | ... |
@@ -25,8 +25,8 @@ |
25 | 25 |
* @file qdm2.c |
26 | 26 |
* QDM2 decoder |
27 | 27 |
* @author Ewald Snel, Benjamin Larsson, Alex Beregszaszi, Roberto Togni |
28 |
- * The decoder is not perfect yet, there are still some distorions expecially |
|
29 |
- * on files encoded with 16 or 8 subbands |
|
28 |
+ * The decoder is not perfect yet, there are still some distortions |
|
29 |
+ * especially on files encoded with 16 or 8 subbands. |
|
30 | 30 |
*/ |
31 | 31 |
|
32 | 32 |
#include <math.h> |
... | ... |
@@ -94,7 +94,7 @@ typedef struct { |
94 | 94 |
} QDM2SubPacket; |
95 | 95 |
|
96 | 96 |
/** |
97 |
- * A node in subpacket list |
|
97 |
+ * A node in the subpacket list |
|
98 | 98 |
*/ |
99 | 99 |
typedef struct _QDM2SubPNode { |
100 | 100 |
QDM2SubPacket *packet; ///< packet |
... | ... |
@@ -196,12 +196,12 @@ typedef struct { |
196 | 196 |
int8_t tone_level_idx_temp[MPA_MAX_CHANNELS][30][64]; |
197 | 197 |
|
198 | 198 |
// Flags |
199 |
- int has_errors; ///< packet have errors |
|
199 |
+ int has_errors; ///< packet has errors |
|
200 | 200 |
int superblocktype_2_3; ///< select fft tables and some algorithm based on superblock type |
201 | 201 |
int do_synth_filter; ///< used to perform or skip synthesis filter |
202 | 202 |
|
203 | 203 |
int sub_packet; |
204 |
- int noise_idx; ///< Index for dithering noise table |
|
204 |
+ int noise_idx; ///< index for dithering noise table |
|
205 | 205 |
} QDM2Context; |
206 | 206 |
|
207 | 207 |
|
... | ... |
@@ -401,7 +401,7 @@ static int qdm2_get_se_vlc (VLC *vlc, GetBitContext *gb, int depth) |
401 | 401 |
* @param length data length |
402 | 402 |
* @param value checksum value |
403 | 403 |
* |
404 |
- * @return 0 if checksum is ok |
|
404 |
+ * @return 0 if checksum is OK |
|
405 | 405 |
*/ |
406 | 406 |
static uint16_t qdm2_packet_checksum (uint8_t *data, int length, int value) { |
407 | 407 |
int i; |
... | ... |
@@ -414,7 +414,7 @@ static uint16_t qdm2_packet_checksum (uint8_t *data, int length, int value) { |
414 | 414 |
|
415 | 415 |
|
416 | 416 |
/** |
417 |
- * Fills a QDM2SubPacket structure with packet type, size, and data pointer |
|
417 |
+ * Fills a QDM2SubPacket structure with packet type, size, and data pointer. |
|
418 | 418 |
* |
419 | 419 |
* @param gb bitreader context |
420 | 420 |
* @param sub_packet packet under analysis |
... | ... |
@@ -441,15 +441,15 @@ static void qdm2_decode_sub_packet_header (GetBitContext *gb, QDM2SubPacket *sub |
441 | 441 |
sub_packet->data = &gb->buffer[get_bits_count(gb) / 8]; // FIXME: this depends on bitreader internal data |
442 | 442 |
} |
443 | 443 |
|
444 |
- av_log(NULL,AV_LOG_DEBUG,"Sub packet: type=%d size=%d start_offs=%x\n", |
|
444 |
+ av_log(NULL,AV_LOG_DEBUG,"Subpacket: type=%d size=%d start_offs=%x\n", |
|
445 | 445 |
sub_packet->type, sub_packet->size, get_bits_count(gb) / 8); |
446 | 446 |
} |
447 | 447 |
|
448 | 448 |
|
449 | 449 |
/** |
450 |
- * Return node pointer to first packet of requested type in list |
|
450 |
+ * Return node pointer to first packet of requested type in list. |
|
451 | 451 |
* |
452 |
- * @param list list of subpacket to be scanned |
|
452 |
+ * @param list list of subpackets to be scanned |
|
453 | 453 |
* @param type type of searched subpacket |
454 | 454 |
* @return node pointer for subpacket if found, else NULL |
455 | 455 |
*/ |
... | ... |
@@ -465,8 +465,8 @@ static QDM2SubPNode* qdm2_search_subpacket_type_in_list (QDM2SubPNode *list, int |
465 | 465 |
|
466 | 466 |
|
467 | 467 |
/** |
468 |
- * Replaces 8 elements with their average value |
|
469 |
- * Called by qdm2_decode_superblock before starting subblocks decoding |
|
468 |
+ * Replaces 8 elements with their average value. |
|
469 |
+ * Called by qdm2_decode_superblock before starting subblock decoding. |
|
470 | 470 |
* |
471 | 471 |
* @param q context |
472 | 472 |
*/ |
... | ... |
@@ -494,8 +494,8 @@ static void average_quantized_coeffs (QDM2Context *q) |
494 | 494 |
|
495 | 495 |
|
496 | 496 |
/** |
497 |
- * Build subband samples with noise weighted by q->tone_level |
|
498 |
- * Called by synthfilt_build_sb_samples |
|
497 |
+ * Build subband samples with noise weighted by q->tone_level. |
|
498 |
+ * Called by synthfilt_build_sb_samples. |
|
499 | 499 |
* |
500 | 500 |
* @param q context |
501 | 501 |
* @param sb subband index |
... | ... |
@@ -518,8 +518,8 @@ static void build_sb_samples_from_noise (QDM2Context *q, int sb) |
518 | 518 |
|
519 | 519 |
|
520 | 520 |
/** |
521 |
- * Called while processing data from subpackets 11 and 12 |
|
522 |
- * Used after making changes to coding_method array |
|
521 |
+ * Called while processing data from subpackets 11 and 12. |
|
522 |
+ * Used after making changes to coding_method array. |
|
523 | 523 |
* |
524 | 524 |
* @param sb subband index |
525 | 525 |
* @param channels number of channels |
... | ... |
@@ -790,7 +790,7 @@ static void fill_coding_method_array (sb_int8_array tone_level_idx, sb_int8_arra |
790 | 790 |
* |
791 | 791 |
* @param q context |
792 | 792 |
* @param gb bitreader context |
793 |
- * @param length packet length in bit |
|
793 |
+ * @param length packet length in bits |
|
794 | 794 |
* @param sb_min lower subband processed (sb_min included) |
795 | 795 |
* @param sb_max higher subband processed (sb_max excluded) |
796 | 796 |
*/ |
... | ... |
@@ -968,14 +968,14 @@ static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int l |
968 | 968 |
|
969 | 969 |
|
970 | 970 |
/** |
971 |
- * Init the first element of a channel in quantized_coeffs with data from packet 10 (quantized_coeffs[ch][0]) |
|
971 |
+ * Init the first element of a channel in quantized_coeffs with data from packet 10 (quantized_coeffs[ch][0]). |
|
972 | 972 |
* This is similar to process_subpacket_9, but for a single channel and for element [0] |
973 |
- * same VLC tables as process_subpacket_9 are used |
|
973 |
+ * same VLC tables as process_subpacket_9 are used. |
|
974 | 974 |
* |
975 | 975 |
* @param q context |
976 | 976 |
* @param quantized_coeffs pointer to quantized_coeffs[ch][0] |
977 | 977 |
* @param gb bitreader context |
978 |
- * @param length packet length in bit |
|
978 |
+ * @param length packet length in bits |
|
979 | 979 |
*/ |
980 | 980 |
static void init_quantized_coeffs_elem0 (int8_t *quantized_coeffs, GetBitContext *gb, int length) |
981 | 981 |
{ |
... | ... |
@@ -1012,7 +1012,7 @@ static void init_quantized_coeffs_elem0 (int8_t *quantized_coeffs, GetBitContext |
1012 | 1012 |
* |
1013 | 1013 |
* @param q context |
1014 | 1014 |
* @param gb bitreader context |
1015 |
- * @param length packet length in bit |
|
1015 |
+ * @param length packet length in bits |
|
1016 | 1016 |
*/ |
1017 | 1017 |
static void init_tone_level_dequantization (QDM2Context *q, GetBitContext *gb, int length) |
1018 | 1018 |
{ |
... | ... |
@@ -1114,7 +1114,7 @@ static void process_subpacket_9 (QDM2Context *q, QDM2SubPNode *node) |
1114 | 1114 |
* |
1115 | 1115 |
* @param q context |
1116 | 1116 |
* @param node pointer to node with packet |
1117 |
- * @param length packet length in bit |
|
1117 |
+ * @param length packet length in bits |
|
1118 | 1118 |
*/ |
1119 | 1119 |
static void process_subpacket_10 (QDM2Context *q, QDM2SubPNode *node, int length) |
1120 | 1120 |
{ |
... | ... |
@@ -1160,7 +1160,7 @@ static void process_subpacket_11 (QDM2Context *q, QDM2SubPNode *node, int length |
1160 | 1160 |
* |
1161 | 1161 |
* @param q context |
1162 | 1162 |
* @param node pointer to node with packet |
1163 |
- * @param length packet length in bit |
|
1163 |
+ * @param length packet length in bits |
|
1164 | 1164 |
*/ |
1165 | 1165 |
static void process_subpacket_12 (QDM2Context *q, QDM2SubPNode *node, int length) |
1166 | 1166 |
{ |
... | ... |
@@ -1205,7 +1205,7 @@ static void process_synthesis_subpackets (QDM2Context *q, QDM2SubPNode *list) |
1205 | 1205 |
|
1206 | 1206 |
|
1207 | 1207 |
/* |
1208 |
- * Decode superblock, fill packet lists |
|
1208 |
+ * Decode superblock, fill packet lists. |
|
1209 | 1209 |
* |
1210 | 1210 |
* @param q context |
1211 | 1211 |
*/ |
... | ... |
@@ -1274,7 +1274,7 @@ static void qdm2_decode_super_block (QDM2Context *q) |
1274 | 1274 |
break; |
1275 | 1275 |
} |
1276 | 1276 |
|
1277 |
- /* decode sub packet */ |
|
1277 |
+ /* decode subpacket */ |
|
1278 | 1278 |
packet = &q->sub_packets[i]; |
1279 | 1279 |
qdm2_decode_sub_packet_header(&gb, packet); |
1280 | 1280 |
next_index = packet->size + get_bits_count(&gb) / 8; |
... | ... |
@@ -1291,10 +1291,10 @@ static void qdm2_decode_super_block (QDM2Context *q) |
1291 | 1291 |
|
1292 | 1292 |
packet_bytes -= sub_packet_size; |
1293 | 1293 |
|
1294 |
- /* add sub packet to 'all sub packets' list */ |
|
1294 |
+ /* add subpacket to 'all subpackets' list */ |
|
1295 | 1295 |
q->sub_packet_list_A[i].packet = packet; |
1296 | 1296 |
|
1297 |
- /* add sub packet to related list */ |
|
1297 |
+ /* add subpacket to related list */ |
|
1298 | 1298 |
if (packet->type == 8) { |
1299 | 1299 |
SAMPLES_NEEDED_2("packet type 8"); |
1300 | 1300 |
return; |
... | ... |
@@ -1435,11 +1435,11 @@ static void qdm2_decode_fft_packets (QDM2Context *q) |
1435 | 1435 |
for (i=0; i < 5; i++) |
1436 | 1436 |
q->fft_coefs_min_index[i] = -1; |
1437 | 1437 |
|
1438 |
- /* process sub packets ordered by type, largest type first */ |
|
1438 |
+ /* process subpackets ordered by type, largest type first */ |
|
1439 | 1439 |
for (i = 0, max = 256; i < q->sub_packets_B; i++) { |
1440 | 1440 |
QDM2SubPacket *packet; |
1441 | 1441 |
|
1442 |
- /* find sub packet with largest type less than max */ |
|
1442 |
+ /* find subpacket with largest type less than max */ |
|
1443 | 1443 |
for (j = 0, min = 0, packet = NULL; j < q->sub_packets_B; j++) { |
1444 | 1444 |
value = q->sub_packet_list_B[j].packet->type; |
1445 | 1445 |
if (value > min && value < max) { |
... | ... |
@@ -1619,7 +1619,7 @@ static void qdm2_calculate_fft (QDM2Context *q, int channel, int sub_packet) |
1619 | 1619 |
float c, s, f0, f1, f2, f3; |
1620 | 1620 |
int i, j; |
1621 | 1621 |
|
1622 |
- /* pre rotation (or something like that) */ |
|
1622 |
+ /* prerotation (or something like that) */ |
|
1623 | 1623 |
for (i=1; i < n2; i++) { |
1624 | 1624 |
j = (n - i); |
1625 | 1625 |
c = q->exptab[i].re; |
... | ... |
@@ -1960,11 +1960,11 @@ void qdm2_decode (QDM2Context *q, uint8_t *in, int16_t *out) |
1960 | 1960 |
/* decode block of QDM2 compressed data */ |
1961 | 1961 |
if (q->sub_packet == 0) { |
1962 | 1962 |
q->has_errors = 0; // zero it for a new super block |
1963 |
- av_log(NULL,AV_LOG_DEBUG,"Super block follows\n"); |
|
1963 |
+ av_log(NULL,AV_LOG_DEBUG,"Superblock follows\n"); |
|
1964 | 1964 |
qdm2_decode_super_block(q); |
1965 | 1965 |
} |
1966 | 1966 |
|
1967 |
- /* parse sub packets */ |
|
1967 |
+ /* parse subpackets */ |
|
1968 | 1968 |
if (!q->has_errors) { |
1969 | 1969 |
if (q->sub_packet == 2) |
1970 | 1970 |
qdm2_decode_fft_packets(q); |