[MPlayer-dev-eng] [patch] upgrade k&r style function decls to ansi c

Stefan Huehner stefan at huehner.org
Sat Jul 15 19:24:43 CEST 2006


Hi,

attached patch converts K&R style function declarations to ansi C.

As the were comments on the parameters embedded in the removed lines,
some of them were converted to pure commentary lines.
Please check if this style is acceptable and provide info otherwise.

regards,
Stefan

-------------- next part --------------
Index: libmpcodecs/native/xa_gsm.c
===================================================================
--- libmpcodecs/native/xa_gsm.c	(revision 19109)
+++ libmpcodecs/native/xa_gsm.c	(working copy)
@@ -33,9 +33,10 @@
 #include "xa_gsm_int.h"
 
 //void XA_MSGSM_Decoder();
-static void GSM_Decode();
-static void Gsm_RPE_Decoding();
+static void GSM_Decode(XA_GSM_STATE *S, word *LARcr, word *Ncr, word *bcr, word *Mcr, word *xmaxcr, word *xMcr, word *s);
+static void Gsm_RPE_Decoding (XA_GSM_STATE *S, word xmaxcr, word Mcr, word *xMcr, word *erp);
 
+
 //static short gsm_buf[320];
 static XA_GSM_STATE gsm_state;
 
@@ -64,18 +65,14 @@
         ((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x))
 
 /****************/
-static word gsm_sub (a,b)
-word a;
-word b;
+static word gsm_sub (word a, word b)
 {
         longword diff = (longword)a - (longword)b;
         return saturate(diff);
 }
 
 /****************/
-static word gsm_asr (a,n)
-word a; 
-int n;
+static word gsm_asr (word a, int n)
 {
         if (n >= 16) return -(a < 0);
         if (n <= -16) return 0;
@@ -90,9 +87,7 @@
 }
 
 /****************/
