On Sat, Dec 31, 2011 at 12:18:17AM +0530, Shitiz Garg wrote:
> diff --git a/libavcodec/cook.c b/libavcodec/cook.c
> index 81a1aae..add6be1 100644
log message:
cook: K&R formatting cosmetics
> --- a/libavcodec/cook.c
> +++ b/libavcodec/cook.c
> @@ -273,27 +278,27 @@ static av_cold void init_cplscales_table (COOKContext
> *q) {
> /* 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 ; i<bitamount/64 ; i++)
> - * (int64_t)out[i] = 0x37c511f237c511f2^av_be2ne64(int64_t)in[i]);
> + * for(i = 0; i < bitamount / 64; i++)
> + * (int64_t) out[i] = 0x37c511f237c511f2 ^ av_be2ne64(int64_t)
> in[i]);
> * Buffer alignment needs to be checked. */
for (
> @@ -362,25 +368,26 @@ 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
Try not to move comments too far to the right.
> @@ -415,25 +422,25 @@ static void categorize(COOKContext *q, COOKSubpacket
> *p, int* quant_index_table,
> memset(&exp_index2, 0, sizeof(exp_index2));
> - if(num_bits >= bits_left - 32){
> - bias+=i;
> + if (num_bits >= bits_left - 32) {
> + bias += i;
> }
Drop {} here.
> @@ -441,50 +448,49 @@ static void categorize(COOKContext *q, COOKSubpacket
> *p, int* quant_index_table,
> if (exp_index1[i] < 7) {
> - v = (-2*exp_index1[i]) - quant_index_table[i] + bias;
> - if ( v >= max) {
> + v = (-2 * exp_index1[i]) - quant_index_table[i] + bias;
> + if (v >= max) {
> max = v;
> index = i;
Align the =.
> - if(index==-1)break;
> + if (index == -1) break;
Break this line
> + if (exp_index2[i] > 0) {
> + v = (-2 * exp_index2[i]) - quant_index_table[i] + bias;
> + if (v < min) {
> min = v;
> index = i;
Align the '='.
> @@ -495,11 +501,11 @@ 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 ; i<q->num_vectors ; i++){
> + for (i = 0; i < q->num_vectors; i++) {
> ++category[category_index[i]];
> }
Drop the {}
> @@ -627,18 +632,17 @@ 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];
>
> - memset(&category, 0, sizeof(category));
> + memset(&category, 0, sizeof(category));
> memset(&category_index, 0, sizeof(category_index));
That was done on purpose, keep it.
> @@ -747,9 +749,9 @@ static void imlt_gain(COOKContext *q, float *inbuffer,
> 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 vlc = get_bits1(&q->gb);
> + int start = cplband[p->js_subband_start];
> + int end = cplband[p->subbands - 1];
> int length = end - start + 1;
This was better before.
> @@ -1010,8 +1014,8 @@ static int cook_decode_frame(AVCodecContext *avctx,
> void *data,
>
> - *got_frame_ptr = 1;
> - *(AVFrame *)data = q->frame;
> + *got_frame_ptr = 1;
> + *(AVFrame *) data = q->frame;
This was nicely aligned before.
> @@ -1110,69 +1114,69 @@ 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);
Break this long line.
> q->subpacket[s].joint_stereo = 0;
> switch (q->subpacket[s].cookversion) {
> - 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 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;
> + }
Maybe I cut the diff in the wrong way, but this looks suspicious, please
doublecheck you did not add lines as my cut-down diff implies.
> @@ -1268,7 +1272,6 @@ static av_cold int cook_decode_init(AVCodecContext
> *avctx)
> return 0;
> }
>
> -
> AVCodec ff_cook_decoder =
> {
> .name = "cook",
AVCodec ff_cook_decoder = {
And the '=' should be aligned in the AVCodec declaration.
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel