aboutsummaryrefslogtreecommitdiffstats
path: root/etsi_codec-patches/log_stderr.patch
blob: da551ef0f1b2b1a219153fdfead6af8605836a58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
diff -ur codec.orig/c-code/cdecoder.c codec.patched/c-code/cdecoder.c
--- codec.orig/c-code/cdecoder.c	1995-06-06 11:32:14.000000000 +0200
+++ codec.patched/c-code/cdecoder.c	2014-11-18 22:53:06.000000000 +0100
@@ -67,23 +67,23 @@
 	/* Parse arguments */
 	if ( argc != 3 )
 	{
-		puts( "usage : cdecoder input_file output_file" );
-		puts( "format for input_file  : $6B21...114 bits");
-		puts( "       ...$6B22...114..." );
-		puts( "       ...$6B26...114...$6B21");
-		puts( "format for output_file : two 138 (BFI + 137) bit frames");
+		fputs("usage : cdecoder input_file output_file",stderr );
+		fputs("format for input_file  : $6B21...114 bits",stderr);
+		fputs("       ...$6B22...114...",stderr );
+		fputs("       ...$6B26...114...$6B21",stderr);
+		fputs("format for output_file : two 138 (BFI + 137) bit frames",stderr);
 		exit( 1 );
 	}
 
 	if ( (fin = fopen( argv[1], "rb" )) == NULL )
 	{
-		puts("cdecoder: can't open input_file" );
+		fputs("cdecoder: can't open input_file" ,stderr);
 		exit( 1 );
 	}
 
 	if ( (fout = fopen( argv[2], "wb" )) == NULL )
 	{
-		puts("cdecoder: can't open output_file" );
+		fputs("cdecoder: can't open output_file",stderr );
 		exit( 1 );
 	}
 
@@ -93,7 +93,7 @@
 /* read Input_array (1 TETRA frame = 2 speech frames) from input file */
 		if (Read_Tetra_File (fin, Interleaved_coded_array) == -1)
 		  {
-		  puts ("cdecoder: reached end of input_file");
+		  fputs ("cdecoder: reached end of input_file",stderr);
 		  break;
 		  }
 				 
@@ -116,7 +116,7 @@
 in "Coded_array" */
 
 /* Message in case the Frame was stolen */
-		if (bfi1) printf("Frame Nb %ld was stolen\n",Loop_counter+1);
+		if (bfi1) fprintf(stderr,"Frame Nb %ld was stolen\n",Loop_counter+1);
 
 /* Channel Decoding */
 		bfi2 = Channel_Decoding(first_pass,Frame_stealing,
@@ -126,35 +126,35 @@
 /* Increment Loop counter */
 		Loop_counter++;
 /* Message in case the Bad Frame Indicator was set */
-		if (bfi2) printf("Frame Nb %ld Bfi active\n\n",Loop_counter);
+		if (bfi2) fprintf(stderr,"Frame Nb %ld Bfi active\n\n",Loop_counter);
 
 /* writing  Reordered_array to output file */
 			      /* bfi bit */
 		if( fwrite( &bfi1, sizeof(short), 1, fout ) != 1 ) {
-			puts( "cdecoder: can't write to output_file" );
+			fputs( "cdecoder: can't write to output_file",stderr );
 			break;
 		}
 			     /* 1st speech frame */
 		if( fwrite( Reordered_array, sizeof(short), 137, fout ) != 137 )
 		{
-			puts( "cdecoder: can't write to output_file" );
+			fputs("cdecoder: can't write to output_file",stderr );
 			break;
 		}
 			      /* bfi bit */
 		if( fwrite( &bfi2, sizeof(short), 1, fout ) != 1 ) {
-			puts( "cdecoder: can't write to output_file" );
+			fputs("cdecoder: can't write to output_file",stderr );
 			break;
 		}
 			     /* 2nd speech frame */
 		if( fwrite( Reordered_array+137, sizeof(short), 137, fout ) 
 					!= 137 ) {
-			puts( "cdecoder: can't write to output_file" );
+			fputs("cdecoder: can't write to output_file",stderr );
 			break;
 		}
 	}
 		
-	printf("%ld Channel Frames processed\n",Loop_counter);
-	printf("ie %ld Speech Frames\n",2*Loop_counter);
+	fprintf(stderr,"%ld Channel Frames processed\n",Loop_counter);
+	fprintf(stderr,"ie %ld Speech Frames\n",2*Loop_counter);
 	
 	/* closing files */
 	fclose( fin );
diff -ur codec.orig/c-code/sdecoder.c codec.patched/c-code/sdecoder.c
--- codec.orig/c-code/sdecoder.c	1995-06-06 10:55:28.000000000 +0200
+++ codec.patched/c-code/sdecoder.c	2014-11-18 22:53:06.000000000 +0100
@@ -58,15 +58,15 @@
 
   if ( argc != 3 )
   {
-     printf("Usage : sdecoder  serial_file  synth_file\n");
-     printf("\n");
-     printf("Format for serial_file:\n");
-     printf("  Serial stream input is read from a binary file\n");
-     printf("  where each 16-bit word represents 1 encoded bit.\n");
-     printf("  BFI + 137 bits by frame\n");
-     printf("\n");
-     printf("Format for synth_file:\n");
-     printf("  Synthesis is written to a binary file of 16 bits data.\n");
+     fprintf(stderr,"Usage : sdecoder  serial_file  synth_file\n");
+     fprintf(stderr,"\n");
+     fprintf(stderr,"Format for serial_file:\n");
+     fprintf(stderr,"  Serial stream input is read from a binary file\n");
+     fprintf(stderr,"  where each 16-bit word represents 1 encoded bit.\n");
+     fprintf(stderr,"  BFI + 137 bits by frame\n");
+     fprintf(stderr,"\n");
+     fprintf(stderr,"Format for synth_file:\n");
+     fprintf(stderr,"  Synthesis is written to a binary file of 16 bits data.\n");
      exit( 1 );
   }
 
@@ -74,13 +74,13 @@
 
   if( (f_serial = fopen(argv[1],"rb") ) == NULL )
   {
-    printf("Input file '%s' does not exist !!\n",argv[1]);
+    fprintf(stderr,"Input file '%s' does not exist !!\n",argv[1]);
     exit(0);
   }
 
   if( (f_syn = fopen(argv[2], "wb") ) == NULL )
   {
-    printf("Cannot open file '%s' !!\n", argv[2]);
+    fprintf(stderr,"Cannot open file '%s' !!\n", argv[2]);
     exit(0);
   }
 
@@ -95,7 +95,7 @@
 
   while( fread(serial, sizeof(Word16), serial_size, f_serial) == serial_size)
   {
-    printf("frame=%d\n", ++frame);
+    fprintf(stderr,"frame=%d\n", ++frame);
 
     Bits2prm_Tetra(serial, parm);	/* serial to parameters */