comparison dv.c @ 3968:bf1b4748cd2e libavformat

spelling cosmetics
author diego
date Thu, 02 Oct 2008 16:28:58 +0000
parents a8a70ae19206
children 9709530b68b5
comparison
equal deleted inserted replaced
3967:4fd67f05bad9 3968:bf1b4748cd2e
110 as_pack = dv_extract_pack(frame, dv_audio_source); 110 as_pack = dv_extract_pack(frame, dv_audio_source);
111 if (!as_pack) /* No audio ? */ 111 if (!as_pack) /* No audio ? */
112 return 0; 112 return 0;
113 113
114 smpls = as_pack[1] & 0x3f; /* samples in this frame - min. samples */ 114 smpls = as_pack[1] & 0x3f; /* samples in this frame - min. samples */
115 freq = (as_pack[4] >> 3) & 0x07; /* 0 - 48KHz, 1 - 44,1kHz, 2 - 32 kHz */ 115 freq = (as_pack[4] >> 3) & 0x07; /* 0 - 48kHz, 1 - 44,1kHz, 2 - 32kHz */
116 quant = as_pack[4] & 0x07; /* 0 - 16bit linear, 1 - 12bit nonlinear */ 116 quant = as_pack[4] & 0x07; /* 0 - 16bit linear, 1 - 12bit nonlinear */
117 117
118 if (quant > 1) 118 if (quant > 1)
119 return -1; /* Unsupported quantization */ 119 return -1; /* Unsupported quantization */
120 120
143 if (quant == 0) { /* 16bit quantization */ 143 if (quant == 0) { /* 16bit quantization */
144 of = sys->audio_shuffle[i][j] + (d - 8)/2 * sys->audio_stride; 144 of = sys->audio_shuffle[i][j] + (d - 8)/2 * sys->audio_stride;
145 if (of*2 >= size) 145 if (of*2 >= size)
146 continue; 146 continue;
147 147
148 pcm[of*2] = frame[d+1]; // FIXME: may be we have to admit 148 pcm[of*2] = frame[d+1]; // FIXME: maybe we have to admit
149 pcm[of*2+1] = frame[d]; // that DV is a big endian PCM 149 pcm[of*2+1] = frame[d]; // that DV is a big-endian PCM
150 if (pcm[of*2+1] == 0x80 && pcm[of*2] == 0x00) 150 if (pcm[of*2+1] == 0x80 && pcm[of*2] == 0x00)
151 pcm[of*2+1] = 0; 151 pcm[of*2+1] = 0;
152 } else { /* 12bit quantization */ 152 } else { /* 12bit quantization */
153 lc = ((uint16_t)frame[d] << 4) | 153 lc = ((uint16_t)frame[d] << 4) |
154 ((uint16_t)frame[d+2] >> 4); 154 ((uint16_t)frame[d+2] >> 4);
159 159
160 of = sys->audio_shuffle[i%half_ch][j] + (d - 8)/3 * sys->audio_stride; 160 of = sys->audio_shuffle[i%half_ch][j] + (d - 8)/3 * sys->audio_stride;
161 if (of*2 >= size) 161 if (of*2 >= size)
162 continue; 162 continue;
163 163
164 pcm[of*2] = lc & 0xff; // FIXME: may be we have to admit 164 pcm[of*2] = lc & 0xff; // FIXME: maybe we have to admit
165 pcm[of*2+1] = lc >> 8; // that DV is a big endian PCM 165 pcm[of*2+1] = lc >> 8; // that DV is a big-endian PCM
166 of = sys->audio_shuffle[i%half_ch+half_ch][j] + 166 of = sys->audio_shuffle[i%half_ch+half_ch][j] +
167 (d - 8)/3 * sys->audio_stride; 167 (d - 8)/3 * sys->audio_stride;
168 pcm[of*2] = rc & 0xff; // FIXME: may be we have to admit 168 pcm[of*2] = rc & 0xff; // FIXME: maybe we have to admit
169 pcm[of*2+1] = rc >> 8; // that DV is a big endian PCM 169 pcm[of*2+1] = rc >> 8; // that DV is a big-endian PCM
170 ++d; 170 ++d;
171 } 171 }
172 } 172 }
173 173
174 frame += 16 * 80; /* 15 Video DIFs + 1 Audio DIF */ 174 frame += 16 * 80; /* 15 Video DIFs + 1 Audio DIF */
194 c->ach = 0; 194 c->ach = 0;
195 return 0; 195 return 0;
196 } 196 }
197 197
198 smpls = as_pack[1] & 0x3f; /* samples in this frame - min. samples */ 198 smpls = as_pack[1] & 0x3f; /* samples in this frame - min. samples */
199 freq = (as_pack[4] >> 3) & 0x07; /* 0 - 48KHz, 1 - 44,1kHz, 2 - 32 kHz */ 199 freq = (as_pack[4] >> 3) & 0x07; /* 0 - 48kHz, 1 - 44,1kHz, 2 - 32kHz */
200 stype = (as_pack[3] & 0x1f); /* 0 - 2CH, 2 - 4CH, 3 - 8CH */ 200 stype = (as_pack[3] & 0x1f); /* 0 - 2CH, 2 - 4CH, 3 - 8CH */
201 quant = as_pack[4] & 0x07; /* 0 - 16bit linear, 1 - 12bit nonlinear */ 201 quant = as_pack[4] & 0x07; /* 0 - 16bit linear, 1 - 12bit nonlinear */
202 202
203 /* note: ach counts PAIRS of channels (i.e. stereo channels) */ 203 /* note: ach counts PAIRS of channels (i.e. stereo channels) */
204 if (stype == 3) { 204 if (stype == 3) {