-static word gsm_asl (a,n)
-word a; 
-int n;
+static word gsm_asl (word a, int n)
 {
         if (n >= 16) return 0;
         if (n <= -16) return -(a < 0);
@@ -108,10 +103,11 @@
  */
 
 /**** 4.2.17 */
-static void RPE_grid_positioning(Mc,xMp,ep)
-word            Mc;             /* grid position        IN      */
-register word   * xMp;          /* [0..12]              IN      */
-register word   * ep;           /* [0..39]              OUT     */
+static void RPE_grid_positioning(word Mc, register word *xMp, register word *ep)
+/* Mc	grid position        IN      */
+/* xMp 	[0..12]              IN      */
+/* ep	[0..39]              OUT     */
+
 /*
  *  This procedure computes the reconstructed long term residual signal
  *  ep[0..39] for the LTP analysis filter.  The inputs are the Mc
@@ -146,11 +142,10 @@
 
 
 /**** 4.2.16 */
-static void APCM_inverse_quantization (xMc,mant,exp,xMp)
-register word   * xMc;  /* [0..12]                      IN      */
-word            mant;
-word            exp;
-register word   * xMp;  /* [0..12]                      OUT     */
+static void APCM_inverse_quantization (register word *xMc, word mant, word exp, register word *xMp)
+/* xMc	[0..12]                      IN      */
+/* xMp	[0..12]                      OUT     */
+
 /* 
  *  This part is for decoding the RPE sequence of coded xMc[0..12]
  *  samples to obtain the xMp[0..12] array.  Table 4.6 is used to get
@@ -184,10 +179,10 @@
 
 
 /**** 4.12.15 */
-static void APCM_quantization_xmaxc_to_exp_mant (xmaxc,exp_out,mant_out)
-word            xmaxc;          /* IN   */
-word            * exp_out;      /* OUT  */
-word            * mant_out;    /* OUT  */
+static void APCM_quantization_xmaxc_to_exp_mant (word xmaxc, word *exp_out, word *mant_out)
+/* xmaxc	IN   */
+/* exp_out	OUT  */
+/* mant_out	OUT  */
 {
   word    exp, mant;
 
@@ -217,12 +212,9 @@
         *mant_out = mant;
 }
 
-static void Gsm_RPE_Decoding (S, xmaxcr, Mcr, xMcr, erp)
-XA_GSM_STATE        * S;
-word            xmaxcr;
-word            Mcr;
-word            * xMcr;  /* [0..12], 3 bits             IN      */
-word            * erp;   /* [0..39]                     OUT     */
+static void Gsm_RPE_Decoding (XA_GSM_STATE *S, word xmaxcr, word Mcr, word *xMcr, word *erp)
+/* xMcr	[0..12], 3 bits             IN      */
+/* erp		[0..39]                     OUT     */
 
 {
         word    exp, mant;
@@ -239,9 +231,7 @@
  *  4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER
  */
 
-static void Postprocessing(S,s)
-XA_GSM_STATE	* S;
-register word 	* s;
+static void Postprocessing(XA_GSM_STATE *S, register word *s)
 {
   register int		k;
   register word		msr = S->msr;
@@ -258,12 +248,9 @@
 }
 
 /**** 4.3.2 */
-void Gsm_Long_Term_Synthesis_Filtering (S,Ncr,bcr,erp,drp)
-XA_GSM_STATE        * S;
-word                    Ncr;
-word                    bcr;
-register word           * erp;     /* [0..39]                    IN */
-register word           * drp;     /* [-120..-1] IN, [-120..40] OUT */
+void Gsm_Long_Term_Synthesis_Filtering (XA_GSM_STATE *S, word Ncr, word bcr, register word *erp, register word *drp)
+/* erp	[0..39]                    IN */
+/* drp	[-120..-1] IN, [-120..40] OUT */
 
 /*
  *  This procedure uses the bcr and Ncr parameter to realize the
@@ -303,12 +290,11 @@
         for (k = 0; k <= 119; k++) drp[ -120 + k ] = drp[ -80 + k ];
 }
 
-static void Short_term_synthesis_filtering (S,rrp,k,wt,sr)
-XA_GSM_STATE *S;
-register word   *rrp;  /* [0..7]       IN      */
-register int    k;      /* k_end - k_start      */
-register word   *wt;   /* [0..k-1]     IN      */
-register word   *sr;   /* [0..k-1]     OUT     */
+static void Short_term_synthesis_filtering (XA_GSM_STATE *S, register word *rrp, register int k, register word *wt, register word *sr)
+/* rrp	[0..7]       IN      */
+/* k	k_end - k_start      */
+/* wt	[0..k-1]     IN      */
+/* sr	[0..k-1]     OUT     */
 {
         register word           * v = S->v;
         register int            i;
@@ -345,9 +331,9 @@
 
 /* 4.2.8 */
 
-static void Decoding_of_the_coded_Log_Area_Ratios (LARc,LARpp)
-word    * LARc;         /* coded log area ratio [0..7]  IN      */
-word    * LARpp;        /* out: decoded ..                      */
+static void Decoding_of_the_coded_Log_Area_Ratios (word *LARc, word *LARpp)
+/* LARc		coded log area ratio [0..7]  IN      */
+/* LARpp	out: decoded ..                      */
 {
         register word   temp1 /* , temp2 */;
         register long   ltmp;   /* for GSM_ADD */
@@ -413,10 +399,7 @@
  * (Initial value: LARpp(j-1)[1..8] = 0.)
  */
 
-static void Coefficients_0_12 (LARpp_j_1, LARpp_j, LARp)
-register word * LARpp_j_1;
-register word * LARpp_j;
-register word * LARp;
+static void Coefficients_0_12 (register word *LARpp_j_1, register word *LARpp_j, register word *LARp)
 {
         register int    i;
         register longword ltmp;
@@ -427,10 +410,7 @@
         }
 }
 
-static void Coefficients_13_26 (LARpp_j_1, LARpp_j, LARp)
-register word * LARpp_j_1;
-register word * LARpp_j;
-register word * LARp;
+static void Coefficients_13_26 (register word *LARpp_j_1, register word *LARpp_j, register word *LARp)
 {
         register int i;
         register longword ltmp;
@@ -439,10 +419,7 @@
         }
 }
 
-static void Coefficients_27_39 (LARpp_j_1, LARpp_j, LARp)
-register word * LARpp_j_1;
-register word * LARpp_j;
-register word * LARp;
+static void Coefficients_27_39 (register word *LARpp_j_1, register word *LARpp_j, register word *LARp)
 {
         register int i;
         register longword ltmp;
@@ -454,9 +431,7 @@
 }
 
 
-static void Coefficients_40_159 (LARpp_j, LARp)
-register word * LARpp_j;
-register word * LARp;
+static void Coefficients_40_159 (register word *LARpp_j, register word *LARp)
 {
         register int i;
 
@@ -465,8 +440,9 @@
 }
 /* 4.2.9.2 */
 
-static void LARp_to_rp (LARp)
-register word * LARp;   /* [0..7] IN/OUT  */
+static void LARp_to_rp (register word *LARp)
+/* LARp	[0..7] IN/OUT  */
+
 /*
  *  The input of this procedure is the interpolated LARp[0..7] array.
  *  The reflection coefficients, rp[i], are used in the analysis
@@ -507,11 +483,10 @@
 
 
 /**** */
-static void Gsm_Short_Term_Synthesis_Filter (S, LARcr, wt, s)
-XA_GSM_STATE * S;
-word    * LARcr;        /* received log area ratios [0..7] IN  */
-word    * wt;           /* received d [0..159]             IN  */
-word    * s;            /* signal   s [0..159]            OUT  */
+static void Gsm_Short_Term_Synthesis_Filter (XA_GSM_STATE *S, word *LARcr, word *wt, word *s)
+/* LARcr	received log area ratios [0..7] IN  */
+/* wt		received d [0..159]             IN  */
+/* s		signal   s [0..159]            OUT  */
 {
         word            * LARpp_j       = S->LARpp[ S->j     ];
         word            * LARpp_j_1     = S->LARpp[ S->j ^=1 ];
@@ -550,15 +525,14 @@
 
 
 
-static void GSM_Decode(S,LARcr, Ncr,bcr,Mcr,xmaxcr,xMcr,s)
-XA_GSM_STATE	*S;
-word		*LARcr;		/* [0..7]		IN	*/
-word		*Ncr;		/* [0..3] 		IN 	*/
-word		*bcr;		/* [0..3]		IN	*/
-word		*Mcr;		/* [0..3] 		IN 	*/
-word		*xmaxcr;	/* [0..3]		IN 	*/
-word		*xMcr;		/* [0..13*4]		IN	*/
-word		*s;		/* [0..159]		OUT 	*/
+static void GSM_Decode(XA_GSM_STATE *S, word *LARcr, word *Ncr, word *bcr, word *Mcr, word *xmaxcr, word *xMcr, word *s)
+/* LARcr	[0..7]		IN	*/
+/* Ncr		[0..3] 		IN 	*/
+/* bcr		[0..3]		IN	*/
+/* Mcr		[0..3] 		IN 	*/
+/* xmaxcr	[0..3]		IN 	*/
+/* xMcr		[0..13*4]		IN	*/
+/* s		[0..159]		OUT 	*/
 {
   int		j, k;
   word		erp[40], wt[160];


More information about the MPlayer-dev-eng mailing list