From c3513477bbbc0898e8fe38c4e37ac67298d76a48 Mon Sep 17 00:00:00 2001 From: Shitiz Garg Date: Sat, 31 Dec 2011 03:48:53 +0530 Subject: [PATCH 1/8] cook: K&R formatting cosmetics Signed-off-by: Diego Biurrun --- libavcodec/cook.c | 728 +++++++++++++++++++++++----------------------- 1 file changed, 365 insertions(+), 363 deletions(-) diff --git a/libavcodec/cook.c b/libavcodec/cook.c index 81a1aae9d1..d2ed819b83 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -57,7 +57,7 @@ #define MONO 0x1000001 #define STEREO 0x1000002 #define JOINT_STEREO 0x1000003 -#define MC_COOK 0x2000000 //multichannel Cook, not supported +#define MC_COOK 0x2000000 // multichannel Cook, not supported #define SUBBAND_SIZE 20 #define MAX_SUBPACKETS 5 @@ -102,24 +102,24 @@ typedef struct cook { * The following 5 functions provide the lowlevel arithmetic on * the internal audio buffers. */ - void (* scalar_dequant)(struct cook *q, int index, int quant_index, - int* subband_coef_index, int* subband_coef_sign, - float* mlt_p); + void (*scalar_dequant)(struct cook *q, int index, int quant_index, + int *subband_coef_index, int *subband_coef_sign, + float *mlt_p); - void (* decouple) (struct cook *q, - COOKSubpacket *p, - int subband, - float f1, float f2, - float *decode_buffer, - float *mlt_buffer1, float *mlt_buffer2); + void (*decouple)(struct cook *q, + COOKSubpacket *p, + int subband, + float f1, float f2, + float *decode_buffer, + float *mlt_buffer1, float *mlt_buffer2); - void (* imlt_window) (struct cook *q, float *buffer1, - cook_gains *gains_ptr, float *previous_buffer); + void (*imlt_window)(struct cook *q, float *buffer1, + cook_gains *gains_ptr, float *previous_buffer); - void (* interpolate) (struct cook *q, float* buffer, - int gain_index, int gain_index_next); + void (*interpolate)(struct cook *q, float *buffer, + int gain_index, int gain_index_next); - void (* saturate_output) (struct cook *q, int chan, float *out); + void (*saturate_output)(struct cook *q, int chan, float *out); AVCodecContext* avctx; AVFrame frame; @@ -140,7 +140,7 @@ typedef struct cook { /* VLC data */ VLC envelope_quant_index[13]; - VLC sqvh[7]; //scalar quantization + VLC sqvh[7]; // scalar quantization /* generatable tables and related variables */ int gain_size_factor; @@ -165,55 +165,58 @@ static float rootpow2tab[127]; /*************** init functions ***************/ /* table generator */ -static av_cold void init_pow2table(void){ +static av_cold void init_pow2table(void) +{ int i; - for (i=-63 ; i<64 ; i++){ - pow2tab[63+i]= pow(2, i); - rootpow2tab[63+i]=sqrt(pow(2, i)); + for (i = -63; i < 64; i++) { + pow2tab[63 + i] = pow(2, i); + rootpow2tab[63 + i] = sqrt(pow(2, i)); } } /* table generator */ -static av_cold void init_gain_table(COOKContext *q) { +static av_cold void init_gain_table(COOKContext *q) +{ int i; - q->gain_size_factor = q->samples_per_channel/8; - for (i=0 ; i<23 ; i++) { - q->gain_table[i] = pow(pow2tab[i+52] , - (1.0/(double)q->gain_size_factor)); - } + q->gain_size_factor = q->samples_per_channel / 8; + for (i = 0; i < 23; i++) + q->gain_table[i] = pow(pow2tab[i + 52], + (1.0 / (double) q->gain_size_factor)); } -static av_cold int init_cook_vlc_tables(COOKContext *q) { +static av_cold int init_cook_vlc_tables(COOKContext *q) +{ int i, result; result = 0; - for (i=0 ; i<13 ; i++) { - result |= init_vlc (&q->envelope_quant_index[i], 9, 24, - envelope_quant_index_huffbits[i], 1, 1, - envelope_quant_index_huffcodes[i], 2, 2, 0); + for (i = 0; i < 13; i++) { + result |= init_vlc(&q->envelope_quant_index[i], 9, 24, + envelope_quant_index_huffbits[i], 1, 1, + envelope_quant_index_huffcodes[i], 2, 2, 0); } - av_log(q->avctx,AV_LOG_DEBUG,"sqvh VLC init\n"); - for (i=0 ; i<7 ; i++) { - result |= init_vlc (&q->sqvh[i], vhvlcsize_tab[i], vhsize_tab[i], - cvh_huffbits[i], 1, 1, - cvh_huffcodes[i], 2, 2, 0); + av_log(q->avctx, AV_LOG_DEBUG, "sqvh VLC init\n"); + for (i = 0; i < 7; i++) { + result |= init_vlc(&q->sqvh[i], vhvlcsize_tab[i], vhsize_tab[i], + cvh_huffbits[i], 1, 1, + cvh_huffcodes[i], 2, 2, 0); } - for(i=0;inum_subpackets;i++){ - if (q->subpacket[i].joint_stereo==1){ - result |= init_vlc (&q->subpacket[i].ccpl, 6, (1<subpacket[i].js_vlc_bits)-1, - ccpl_huffbits[q->subpacket[i].js_vlc_bits-2], 1, 1, - ccpl_huffcodes[q->subpacket[i].js_vlc_bits-2], 2, 2, 0); - av_log(q->avctx,AV_LOG_DEBUG,"subpacket %i Joint-stereo VLC used.\n",i); + for (i = 0; i < q->num_subpackets; i++) { + if (q->subpacket[i].joint_stereo == 1) { + result |= init_vlc(&q->subpacket[i].ccpl, 6, (1 << q->subpacket[i].js_vlc_bits) - 1, + ccpl_huffbits[q->subpacket[i].js_vlc_bits - 2], 1, 1, + ccpl_huffcodes[q->subpacket[i].js_vlc_bits - 2], 2, 2, 0); + av_log(q->avctx, AV_LOG_DEBUG, "subpacket %i Joint-stereo VLC used.\n", i); } } - av_log(q->avctx,AV_LOG_DEBUG,"VLC tables initialized.\n"); + av_log(q->avctx, AV_LOG_DEBUG, "VLC tables initialized.\n"); return result; } -static av_cold int init_cook_mlt(COOKContext *q) { +static av_cold int init_cook_mlt(COOKContext *q) +{ int j, ret; int mlt_size = q->samples_per_channel; @@ -222,35 +225,36 @@ static av_cold int init_cook_mlt(COOKContext *q) { /* Initialize the MLT window: simple sine window. */ ff_sine_window_init(q->mlt_window, mlt_size); - for(j=0 ; jmlt_window[j] *= sqrt(2.0 / q->samples_per_channel); /* Initialize the MDCT. */ - if ((ret = ff_mdct_init(&q->mdct_ctx, av_log2(mlt_size)+1, 1, 1.0/32768.0))) { + if ((ret = ff_mdct_init(&q->mdct_ctx, av_log2(mlt_size) + 1, 1, 1.0 / 32768.0))) { av_free(q->mlt_window); return ret; } - av_log(q->avctx,AV_LOG_DEBUG,"MDCT initialized, order = %d.\n", - av_log2(mlt_size)+1); + av_log(q->avctx, AV_LOG_DEBUG, "MDCT initialized, order = %d.\n", + av_log2(mlt_size) + 1); return 0; } -static const float *maybe_reformat_buffer32 (COOKContext *q, const float *ptr, int n) +static const float *maybe_reformat_buffer32(COOKContext *q, const float *ptr, int n) { if (1) return ptr; } -static av_cold void init_cplscales_table (COOKContext *q) { +static av_cold void init_cplscales_table(COOKContext *q) +{ int i; - for (i=0;i<5;i++) - q->cplscales[i] = maybe_reformat_buffer32 (q, cplscales[i], (1<<(i+2))-1); + for (i = 0; i < 5; i++) + q->cplscales[i] = maybe_reformat_buffer32(q, cplscales[i], (1 << (i + 2)) - 1); } /*************** init functions end ***********/ -#define DECODE_BYTES_PAD1(bytes) (3 - ((bytes)+3) % 4) +#define DECODE_BYTES_PAD1(bytes) (3 - ((bytes) + 3) % 4) #define DECODE_BYTES_PAD2(bytes) ((bytes) % 4 + DECODE_BYTES_PAD1(2 * (bytes))) /** @@ -273,27 +277,27 @@ static av_cold void init_cplscales_table (COOKContext *q) { * @param out pointer to byte array of outdata * @param bytes number of bytes */ - -static inline int decode_bytes(const uint8_t* inbuffer, uint8_t* out, int bytes){ +static inline int decode_bytes(const uint8_t *inbuffer, uint8_t *out, int bytes) +{ static const uint32_t tab[4] = { AV_BE2NE32C(0x37c511f2), AV_BE2NE32C(0xf237c511), AV_BE2NE32C(0x11f237c5), AV_BE2NE32C(0xc511f237), }; int i, off; uint32_t c; - const uint32_t* buf; - uint32_t* obuf = (uint32_t*) out; + const uint32_t *buf; + uint32_t *obuf = (uint32_t *) out; /* FIXME: 64 bit platforms would be able to do 64 bits at a time. * I'm too lazy though, should be something like - * for(i=0 ; ipriv_data; - av_log(avctx,AV_LOG_DEBUG, "Deallocating memory.\n"); + av_log(avctx, AV_LOG_DEBUG, "Deallocating memory.\n"); /* Free allocated memory buffers. */ av_free(q->mlt_window); @@ -317,17 +320,14 @@ static av_cold int cook_decode_close(AVCodecContext *avctx) ff_mdct_end(&q->mdct_ctx); /* Free the VLC tables. */ - for (i=0 ; i<13 ; i++) { + for (i = 0; i < 13; i++) free_vlc(&q->envelope_quant_index[i]); - } - for (i=0 ; i<7 ; i++) { + for (i = 0; i < 7; i++) free_vlc(&q->sqvh[i]); - } - for (i=0 ; inum_subpackets ; i++) { + for (i = 0; i < q->num_subpackets; i++) free_vlc(&q->subpacket[i].ccpl); - } - av_log(avctx,AV_LOG_DEBUG,"Memory deallocated.\n"); + av_log(avctx, AV_LOG_DEBUG, "Memory deallocated.\n"); return 0; } @@ -338,22 +338,26 @@ static av_cold int cook_decode_close(AVCodecContext *avctx) * @param gb pointer to the GetBitContext * @param gaininfo array[9] of gain indexes */ - static void decode_gain_info(GetBitContext *gb, int *gaininfo) { int i, n; - while (get_bits1(gb)) {} - n = get_bits_count(gb) - 1; //amount of elements*2 to update + while (get_bits1(gb)) { + /* NOTHING */ + } + + n = get_bits_count(gb) - 1; // amount of elements*2 to update i = 0; while (n--) { int index = get_bits(gb, 3); int gain = get_bits1(gb) ? get_bits(gb, 4) - 7 : -1; - while (i <= index) gaininfo[i++] = gain; + while (i <= index) + gaininfo[i++] = gain; } - while (i <= 8) gaininfo[i++] = 0; + while (i <= 8) + gaininfo[i++] = 0; } /** @@ -362,25 +366,28 @@ static void decode_gain_info(GetBitContext *gb, int *gaininfo) * @param q pointer to the COOKContext * @param quant_index_table pointer to the array */ +static void decode_envelope(COOKContext *q, COOKSubpacket *p, + int *quant_index_table) +{ + int i, j, vlc_index; -static void decode_envelope(COOKContext *q, COOKSubpacket *p, int* quant_index_table) { - int i,j, vlc_index; + quant_index_table[0] = get_bits(&q->gb, 6) - 6; // This is used later in categorize - quant_index_table[0]= get_bits(&q->gb,6) - 6; //This is used later in categorize - - for (i=1 ; i < p->total_subbands ; i++){ - vlc_index=i; + for (i = 1; i < p->total_subbands; i++) { + vlc_index = i; if (i >= p->js_subband_start * 2) { - vlc_index-=p->js_subband_start; + vlc_index -= p->js_subband_start; } else { - vlc_index/=2; - if(vlc_index < 1) vlc_index = 1; + vlc_index /= 2; + if (vlc_index < 1) + vlc_index = 1; } - if (vlc_index>13) vlc_index = 13; //the VLC tables >13 are identical to No. 13 + if (vlc_index > 13) + vlc_index = 13; // the VLC tables >13 are identical to No. 13 - j = get_vlc2(&q->gb, q->envelope_quant_index[vlc_index-1].table, - q->envelope_quant_index[vlc_index-1].bits,2); - quant_index_table[i] = quant_index_table[i-1] + j - 12; //differential encoding + j = get_vlc2(&q->gb, q->envelope_quant_index[vlc_index - 1].table, + q->envelope_quant_index[vlc_index - 1].bits, 2); + quant_index_table[i] = quant_index_table[i - 1] + j - 12; // differential encoding } } @@ -392,22 +399,22 @@ static void decode_envelope(COOKContext *q, COOKSubpacket *p, int* quant_index_t * @param category pointer to the category array * @param category_index pointer to the category_index array */ - -static void categorize(COOKContext *q, COOKSubpacket *p, int* quant_index_table, - int* category, int* category_index){ +static void categorize(COOKContext *q, COOKSubpacket *p, int *quant_index_table, + int *category, int *category_index) +{ int exp_idx, bias, tmpbias1, tmpbias2, bits_left, num_bits, index, v, i, j; int exp_index2[102]; int exp_index1[102]; - int tmp_categorize_array[128*2]; - int tmp_categorize_array1_idx=p->numvector_size; - int tmp_categorize_array2_idx=p->numvector_size; + int tmp_categorize_array[128 * 2]; + int tmp_categorize_array1_idx = p->numvector_size; + int tmp_categorize_array2_idx = p->numvector_size; - bits_left = p->bits_per_subpacket - get_bits_count(&q->gb); + bits_left = p->bits_per_subpacket - get_bits_count(&q->gb); - if(bits_left > q->samples_per_channel) { + if (bits_left > q->samples_per_channel) { bits_left = q->samples_per_channel + - ((bits_left - q->samples_per_channel)*5)/8; + ((bits_left - q->samples_per_channel) * 5) / 8; //av_log(q->avctx, AV_LOG_ERROR, "bits_left = %d\n",bits_left); } @@ -415,25 +422,24 @@ static void categorize(COOKContext *q, COOKSubpacket *p, int* quant_index_table, memset(&exp_index2, 0, sizeof(exp_index2)); memset(&tmp_categorize_array, 0, sizeof(tmp_categorize_array)); - bias=-32; + bias = -32; /* Estimate bias. */ - for (i=32 ; i>0 ; i=i/2){ + for (i = 32; i > 0; i = i / 2) { num_bits = 0; - index = 0; - for (j=p->total_subbands ; j>0 ; j--){ + index = 0; + for (j = p->total_subbands; j > 0; j--) { exp_idx = av_clip((i - quant_index_table[index] + bias) / 2, 0, 7); index++; - num_bits+=expbits_tab[exp_idx]; - } - if(num_bits >= bits_left - 32){ - bias+=i; + num_bits += expbits_tab[exp_idx]; } + if (num_bits >= bits_left - 32) + bias += i; } /* Calculate total number of bits. */ - num_bits=0; - for (i=0 ; itotal_subbands ; i++) { + num_bits = 0; + for (i = 0; i < p->total_subbands; i++) { exp_idx = av_clip((bias - quant_index_table[i]) / 2, 0, 7); num_bits += expbits_tab[exp_idx]; exp_index1[i] = exp_idx; @@ -441,50 +447,51 @@ static void categorize(COOKContext *q, COOKSubpacket *p, int* quant_index_table, } tmpbias1 = tmpbias2 = num_bits; - for (j = 1 ; j < p->numvector_size ; j++) { - if (tmpbias1 + tmpbias2 > 2*bits_left) { /* ---> */ + for (j = 1; j < p->numvector_size; j++) { + if (tmpbias1 + tmpbias2 > 2 * bits_left) { /* ---> */ int max = -999999; - index=-1; - for (i=0 ; itotal_subbands ; i++){ + index = -1; + for (i = 0; i < p->total_subbands; i++) { if (exp_index1[i] < 7) { - v = (-2*exp_index1[i]) - quant_index_table[i] + bias; - if ( v >= max) { - max = v; + v = (-2 * exp_index1[i]) - quant_index_table[i] + bias; + if (v >= max) { + max = v; index = i; } } } - if(index==-1)break; + if (index == -1) + break; tmp_categorize_array[tmp_categorize_array1_idx++] = index; tmpbias1 -= expbits_tab[exp_index1[index]] - - expbits_tab[exp_index1[index]+1]; + expbits_tab[exp_index1[index] + 1]; ++exp_index1[index]; } else { /* <--- */ int min = 999999; - index=-1; - for (i=0 ; itotal_subbands ; i++){ - if(exp_index2[i] > 0){ - v = (-2*exp_index2[i])-quant_index_table[i]+bias; - if ( v < min) { - min = v; + index = -1; + for (i = 0; i < p->total_subbands; i++) { + if (exp_index2[i] > 0) { + v = (-2 * exp_index2[i]) - quant_index_table[i] + bias; + if (v < min) { + min = v; index = i; } } } - if(index == -1)break; + if (index == -1) + break; tmp_categorize_array[--tmp_categorize_array2_idx] = index; tmpbias2 -= expbits_tab[exp_index2[index]] - - expbits_tab[exp_index2[index]-1]; + expbits_tab[exp_index2[index] - 1]; --exp_index2[index]; } } - for(i=0 ; itotal_subbands ; i++) + for (i = 0; i < p->total_subbands; i++) category[i] = exp_index2[i]; - for(i=0 ; inumvector_size-1 ; i++) + for (i = 0; i < p->numvector_size - 1; i++) category_index[i] = tmp_categorize_array[tmp_categorize_array2_idx++]; - } @@ -495,13 +502,12 @@ static void categorize(COOKContext *q, COOKSubpacket *p, int* quant_index_table, * @param category pointer to the category array * @param category_index pointer to the category_index array */ - -static inline void expand_category(COOKContext *q, int* category, - int* category_index){ +static inline void expand_category(COOKContext *q, int *category, + int *category_index) +{ int i; - for(i=0 ; inum_vectors ; i++){ + for (i = 0; i < q->num_vectors; i++) ++category[category_index[i]]; - } } /** @@ -514,23 +520,25 @@ static inline void expand_category(COOKContext *q, int* category, * @param subband_coef_sign signs of coefficients * @param mlt_p pointer into the mlt buffer */ - static void scalar_dequant_float(COOKContext *q, int index, int quant_index, - int* subband_coef_index, int* subband_coef_sign, - float* mlt_p){ + int *subband_coef_index, int *subband_coef_sign, + float *mlt_p) +{ int i; float f1; - for(i=0 ; irandom_state) < 0x80000000) f1 = -f1; + if (av_lfg_get(&q->random_state) < 0x80000000) + f1 = -f1; } - mlt_p[i] = f1 * rootpow2tab[quant_index+63]; + mlt_p[i] = f1 * rootpow2tab[quant_index + 63]; } } /** @@ -541,35 +549,35 @@ static void scalar_dequant_float(COOKContext *q, int index, int quant_index, * @param subband_coef_index array of indexes to quant_centroid_tab * @param subband_coef_sign signs of coefficients */ - -static int unpack_SQVH(COOKContext *q, COOKSubpacket *p, int category, int* subband_coef_index, - int* subband_coef_sign) { - int i,j; - int vlc, vd ,tmp, result; +static int unpack_SQVH(COOKContext *q, COOKSubpacket *p, int category, + int *subband_coef_index, int *subband_coef_sign) +{ + int i, j; + int vlc, vd, tmp, result; vd = vd_tab[category]; result = 0; - for(i=0 ; igb, q->sqvh[category].table, q->sqvh[category].bits, 3); - if (p->bits_per_subpacket < get_bits_count(&q->gb)){ + if (p->bits_per_subpacket < get_bits_count(&q->gb)) { vlc = 0; result = 1; } - for(j=vd-1 ; j>=0 ; j--){ - tmp = (vlc * invradix_tab[category])/0x100000; - subband_coef_index[vd*i+j] = vlc - tmp * (kmax_tab[category]+1); + for (j = vd - 1; j >= 0; j--) { + tmp = (vlc * invradix_tab[category]) / 0x100000; + subband_coef_index[vd * i + j] = vlc - tmp * (kmax_tab[category] + 1); vlc = tmp; } - for(j=0 ; jgb) < p->bits_per_subpacket){ - subband_coef_sign[i*vd+j] = get_bits1(&q->gb); + for (j = 0; j < vd; j++) { + if (subband_coef_index[i * vd + j]) { + if (get_bits_count(&q->gb) < p->bits_per_subpacket) { + subband_coef_sign[i * vd + j] = get_bits1(&q->gb); } else { - result=1; - subband_coef_sign[i*vd+j]=0; + result = 1; + subband_coef_sign[i * vd + j] = 0; } } else { - subband_coef_sign[i*vd+j]=0; + subband_coef_sign[i * vd + j] = 0; } } } @@ -585,10 +593,9 @@ static int unpack_SQVH(COOKContext *q, COOKSubpacket *p, int category, int* subb * @param quant_index_table pointer to the array * @param mlt_buffer pointer to mlt coefficients */ - - -static void decode_vectors(COOKContext* q, COOKSubpacket* p, int* category, - int *quant_index_table, float* mlt_buffer){ +static void decode_vectors(COOKContext *q, COOKSubpacket *p, int *category, + int *quant_index_table, float *mlt_buffer) +{ /* A zero in this table means that the subband coefficient is random noise coded. */ int subband_coef_index[SUBBAND_SIZE]; @@ -596,28 +603,29 @@ static void decode_vectors(COOKContext* q, COOKSubpacket* p, int* category, positive multiplicator. */ int subband_coef_sign[SUBBAND_SIZE]; int band, j; - int index=0; + int index = 0; - for(band=0 ; bandtotal_subbands ; band++){ + for (band = 0; band < p->total_subbands; band++) { index = category[band]; - if(category[band] < 7){ - if(unpack_SQVH(q, p, category[band], subband_coef_index, subband_coef_sign)){ - index=7; - for(j=0 ; jtotal_subbands ; j++) category[band+j]=7; + if (category[band] < 7) { + if (unpack_SQVH(q, p, category[band], subband_coef_index, subband_coef_sign)) { + index = 7; + for (j = 0; j < p->total_subbands; j++) + category[band + j] = 7; } } - if(index>=7) { + if (index >= 7) { memset(subband_coef_index, 0, sizeof(subband_coef_index)); - memset(subband_coef_sign, 0, sizeof(subband_coef_sign)); + memset(subband_coef_sign, 0, sizeof(subband_coef_sign)); } q->scalar_dequant(q, index, quant_index_table[band], subband_coef_index, subband_coef_sign, &mlt_buffer[band * SUBBAND_SIZE]); } - if(p->total_subbands*SUBBAND_SIZE >= q->samples_per_channel){ + /* FIXME: should this be removed, or moved into loop above? */ + if (p->total_subbands * SUBBAND_SIZE >= q->samples_per_channel) return; - } /* FIXME: should this be removed, or moved into loop above? */ } @@ -627,9 +635,8 @@ static void decode_vectors(COOKContext* q, COOKSubpacket* p, int* category, * @param q pointer to the COOKContext * @param mlt_buffer pointer to mlt coefficients */ - -static void mono_decode(COOKContext *q, COOKSubpacket *p, float* mlt_buffer) { - +static void mono_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer) +{ int category_index[128]; int quant_index_table[102]; int category[128]; @@ -638,7 +645,7 @@ static void mono_decode(COOKContext *q, COOKSubpacket *p, float* mlt_buffer) { memset(&category_index, 0, sizeof(category_index)); decode_envelope(q, p, quant_index_table); - q->num_vectors = get_bits(&q->gb,p->log2_numvector_size); + q->num_vectors = get_bits(&q->gb, p->log2_numvector_size); categorize(q, p, quant_index_table, category, category_index); expand_category(q, category, category_index); decode_vectors(q, p, category, quant_index_table, mlt_buffer); @@ -653,22 +660,21 @@ static void mono_decode(COOKContext *q, COOKSubpacket *p, float* mlt_buffer) { * @param gain_index index for the block multiplier * @param gain_index_next index for the next block multiplier */ - -static void interpolate_float(COOKContext *q, float* buffer, - int gain_index, int gain_index_next){ +static void interpolate_float(COOKContext *q, float *buffer, + int gain_index, int gain_index_next) +{ int i; float fc1, fc2; - fc1 = pow2tab[gain_index+63]; + fc1 = pow2tab[gain_index + 63]; - if(gain_index == gain_index_next){ //static gain - for(i=0 ; igain_size_factor ; i++){ - buffer[i]*=fc1; - } - } else { //smooth gain - fc2 = q->gain_table[11 + (gain_index_next-gain_index)]; - for(i=0 ; igain_size_factor ; i++){ - buffer[i]*=fc1; - fc1*=fc2; + if (gain_index == gain_index_next) { // static gain + for (i = 0; i < q->gain_size_factor; i++) + buffer[i] *= fc1; + } else { // smooth gain + fc2 = q->gain_table[11 + (gain_index_next - gain_index)]; + for (i = 0; i < q->gain_size_factor; i++) { + buffer[i] *= fc1; + fc1 *= fc2; } } } @@ -681,9 +687,8 @@ static void interpolate_float(COOKContext *q, float* buffer, * @param gains_ptr current and previous gains * @param previous_buffer pointer to the previous buffer to be used for overlapping */ - -static void imlt_window_float (COOKContext *q, float *inbuffer, - cook_gains *gains_ptr, float *previous_buffer) +static void imlt_window_float(COOKContext *q, float *inbuffer, + cook_gains *gains_ptr, float *previous_buffer) { const float fc = pow2tab[gains_ptr->previous[0] + 63]; int i; @@ -694,10 +699,9 @@ static void imlt_window_float (COOKContext *q, float *inbuffer, */ /* Apply window and overlap */ - for(i = 0; i < q->samples_per_channel; i++){ + for (i = 0; i < q->samples_per_channel; i++) inbuffer[i] = inbuffer[i] * fc * q->mlt_window[i] - - previous_buffer[i] * q->mlt_window[q->samples_per_channel - 1 - i]; - } + previous_buffer[i] * q->mlt_window[q->samples_per_channel - 1 - i]; } /** @@ -711,9 +715,8 @@ static void imlt_window_float (COOKContext *q, float *inbuffer, * @param gains_ptr current and previous gains * @param previous_buffer pointer to the previous buffer to be used for overlapping */ - static void imlt_gain(COOKContext *q, float *inbuffer, - cook_gains *gains_ptr, float* previous_buffer) + cook_gains *gains_ptr, float *previous_buffer) { float *buffer0 = q->mono_mdct_output; float *buffer1 = q->mono_mdct_output + q->samples_per_channel; @@ -722,14 +725,13 @@ static void imlt_gain(COOKContext *q, float *inbuffer, /* Inverse modified discrete cosine transform */ q->mdct_ctx.imdct_calc(&q->mdct_ctx, q->mono_mdct_output, inbuffer); - q->imlt_window (q, buffer1, gains_ptr, previous_buffer); + q->imlt_window(q, buffer1, gains_ptr, previous_buffer); /* Apply gain profile */ - for (i = 0; i < 8; i++) { + for (i = 0; i < 8; i++) if (gains_ptr->now[i] || gains_ptr->now[i + 1]) q->interpolate(q, &buffer1[q->gain_size_factor * i], gains_ptr->now[i], gains_ptr->now[i + 1]); - } /* Save away the current to be previous block. */ memcpy(previous_buffer, buffer0, @@ -749,19 +751,18 @@ static void decouple_info(COOKContext *q, COOKSubpacket *p, int *decouple_tab) int i; int vlc = get_bits1(&q->gb); int start = cplband[p->js_subband_start]; - int end = cplband[p->subbands-1]; + int end = cplband[p->subbands - 1]; int length = end - start + 1; if (start > end) return; - if (vlc) { + if (vlc) for (i = 0; i < length; i++) decouple_tab[start + i] = get_vlc2(&q->gb, p->ccpl.table, p->ccpl.bits, 2); - } else { + else for (i = 0; i < length; i++) decouple_tab[start + i] = get_bits(&q->gb, p->js_vlc_bits); - } } /* @@ -775,18 +776,18 @@ static void decouple_info(COOKContext *q, COOKSubpacket *p, int *decouple_tab) * @param mlt_buffer1 pointer to left channel mlt coefficients * @param mlt_buffer2 pointer to right channel mlt coefficients */ -static void decouple_float (COOKContext *q, - COOKSubpacket *p, - int subband, - float f1, float f2, - float *decode_buffer, - float *mlt_buffer1, float *mlt_buffer2) +static void decouple_float(COOKContext *q, + COOKSubpacket *p, + int subband, + float f1, float f2, + float *decode_buffer, + float *mlt_buffer1, float *mlt_buffer2) { int j, tmp_idx; - for (j=0 ; jjs_subband_start + subband)*SUBBAND_SIZE)+j; - mlt_buffer1[SUBBAND_SIZE*subband + j] = f1 * decode_buffer[tmp_idx]; - mlt_buffer2[SUBBAND_SIZE*subband + j] = f2 * decode_buffer[tmp_idx]; + for (j = 0; j < SUBBAND_SIZE; j++) { + tmp_idx = ((p->js_subband_start + subband) * SUBBAND_SIZE) + j; + mlt_buffer1[SUBBAND_SIZE * subband + j] = f1 * decode_buffer[tmp_idx]; + mlt_buffer2[SUBBAND_SIZE * subband + j] = f2 * decode_buffer[tmp_idx]; } } @@ -797,15 +798,15 @@ static void decouple_float (COOKContext *q, * @param mlt_buffer1 pointer to left channel mlt coefficients * @param mlt_buffer2 pointer to right channel mlt coefficients */ - -static void joint_decode(COOKContext *q, COOKSubpacket *p, float* mlt_buffer1, - float* mlt_buffer2) { - int i,j; +static void joint_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer1, + float *mlt_buffer2) +{ + int i, j; int decouple_tab[SUBBAND_SIZE]; float *decode_buffer = q->decode_buffer_0; int idx, cpl_tmp; - float f1,f2; - const float* cplscale; + float f1, f2; + const float *cplscale; memset(decouple_tab, 0, sizeof(decouple_tab)); memset(decode_buffer, 0, sizeof(q->decode_buffer_0)); @@ -817,23 +818,23 @@ static void joint_decode(COOKContext *q, COOKSubpacket *p, float* mlt_buffer1, mono_decode(q, p, decode_buffer); /* The two channels are stored interleaved in decode_buffer. */ - for (i=0 ; ijs_subband_start ; i++) { - for (j=0 ; jjs_subband_start; i++) { + for (j = 0; j < SUBBAND_SIZE; j++) { + mlt_buffer1[i * 20 + j] = decode_buffer[i * 40 + j]; + mlt_buffer2[i * 20 + j] = decode_buffer[i * 40 + 20 + j]; } } /* When we reach js_subband_start (the higher frequencies) the coefficients are stored in a coupling scheme. */ idx = (1 << p->js_vlc_bits) - 1; - for (i=p->js_subband_start ; isubbands ; i++) { + for (i = p->js_subband_start; i < p->subbands; i++) { cpl_tmp = cplband[i]; - idx -=decouple_tab[cpl_tmp]; - cplscale = q->cplscales[p->js_vlc_bits-2]; //choose decoupler table + idx -= decouple_tab[cpl_tmp]; + cplscale = q->cplscales[p->js_vlc_bits - 2]; // choose decoupler table f1 = cplscale[decouple_tab[cpl_tmp]]; - f2 = cplscale[idx-1]; - q->decouple (q, p, i, f1, f2, decode_buffer, mlt_buffer1, mlt_buffer2); + f2 = cplscale[idx - 1]; + q->decouple(q, p, i, f1, f2, decode_buffer, mlt_buffer1, mlt_buffer2); idx = (1 << p->js_vlc_bits) - 1; } } @@ -846,15 +847,14 @@ static void joint_decode(COOKContext *q, COOKSubpacket *p, float* mlt_buffer1, * @param inbuffer pointer to raw stream data * @param gains_ptr array of current/prev gain pointers */ - -static inline void -decode_bytes_and_gain(COOKContext *q, COOKSubpacket *p, const uint8_t *inbuffer, - cook_gains *gains_ptr) +static inline void decode_bytes_and_gain(COOKContext *q, COOKSubpacket *p, + const uint8_t *inbuffer, + cook_gains *gains_ptr) { int offset; offset = decode_bytes(inbuffer, q->decoded_bytes_buffer, - p->bits_per_subpacket/8); + p->bits_per_subpacket / 8); init_get_bits(&q->gb, q->decoded_bytes_buffer + offset, p->bits_per_subpacket); decode_gain_info(&q->gb, gains_ptr->now); @@ -863,7 +863,7 @@ decode_bytes_and_gain(COOKContext *q, COOKSubpacket *p, const uint8_t *inbuffer, FFSWAP(int *, gains_ptr->now, gains_ptr->previous); } - /** +/** * Saturate the output signal and interleave. * * @param q pointer to the COOKContext @@ -891,11 +891,9 @@ static void saturate_output_float(COOKContext *q, int chan, float *out) * @param out pointer to the output buffer * @param chan 0: left or single channel, 1: right channel */ - -static inline void -mlt_compensate_output(COOKContext *q, float *decode_buffer, - cook_gains *gains_ptr, float *previous_buffer, - float *out, int chan) +static inline void mlt_compensate_output(COOKContext *q, float *decode_buffer, + cook_gains *gains_ptr, float *previous_buffer, + float *out, int chan) { imlt_gain(q, decode_buffer, gains_ptr, previous_buffer); if (out) @@ -916,11 +914,10 @@ static void decode_subpacket(COOKContext *q, COOKSubpacket *p, { int sub_packet_size = p->size; /* packet dump */ -// for (i=0 ; iavctx, AV_LOG_ERROR, "%02x", inbuffer[i]); -// } -// av_log(q->avctx, AV_LOG_ERROR, "\n"); - memset(q->decode_buffer_1,0,sizeof(q->decode_buffer_1)); + // for (i = 0; i < sub_packet_size ; i++) + // av_log(q->avctx, AV_LOG_ERROR, "%02x", inbuffer[i]); + // av_log(q->avctx, AV_LOG_ERROR, "\n"); + memset(q->decode_buffer_1, 0, sizeof(q->decode_buffer_1)); decode_bytes_and_gain(q, p, inbuffer, &p->gains1); if (p->joint_stereo) { @@ -929,7 +926,7 @@ static void decode_subpacket(COOKContext *q, COOKSubpacket *p, mono_decode(q, p, q->decode_buffer_1); if (p->num_channels == 2) { - decode_bytes_and_gain(q, p, inbuffer + sub_packet_size/2, &p->gains2); + decode_bytes_and_gain(q, p, inbuffer + sub_packet_size / 2, &p->gains2); mono_decode(q, p, q->decode_buffer_2); } } @@ -937,16 +934,13 @@ static void decode_subpacket(COOKContext *q, COOKSubpacket *p, mlt_compensate_output(q, q->decode_buffer_1, &p->gains1, p->mono_previous_buffer1, outbuffer, p->ch_idx); - if (p->num_channels == 2) { - if (p->joint_stereo) { + if (p->num_channels == 2) + if (p->joint_stereo) mlt_compensate_output(q, q->decode_buffer_2, &p->gains1, p->mono_previous_buffer2, outbuffer, p->ch_idx + 1); - } else { + else mlt_compensate_output(q, q->decode_buffer_2, &p->gains2, p->mono_previous_buffer2, outbuffer, p->ch_idx + 1); - } - } - } @@ -955,7 +949,6 @@ static void decode_subpacket(COOKContext *q, COOKSubpacket *p, * * @param avctx pointer to the AVCodecContext */ - static int cook_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { @@ -977,30 +970,37 @@ static int cook_decode_frame(AVCodecContext *avctx, void *data, av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } - samples = (float *)q->frame.data[0]; + samples = (float *) q->frame.data[0]; } /* estimate subpacket sizes */ q->subpacket[0].size = avctx->block_align; - for(i=1;inum_subpackets;i++){ + for (i = 1; i < q->num_subpackets; i++) { q->subpacket[i].size = 2 * buf[avctx->block_align - q->num_subpackets + i]; q->subpacket[0].size -= q->subpacket[i].size + 1; if (q->subpacket[0].size < 0) { - av_log(avctx,AV_LOG_DEBUG,"frame subpacket size total > avctx->block_align!\n"); + av_log(avctx, AV_LOG_DEBUG, + "frame subpacket size total > avctx->block_align!\n"); return AVERROR_INVALIDDATA; } } /* decode supbackets */ - for(i=0;inum_subpackets;i++){ - q->subpacket[i].bits_per_subpacket = (q->subpacket[i].size*8)>>q->subpacket[i].bits_per_subpdiv; + for (i = 0; i < q->num_subpackets; i++) { + q->subpacket[i].bits_per_subpacket = (q->subpacket[i].size * 8) >> + q->subpacket[i].bits_per_subpdiv; q->subpacket[i].ch_idx = chidx; - av_log(avctx,AV_LOG_DEBUG,"subpacket[%i] size %i js %i %i block_align %i\n",i,q->subpacket[i].size,q->subpacket[i].joint_stereo,offset,avctx->block_align); + av_log(avctx, AV_LOG_DEBUG, + "subpacket[%i] size %i js %i %i block_align %i\n", + i, q->subpacket[i].size, q->subpacket[i].joint_stereo, offset, + avctx->block_align); + decode_subpacket(q, &q->subpacket[i], buf + offset, samples); offset += q->subpacket[i].size; chidx += q->subpacket[i].num_channels; - av_log(avctx,AV_LOG_DEBUG,"subpacket[%i] %i %i\n",i,q->subpacket[i].size * 8,get_bits_count(&q->gb)); + av_log(avctx, AV_LOG_DEBUG, "subpacket[%i] %i %i\n", + i, q->subpacket[i].size * 8, get_bits_count(&q->gb)); } /* Discard the first two frames: no valid audio. */ @@ -1010,8 +1010,8 @@ static int cook_decode_frame(AVCodecContext *avctx, void *data, return avctx->block_align; } - *got_frame_ptr = 1; - *(AVFrame *)data = q->frame; + *got_frame_ptr = 1; + *(AVFrame *) data = q->frame; return avctx->block_align; } @@ -1020,34 +1020,34 @@ static int cook_decode_frame(AVCodecContext *avctx, void *data, static void dump_cook_context(COOKContext *q) { //int i=0; -#define PRINT(a,b) av_log(q->avctx,AV_LOG_ERROR," %s = %d\n", a, b); - av_log(q->avctx,AV_LOG_ERROR,"COOKextradata\n"); - av_log(q->avctx,AV_LOG_ERROR,"cookversion=%x\n",q->subpacket[0].cookversion); +#define PRINT(a, b) av_log(q->avctx, AV_LOG_ERROR, " %s = %d\n", a, b); + av_log(q->avctx, AV_LOG_ERROR, "COOKextradata\n"); + av_log(q->avctx, AV_LOG_ERROR, "cookversion=%x\n", q->subpacket[0].cookversion); if (q->subpacket[0].cookversion > STEREO) { - PRINT("js_subband_start",q->subpacket[0].js_subband_start); - PRINT("js_vlc_bits",q->subpacket[0].js_vlc_bits); + PRINT("js_subband_start", q->subpacket[0].js_subband_start); + PRINT("js_vlc_bits", q->subpacket[0].js_vlc_bits); } - av_log(q->avctx,AV_LOG_ERROR,"COOKContext\n"); - PRINT("nb_channels",q->nb_channels); - PRINT("bit_rate",q->bit_rate); - PRINT("sample_rate",q->sample_rate); - PRINT("samples_per_channel",q->subpacket[0].samples_per_channel); - PRINT("samples_per_frame",q->subpacket[0].samples_per_frame); - PRINT("subbands",q->subpacket[0].subbands); - PRINT("js_subband_start",q->subpacket[0].js_subband_start); - PRINT("log2_numvector_size",q->subpacket[0].log2_numvector_size); - PRINT("numvector_size",q->subpacket[0].numvector_size); - PRINT("total_subbands",q->subpacket[0].total_subbands); + av_log(q->avctx, AV_LOG_ERROR, "COOKContext\n"); + PRINT("nb_channels", q->nb_channels); + PRINT("bit_rate", q->bit_rate); + PRINT("sample_rate", q->sample_rate); + PRINT("samples_per_channel", q->subpacket[0].samples_per_channel); + PRINT("samples_per_frame", q->subpacket[0].samples_per_frame); + PRINT("subbands", q->subpacket[0].subbands); + PRINT("js_subband_start", q->subpacket[0].js_subband_start); + PRINT("log2_numvector_size", q->subpacket[0].log2_numvector_size); + PRINT("numvector_size", q->subpacket[0].numvector_size); + PRINT("total_subbands", q->subpacket[0].total_subbands); } #endif -static av_cold int cook_count_channels(unsigned int mask){ +static av_cold int cook_count_channels(unsigned int mask) +{ int i; int channels = 0; - for(i = 0;i<32;i++){ - if(mask & (1<priv_data; @@ -1070,10 +1069,10 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) /* Take care of the codec specific extradata. */ if (extradata_size <= 0) { - av_log(avctx,AV_LOG_ERROR,"Necessary extradata missing!\n"); + av_log(avctx, AV_LOG_ERROR, "Necessary extradata missing!\n"); return AVERROR_INVALIDDATA; } - av_log(avctx,AV_LOG_DEBUG,"codecdata_length=%d\n",avctx->extradata_size); + av_log(avctx, AV_LOG_DEBUG, "codecdata_length=%d\n", avctx->extradata_size); /* Take data from the AVCodecContext (RM container). */ q->sample_rate = avctx->sample_rate; @@ -1083,17 +1082,17 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) /* Initialize RNG. */ av_lfg_init(&q->random_state, 0); - while(edata_ptr < edata_ptr_end){ + while (edata_ptr < edata_ptr_end) { /* 8 for mono, 16 for stereo, ? for multichannel Swap to right endianness so we don't need to care later on. */ - if (extradata_size >= 8){ + if (extradata_size >= 8) { q->subpacket[s].cookversion = bytestream_get_be32(&edata_ptr); - q->subpacket[s].samples_per_frame = bytestream_get_be16(&edata_ptr); + q->subpacket[s].samples_per_frame = bytestream_get_be16(&edata_ptr); q->subpacket[s].subbands = bytestream_get_be16(&edata_ptr); extradata_size -= 8; } if (extradata_size >= 8) { - bytestream_get_be32(&edata_ptr); //Unknown unused + bytestream_get_be32(&edata_ptr); // Unknown unused q->subpacket[s].js_subband_start = bytestream_get_be16(&edata_ptr); q->subpacket[s].js_vlc_bits = bytestream_get_be16(&edata_ptr); extradata_size -= 8; @@ -1110,69 +1109,72 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) /* Initialize version-dependent variables */ - av_log(avctx,AV_LOG_DEBUG,"subpacket[%i].cookversion=%x\n",s,q->subpacket[s].cookversion); + av_log(avctx, AV_LOG_DEBUG, "subpacket[%i].cookversion=%x\n", s, + q->subpacket[s].cookversion); q->subpacket[s].joint_stereo = 0; switch (q->subpacket[s].cookversion) { - case MONO: - if (q->nb_channels != 1) { - av_log_ask_for_sample(avctx, "Container channels != 1.\n"); - return AVERROR_PATCHWELCOME; - } - av_log(avctx,AV_LOG_DEBUG,"MONO\n"); - break; - case STEREO: - if (q->nb_channels != 1) { - q->subpacket[s].bits_per_subpdiv = 1; - q->subpacket[s].num_channels = 2; - } - av_log(avctx,AV_LOG_DEBUG,"STEREO\n"); - break; - case JOINT_STEREO: - if (q->nb_channels != 2) { - av_log_ask_for_sample(avctx, "Container channels != 2.\n"); - return AVERROR_PATCHWELCOME; - } - av_log(avctx,AV_LOG_DEBUG,"JOINT_STEREO\n"); - if (avctx->extradata_size >= 16){ - q->subpacket[s].total_subbands = q->subpacket[s].subbands + q->subpacket[s].js_subband_start; - q->subpacket[s].joint_stereo = 1; - q->subpacket[s].num_channels = 2; - } + case MONO: + if (q->nb_channels != 1) { + av_log_ask_for_sample(avctx, "Container channels != 1.\n"); + return AVERROR_PATCHWELCOME; + } + av_log(avctx, AV_LOG_DEBUG, "MONO\n"); + break; + case STEREO: + if (q->nb_channels != 1) { + q->subpacket[s].bits_per_subpdiv = 1; + q->subpacket[s].num_channels = 2; + } + av_log(avctx, AV_LOG_DEBUG, "STEREO\n"); + break; + case JOINT_STEREO: + if (q->nb_channels != 2) { + av_log_ask_for_sample(avctx, "Container channels != 2.\n"); + return AVERROR_PATCHWELCOME; + } + av_log(avctx, AV_LOG_DEBUG, "JOINT_STEREO\n"); + if (avctx->extradata_size >= 16) { + q->subpacket[s].total_subbands = q->subpacket[s].subbands + + q->subpacket[s].js_subband_start; + q->subpacket[s].joint_stereo = 1; + q->subpacket[s].num_channels = 2; + } + if (q->subpacket[s].samples_per_channel > 256) { + q->subpacket[s].log2_numvector_size = 6; + } + if (q->subpacket[s].samples_per_channel > 512) { + q->subpacket[s].log2_numvector_size = 7; + } + break; + case MC_COOK: + av_log(avctx, AV_LOG_DEBUG, "MULTI_CHANNEL\n"); + if (extradata_size >= 4) + channel_mask |= q->subpacket[s].channel_mask = bytestream_get_be32(&edata_ptr); + + if (cook_count_channels(q->subpacket[s].channel_mask) > 1) { + q->subpacket[s].total_subbands = q->subpacket[s].subbands + + q->subpacket[s].js_subband_start; + q->subpacket[s].joint_stereo = 1; + q->subpacket[s].num_channels = 2; + q->subpacket[s].samples_per_channel = q->subpacket[s].samples_per_frame >> 1; + if (q->subpacket[s].samples_per_channel > 256) { - q->subpacket[s].log2_numvector_size = 6; + q->subpacket[s].log2_numvector_size = 6; } if (q->subpacket[s].samples_per_channel > 512) { - q->subpacket[s].log2_numvector_size = 7; + q->subpacket[s].log2_numvector_size = 7; } - break; - case MC_COOK: - av_log(avctx,AV_LOG_DEBUG,"MULTI_CHANNEL\n"); - if(extradata_size >= 4) - channel_mask |= q->subpacket[s].channel_mask = bytestream_get_be32(&edata_ptr); + } else + q->subpacket[s].samples_per_channel = q->subpacket[s].samples_per_frame; - if(cook_count_channels(q->subpacket[s].channel_mask) > 1){ - q->subpacket[s].total_subbands = q->subpacket[s].subbands + q->subpacket[s].js_subband_start; - q->subpacket[s].joint_stereo = 1; - q->subpacket[s].num_channels = 2; - q->subpacket[s].samples_per_channel = q->subpacket[s].samples_per_frame >> 1; - - if (q->subpacket[s].samples_per_channel > 256) { - q->subpacket[s].log2_numvector_size = 6; - } - if (q->subpacket[s].samples_per_channel > 512) { - q->subpacket[s].log2_numvector_size = 7; - } - }else - q->subpacket[s].samples_per_channel = q->subpacket[s].samples_per_frame; - - break; - default: - av_log_ask_for_sample(avctx, "Unknown Cook version.\n"); - return AVERROR_PATCHWELCOME; + break; + default: + av_log_ask_for_sample(avctx, "Unknown Cook version.\n"); + return AVERROR_PATCHWELCOME; } - if(s > 1 && q->subpacket[s].samples_per_channel != q->samples_per_channel) { - av_log(avctx,AV_LOG_ERROR,"different number of samples per channel!\n"); + if (s > 1 && q->subpacket[s].samples_per_channel != q->samples_per_channel) { + av_log(avctx, AV_LOG_ERROR, "different number of samples per channel!\n"); return AVERROR_INVALIDDATA; } else q->samples_per_channel = q->subpacket[0].samples_per_channel; @@ -1187,9 +1189,10 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) return AVERROR_PATCHWELCOME; } - if ((q->subpacket[s].js_vlc_bits > 6) || (q->subpacket[s].js_vlc_bits < 2*q->subpacket[s].joint_stereo)) { - av_log(avctx,AV_LOG_ERROR,"js_vlc_bits = %d, only >= %d and <= 6 allowed!\n", - q->subpacket[s].js_vlc_bits, 2*q->subpacket[s].joint_stereo); + if ((q->subpacket[s].js_vlc_bits > 6) || + (q->subpacket[s].js_vlc_bits < 2 * q->subpacket[s].joint_stereo)) { + av_log(avctx, AV_LOG_ERROR, "js_vlc_bits = %d, only >= %d and <= 6 allowed!\n", + q->subpacket[s].js_vlc_bits, 2 * q->subpacket[s].joint_stereo); return AVERROR_INVALIDDATA; } @@ -1218,16 +1221,16 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) return ret; - if(avctx->block_align >= UINT_MAX/2) + if (avctx->block_align >= UINT_MAX / 2) return AVERROR(EINVAL); /* Pad the databuffer with: DECODE_BYTES_PAD1 or DECODE_BYTES_PAD2 for decode_bytes(), FF_INPUT_BUFFER_PADDING_SIZE, for the bitstreamreader. */ - q->decoded_bytes_buffer = - av_mallocz(avctx->block_align - + DECODE_BYTES_PAD1(avctx->block_align) - + FF_INPUT_BUFFER_PADDING_SIZE); + q->decoded_bytes_buffer = + av_mallocz(avctx->block_align + + DECODE_BYTES_PAD1(avctx->block_align) + + FF_INPUT_BUFFER_PADDING_SIZE); if (q->decoded_bytes_buffer == NULL) return AVERROR(ENOMEM); @@ -1245,7 +1248,8 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) } /* Try to catch some obviously faulty streams, othervise it might be exploitable */ - if ((q->samples_per_channel == 256) || (q->samples_per_channel == 512) || (q->samples_per_channel == 1024)) { + if ((q->samples_per_channel == 256) || (q->samples_per_channel == 512) + || (q->samples_per_channel == 1024)) { } else { av_log_ask_for_sample(avctx, "unknown amount of samples_per_channel = %d\n", @@ -1257,7 +1261,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) if (channel_mask) avctx->channel_layout = channel_mask; else - avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; + avctx->channel_layout = (avctx->channels == 2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; avcodec_get_frame_defaults(&q->frame); avctx->coded_frame = &q->frame; @@ -1268,16 +1272,14 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) return 0; } - -AVCodec ff_cook_decoder = -{ - .name = "cook", - .type = AVMEDIA_TYPE_AUDIO, - .id = CODEC_ID_COOK, +AVCodec ff_cook_decoder = { + .name = "cook", + .type = AVMEDIA_TYPE_AUDIO, + .id = CODEC_ID_COOK, .priv_data_size = sizeof(COOKContext), - .init = cook_decode_init, - .close = cook_decode_close, - .decode = cook_decode_frame, - .capabilities = CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("COOK"), + .init = cook_decode_init, + .close = cook_decode_close, + .decode = cook_decode_frame, + .capabilities = CODEC_CAP_DR1, + .long_name = NULL_IF_CONFIG_SMALL("COOK"), }; From c11b92b304334b1241ee79406dca6a03131fc921 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Sat, 31 Dec 2011 17:31:02 +0100 Subject: [PATCH 2/8] Changelog: restore version header Indeo 4 decoder and SMJPEG demuxer are not included in 0.8_beta1. Move them to version . --- Changelog | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index 19ba73a940..0cbc20af9e 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,12 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest. +version : + +- Indeo 4 decoder +- SMJPEG demuxer + + version 0.8_beta1: - BWF muxer @@ -111,8 +117,6 @@ easier to use. The changes are: - v410 QuickTime uncompressed 4:4:4 10-bit encoder and decoder - OpenMG Audio muxer - Simple segmenting muxer -- Indeo 4 decoder -- SMJPEG demuxer version 0.7: From e4e30256f87f177decf59b59e923d05ef64147df Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Sun, 25 Dec 2011 11:45:05 +0100 Subject: [PATCH 3/8] threads: default to automatic thread count detection --- Changelog | 1 + libavcodec/options.c | 2 +- libavcodec/version.h | 2 +- libavformat/utils.c | 19 +++++++++++++++---- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Changelog b/Changelog index 0cbc20af9e..c305406493 100644 --- a/Changelog +++ b/Changelog @@ -6,6 +6,7 @@ version : - Indeo 4 decoder - SMJPEG demuxer +- Automatic thread count based on detection number of (available) CPU cores version 0.8_beta1: diff --git a/libavcodec/options.c b/libavcodec/options.c index 4ac9313f27..4ac92fd29e 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -370,7 +370,7 @@ static const AVOption options[]={ {"float", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_AA_FLOAT }, INT_MIN, INT_MAX, V|D, "aa"}, #endif {"qns", "quantizer noise shaping", OFFSET(quantizer_noise_shaping), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"threads", NULL, OFFSET(thread_count), AV_OPT_TYPE_INT, {.dbl = 1 }, 0, INT_MAX, V|E|D, "threads"}, +{"threads", NULL, OFFSET(thread_count), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, V|E|D, "threads"}, {"auto", "detect a good number of threads", 0, AV_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, V|E|D, "threads"}, {"me_threshold", "motion estimaton threshold", OFFSET(me_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, {"mb_threshold", "macroblock threshold", OFFSET(mb_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E}, diff --git a/libavcodec/version.h b/libavcodec/version.h index 9b4f6d71b8..e6226cb224 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -22,7 +22,7 @@ #define LIBAVCODEC_VERSION_MAJOR 53 #define LIBAVCODEC_VERSION_MINOR 32 -#define LIBAVCODEC_VERSION_MICRO 0 +#define LIBAVCODEC_VERSION_MICRO 1 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff --git a/libavformat/utils.c b/libavformat/utils.c index aa2c276b90..163d602a53 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2268,9 +2268,14 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) int i, count, ret, read_size, j; AVStream *st; AVPacket pkt1, *pkt; + AVDictionary *one_thread_opt = NULL; int64_t old_offset = avio_tell(ic->pb); int orig_nb_streams = ic->nb_streams; // new streams might appear, no options for those + /* this function doesn't flush the decoders, so force thread count + * to 1 to fix behavior when thread count > number of frames in the file */ + av_dict_set(&one_thread_opt, "threads", "1", 0); + for(i=0;inb_streams;i++) { AVCodec *codec; st = ic->streams[i]; @@ -2300,12 +2305,13 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) /* Ensure that subtitle_header is properly set. */ if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE && codec && !st->codec->codec) - avcodec_open2(st->codec, codec, options ? &options[i] : NULL); + avcodec_open2(st->codec, codec, options ? &options[i] : &one_thread_opt); //try to just open decoders, in case this is enough to get parameters if(!has_codec_parameters(st->codec)){ if (codec && !st->codec->codec) - avcodec_open2(st->codec, codec, options ? &options[i] : NULL); + avcodec_open2(st->codec, codec, options ? &options[i] + : &one_thread_opt); } } @@ -2444,7 +2450,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) least one frame of codec data, this makes sure the codec initializes the channel configuration and does not only trust the values from the container. */ - try_decode_frame(st, pkt, (options && i < orig_nb_streams )? &options[i] : NULL); + try_decode_frame(st, pkt, (options && i < orig_nb_streams )? &options[i] + : &one_thread_opt); st->codec_info_nb_frames++; count++; @@ -2549,8 +2556,12 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) #endif find_stream_info_err: - for (i=0; i < ic->nb_streams; i++) + for (i=0; i < ic->nb_streams; i++) { + if (ic->streams[i]->codec) + ic->streams[i]->codec->thread_count = 0; av_freep(&ic->streams[i]->info); + } + av_dict_free(&one_thread_opt); return ret; } From 937ff3a18a637a28e56752b57b6c2f6ed47b04c1 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Sat, 24 Dec 2011 00:04:16 +0100 Subject: [PATCH 4/8] threads: always include necessary headers for number of CPUs detection Since the conditions for the actual usage are more specific a less preferred method can be used. This would cause compilation errors because necessary headers are not included. --- libavcodec/pthread.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index 4356b32192..73d96fca1a 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -34,9 +34,11 @@ #if HAVE_SCHED_GETAFFINITY #define _GNU_SOURCE #include -#elif HAVE_GETSYSTEMINFO +#endif +#if HAVE_GETSYSTEMINFO #include -#elif HAVE_SYSCTL +#endif +#if HAVE_SYSCTL #if HAVE_SYS_PARAM_H #include #endif From bcc73960657538f601dc90076e30df3cc6032569 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Sat, 24 Dec 2011 00:27:12 +0100 Subject: [PATCH 5/8] threads: add sysconf based number of CPUs detection Can act as fallback and should work on a couple of Unix systems. --- configure | 2 ++ libavcodec/pthread.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/configure b/configure index 413c02fae8..b7f0acdc0a 100755 --- a/configure +++ b/configure @@ -1138,6 +1138,7 @@ HAVE_LIST=" symver symver_asm_label symver_gnu_asm + sysconf sysctl sys_mman_h sys_param_h @@ -2858,6 +2859,7 @@ check_func strerror_r check_func strptime check_func strtok_r check_func sched_getaffinity +check_func sysconf check_func sysctl check_func_headers io.h setmode check_func_headers lzo/lzo1x.h lzo1x_999_compress diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index 73d96fca1a..400abf4f6c 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -45,6 +45,9 @@ #include #include #endif +#if HAVE_SYSCONF +#include +#endif #include "avcodec.h" #include "internal.h" @@ -177,6 +180,10 @@ static int get_logical_cpus(AVCodecContext *avctx) ret = sysctl(mib, 2, &nb_cpus, &len, NULL, 0); if (ret == -1) nb_cpus = 0; +#elif HAVE_SYSCONF && defined(_SC_NPROC_ONLN) + nb_cpus = sysconf(_SC_NPROC_ONLN); +#elif HAVE_SYSCONF && defined(_SC_NPROCESSORS_ONLN) + nb_cpus = sysconf(_SC_NPROCESSORS_ONLN); #endif av_log(avctx, AV_LOG_DEBUG, "detected %d logical cores\n", nb_cpus); return FFMIN(nb_cpus, MAX_AUTO_THREADS); From 481a7ff5bd44dc63fcdabe34474a921269c97f99 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sat, 31 Dec 2011 13:36:48 -0500 Subject: [PATCH 6/8] mpegaudiodec: fix compilation when testing the unchecked bitstream reader --- libavcodec/mpegaudiodec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index 0c8f9c787b..63ae455199 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -1548,7 +1548,7 @@ static int mp_decode_layer3(MPADecodeContext *s) memcpy(s->last_buf + s->last_buf_size, ptr, EXTRABYTES); s->in_gb = s->gb; init_get_bits(&s->gb, s->last_buf, s->last_buf_size*8); -#if CONFIG_SAFE_BITSTREAM_READER +#if !UNCHECKED_BITSTREAM_READER s->gb.size_in_bits_plus8 += EXTRABYTES * 8; #endif skip_bits_long(&s->gb, 8*(s->last_buf_size - main_data_begin)); From 464f26889c99f194d112fcf1197795d341fad38b Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Fri, 30 Dec 2011 13:08:21 -0800 Subject: [PATCH 7/8] mpegaudiodec: fix seeking. The safe bitstream reader does not allow using skip_bits_long() to seek to a point before the start of the buffer, which was needed by the mp3 decoder. This change instead calculates the start point of the first valid granule and skips to that position. Signed-off-by: Justin Ruggles --- libavcodec/mpegaudiodec.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index 63ae455199..ad3b199e24 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -1551,25 +1551,27 @@ static int mp_decode_layer3(MPADecodeContext *s) #if !UNCHECKED_BITSTREAM_READER s->gb.size_in_bits_plus8 += EXTRABYTES * 8; #endif - skip_bits_long(&s->gb, 8*(s->last_buf_size - main_data_begin)); + s->last_buf_size <<= 3; + for (gr = 0, ch = 0; gr < nb_granules && (s->last_buf_size >> 3) < main_data_begin; gr++, ch = 0) { + for (; ch < s->nb_channels && (s->last_buf_size >> 3) < main_data_begin; ch++) { + g = &s->granules[ch][gr]; + s->last_buf_size += g->part2_3_length; + memset(g->sb_hybrid, 0, sizeof(g->sb_hybrid)); + } + } + skip_bits_long(&s->gb, s->last_buf_size - 8 * main_data_begin); + if (get_bits_count(&s->gb) >= s->gb.size_in_bits && s->in_gb.buffer) { + skip_bits_long(&s->in_gb, get_bits_count(&s->gb) - s->gb.size_in_bits); + s->gb = s->in_gb; + s->in_gb.buffer = NULL; + } + } else { + gr = ch = 0; } - for (gr = 0; gr < nb_granules; gr++) { - for (ch = 0; ch < s->nb_channels; ch++) { + for (; gr < nb_granules; gr++, ch = 0) { + for (; ch < s->nb_channels; ch++) { g = &s->granules[ch][gr]; - if (get_bits_count(&s->gb) < 0) { - av_log(s->avctx, AV_LOG_DEBUG, "mdb:%d, lastbuf:%d skipping granule %d\n", - main_data_begin, s->last_buf_size, gr); - skip_bits_long(&s->gb, g->part2_3_length); - memset(g->sb_hybrid, 0, sizeof(g->sb_hybrid)); - if (get_bits_count(&s->gb) >= s->gb.size_in_bits && s->in_gb.buffer) { - skip_bits_long(&s->in_gb, get_bits_count(&s->gb) - s->gb.size_in_bits); - s->gb = s->in_gb; - s->in_gb.buffer = NULL; - } - continue; - } - bits_pos = get_bits_count(&s->gb); if (!s->lsf) { From febd022228660cb4b4d0e7b108bfec339b7dce92 Mon Sep 17 00:00:00 2001 From: Oana Stratulat Date: Thu, 29 Dec 2011 22:47:59 +0200 Subject: [PATCH 8/8] FATE: add tests for dfa Signed-off-by: Justin Ruggles --- tests/Makefile | 1 + tests/fate/dfa.mak | 35 +++++++++++++++++++++++++++++++++++ tests/ref/fate/dfa1 | 25 +++++++++++++++++++++++++ tests/ref/fate/dfa10 | 8 ++++++++ tests/ref/fate/dfa11 | 9 +++++++++ tests/ref/fate/dfa2 | 17 +++++++++++++++++ tests/ref/fate/dfa3 | 10 ++++++++++ tests/ref/fate/dfa4 | 13 +++++++++++++ tests/ref/fate/dfa5 | 15 +++++++++++++++ tests/ref/fate/dfa6 | 12 ++++++++++++ tests/ref/fate/dfa7 | 12 ++++++++++++ tests/ref/fate/dfa8 | 36 ++++++++++++++++++++++++++++++++++++ tests/ref/fate/dfa9 | 6 ++++++ 13 files changed, 199 insertions(+) create mode 100644 tests/fate/dfa.mak create mode 100644 tests/ref/fate/dfa1 create mode 100644 tests/ref/fate/dfa10 create mode 100644 tests/ref/fate/dfa11 create mode 100644 tests/ref/fate/dfa2 create mode 100644 tests/ref/fate/dfa3 create mode 100644 tests/ref/fate/dfa4 create mode 100644 tests/ref/fate/dfa5 create mode 100644 tests/ref/fate/dfa6 create mode 100644 tests/ref/fate/dfa7 create mode 100644 tests/ref/fate/dfa8 create mode 100644 tests/ref/fate/dfa9 diff --git a/tests/Makefile b/tests/Makefile index 4c9f958c08..43024eb17f 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -32,6 +32,7 @@ include $(SRC_PATH)/tests/fate/atrac.mak include $(SRC_PATH)/tests/fate/audio.mak include $(SRC_PATH)/tests/fate/dct.mak include $(SRC_PATH)/tests/fate/demux.mak +include $(SRC_PATH)/tests/fate/dfa.mak include $(SRC_PATH)/tests/fate/dpcm.mak include $(SRC_PATH)/tests/fate/ea.mak include $(SRC_PATH)/tests/fate/fft.mak diff --git a/tests/fate/dfa.mak b/tests/fate/dfa.mak new file mode 100644 index 0000000000..1d6bce7fff --- /dev/null +++ b/tests/fate/dfa.mak @@ -0,0 +1,35 @@ +FATE_DFA += fate-dfa1 +fate-dfa1: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0000.dfa + +FATE_DFA += fate-dfa2 +fate-dfa2: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0001.dfa + +FATE_DFA += fate-dfa3 +fate-dfa3: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0002.dfa + +FATE_DFA += fate-dfa4 +fate-dfa4: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0003.dfa + +FATE_DFA += fate-dfa5 +fate-dfa5: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0004.dfa + +FATE_DFA += fate-dfa6 +fate-dfa6: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0005.dfa + +FATE_DFA += fate-dfa7 +fate-dfa7: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0006.dfa + +FATE_DFA += fate-dfa8 +fate-dfa8: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0007.dfa + +FATE_DFA += fate-dfa9 +fate-dfa9: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0008.dfa + +FATE_DFA += fate-dfa10 +fate-dfa10: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0009.dfa + +FATE_DFA += fate-dfa11 +fate-dfa11: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0010.dfa + +FATE_TESTS += $(FATE_DFA) +fate-dfa: $(FATE_DFA) diff --git a/tests/ref/fate/dfa1 b/tests/ref/fate/dfa1 new file mode 100644 index 0000000000..c268367f79 --- /dev/null +++ b/tests/ref/fate/dfa1 @@ -0,0 +1,25 @@ +0, 0, 308224, 0x4eb64db1 +0, 11520, 308224, 0xbdc5595e +0, 23040, 308224, 0x795032b7 +0, 34560, 308224, 0xc808f69e +0, 46080, 308224, 0x8b4376ba +0, 57600, 308224, 0xdfd3be4c +0, 69120, 308224, 0xc2edda1b +0, 80640, 308224, 0x7dd38e7b +0, 92160, 308224, 0x79c08795 +0, 103680, 308224, 0x30e924b1 +0, 115200, 308224, 0xbda01fbb +0, 126720, 308224, 0x7c78d952 +0, 138240, 308224, 0xd4e425f7 +0, 149760, 308224, 0xd0ec4cdf +0, 161280, 308224, 0x8062992a +0, 172800, 308224, 0xd6cbd611 +0, 184320, 308224, 0x1083fe8e +0, 195840, 308224, 0x4efc3e39 +0, 207360, 308224, 0x5d67a998 +0, 218880, 308224, 0xe0ffbc9c +0, 230400, 308224, 0x8e2cc5e0 +0, 241920, 308224, 0x5ad7269f +0, 253440, 308224, 0x6830aad2 +0, 264960, 308224, 0xc8fee524 +0, 276480, 308224, 0xc89e7654 diff --git a/tests/ref/fate/dfa10 b/tests/ref/fate/dfa10 new file mode 100644 index 0000000000..c03df64650 --- /dev/null +++ b/tests/ref/fate/dfa10 @@ -0,0 +1,8 @@ +0, 0, 65024, 0x0a87d009 +0, 6390, 65024, 0x9191399b +0, 12780, 65024, 0x36c8c351 +0, 19170, 65024, 0xc1004a53 +0, 25560, 65024, 0x479625f8 +0, 31950, 65024, 0xdfab5170 +0, 38340, 65024, 0x2fae5741 +0, 44730, 65024, 0x98cea283 diff --git a/tests/ref/fate/dfa11 b/tests/ref/fate/dfa11 new file mode 100644 index 0000000000..22f7740293 --- /dev/null +++ b/tests/ref/fate/dfa11 @@ -0,0 +1,9 @@ +0, 0, 65024, 0xc17b6232 +0, 6390, 65024, 0x6687b1aa +0, 12780, 65024, 0x7a046b14 +0, 19170, 65024, 0x25734b71 +0, 25560, 65024, 0x0bd3519d +0, 31950, 65024, 0x3c84ca25 +0, 38340, 65024, 0x269ba3c7 +0, 44730, 65024, 0xe4e17223 +0, 51120, 65024, 0x4d71b7bc diff --git a/tests/ref/fate/dfa2 b/tests/ref/fate/dfa2 new file mode 100644 index 0000000000..a1c91cec60 --- /dev/null +++ b/tests/ref/fate/dfa2 @@ -0,0 +1,17 @@ +0, 0, 308224, 0x53d98b6d +0, 6390, 308224, 0xcc319665 +0, 12780, 308224, 0x7edb8714 +0, 19170, 308224, 0x8b489159 +0, 25560, 308224, 0x535b8230 +0, 31950, 308224, 0x5db4851e +0, 38340, 308224, 0x29e09995 +0, 44730, 308224, 0x0d1e9546 +0, 51120, 308224, 0xceab7712 +0, 57510, 308224, 0x013f7ac8 +0, 63900, 308224, 0xb701543a +0, 70290, 308224, 0x919b39f3 +0, 76680, 308224, 0x714629a3 +0, 83070, 308224, 0x0e6af89b +0, 89460, 308224, 0x99f7f7e5 +0, 95850, 308224, 0x68d0e08f +0, 102240, 308224, 0x9f08d802 diff --git a/tests/ref/fate/dfa3 b/tests/ref/fate/dfa3 new file mode 100644 index 0000000000..4d92322953 --- /dev/null +++ b/tests/ref/fate/dfa3 @@ -0,0 +1,10 @@ +0, 0, 65024, 0xb65d6443 +0, 9000, 65024, 0x433eb164 +0, 18000, 65024, 0x3ff19134 +0, 27000, 65024, 0x515e185f +0, 36000, 65024, 0x2236fb61 +0, 45000, 65024, 0xcc00194e +0, 54000, 65024, 0xc3618ddb +0, 63000, 65024, 0xe28a1ca4 +0, 72000, 65024, 0xfe584bb4 +0, 81000, 65024, 0xd41e54d8 diff --git a/tests/ref/fate/dfa4 b/tests/ref/fate/dfa4 new file mode 100644 index 0000000000..5dedf1504e --- /dev/null +++ b/tests/ref/fate/dfa4 @@ -0,0 +1,13 @@ +0, 0, 308224, 0xcbf38c88 +0, 12780, 308224, 0x13ca020e +0, 25560, 308224, 0x3d6fba11 +0, 38340, 308224, 0xfd4d9025 +0, 51120, 308224, 0x56536094 +0, 63900, 308224, 0x56536094 +0, 76680, 308224, 0x56536094 +0, 89460, 308224, 0x56536094 +0, 102240, 308224, 0x56536094 +0, 115020, 308224, 0x56536094 +0, 127800, 308224, 0x4f4aaf8f +0, 140580, 308224, 0x07f9ae83 +0, 153360, 308224, 0xd0a068eb diff --git a/tests/ref/fate/dfa5 b/tests/ref/fate/dfa5 new file mode 100644 index 0000000000..1485d3b9b9 --- /dev/null +++ b/tests/ref/fate/dfa5 @@ -0,0 +1,15 @@ +0, 0, 65024, 0x773b2585 +0, 9000, 65024, 0x33c76718 +0, 18000, 65024, 0x0016a365 +0, 27000, 65024, 0x3d6b811d +0, 36000, 65024, 0x53d35d3e +0, 45000, 65024, 0xd3195adc +0, 54000, 65024, 0x904e9492 +0, 63000, 65024, 0x4b905b93 +0, 72000, 65024, 0x97a24d60 +0, 81000, 65024, 0x5738bbd2 +0, 90000, 65024, 0x60c9213f +0, 99000, 65024, 0x2f2966c2 +0, 108000, 65024, 0x5d82ba0e +0, 117000, 65024, 0x3e18fd53 +0, 126000, 65024, 0xf199519d diff --git a/tests/ref/fate/dfa6 b/tests/ref/fate/dfa6 new file mode 100644 index 0000000000..b9f943c434 --- /dev/null +++ b/tests/ref/fate/dfa6 @@ -0,0 +1,12 @@ +0, 0, 65024, 0x78ca2f73 +0, 6390, 65024, 0x7993cfbb +0, 12780, 65024, 0xe43b2c7d +0, 19170, 65024, 0x1b2e754a +0, 25560, 65024, 0xe543704d +0, 31950, 65024, 0x298c7243 +0, 38340, 65024, 0x521720ff +0, 44730, 65024, 0xc49498ab +0, 51120, 65024, 0x00fc4739 +0, 57510, 65024, 0xff03e8d4 +0, 63900, 65024, 0x79c09db5 +0, 70290, 65024, 0xee66fd09 diff --git a/tests/ref/fate/dfa7 b/tests/ref/fate/dfa7 new file mode 100644 index 0000000000..87bf67622c --- /dev/null +++ b/tests/ref/fate/dfa7 @@ -0,0 +1,12 @@ +0, 0, 3648, 0x29484c3c +0, 6390, 3648, 0xa16855bb +0, 12780, 3648, 0x538353d6 +0, 19170, 3648, 0x735b4dfb +0, 25560, 3648, 0x15874bf8 +0, 31950, 3648, 0x96f558fc +0, 38340, 3648, 0xd5715d7e +0, 44730, 3648, 0x33ab5529 +0, 51120, 3648, 0xe7434c9b +0, 57510, 3648, 0x5f2e52a7 +0, 63900, 3648, 0xd32a4b54 +0, 70290, 3648, 0xd3b8547a diff --git a/tests/ref/fate/dfa8 b/tests/ref/fate/dfa8 new file mode 100644 index 0000000000..6f5d3ecfa6 --- /dev/null +++ b/tests/ref/fate/dfa8 @@ -0,0 +1,36 @@ +0, 0, 45932, 0xa55439fb +0, 6390, 45932, 0x071f423f +0, 12780, 45932, 0xf0aac5a9 +0, 19170, 45932, 0x9f3b803b +0, 25560, 45932, 0xeb68e802 +0, 31950, 45932, 0xfa3a994d +0, 38340, 45932, 0x0ed46f09 +0, 44730, 45932, 0x2374f44c +0, 51120, 45932, 0x2dde0a6e +0, 57510, 45932, 0x941e579f +0, 63900, 45932, 0x44ef4c63 +0, 70290, 45932, 0x743aa480 +0, 76680, 45932, 0x4eeb6204 +0, 83070, 45932, 0x60eb012c +0, 89460, 45932, 0x35f34724 +0, 95850, 45932, 0xc7565c42 +0, 102240, 45932, 0x9dc310c3 +0, 108630, 45932, 0x0afac80a +0, 115020, 45932, 0x720112f1 +0, 121410, 45932, 0x59d35a12 +0, 127800, 45932, 0xeadb11c1 +0, 134190, 45932, 0x8a2fb50a +0, 140580, 45932, 0xe730d603 +0, 146970, 45932, 0x8fb0b733 +0, 153360, 45932, 0x644bfddd +0, 159750, 45932, 0x7bec84af +0, 166140, 45932, 0x89892d60 +0, 172530, 45932, 0x9c74e8d4 +0, 178920, 45932, 0x81429e13 +0, 185310, 45932, 0xab80509d +0, 191700, 45932, 0x30914ddc +0, 198090, 45932, 0x925f64c0 +0, 204480, 45932, 0x6e3454bf +0, 210870, 45932, 0x32b072c4 +0, 217260, 45932, 0xae5049a4 +0, 223650, 45932, 0xde749c5a diff --git a/tests/ref/fate/dfa9 b/tests/ref/fate/dfa9 new file mode 100644 index 0000000000..f1de996a60 --- /dev/null +++ b/tests/ref/fate/dfa9 @@ -0,0 +1,6 @@ +0, 0, 77076, 0xd202cc47 +0, 6390, 77076, 0x7cceaf30 +0, 12780, 77076, 0x2baa1d52 +0, 19170, 77076, 0x89b1787a +0, 25560, 77076, 0x252af096 +0, 31950, 77076, 0xc77cff33