MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / scan_float

Function scan_float

libavcodec/wavpackenc.c:267–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265}
266
267static int scan_float(WavPackEncodeContext *s,
268 int32_t *samples_l, int32_t *samples_r,
269 int nb_samples)
270{
271 uint32_t crc = 0xffffffffu;
272 int i;
273
274 s->shifted_ones = s->shifted_zeros = s->shifted_both = s->ordata = 0;
275 s->float_shift = s->float_flags = 0;
276 s->false_zeros = s->neg_zeros = 0;
277 s->max_exp = 0;
278
279 if (s->flags & WV_MONO_DATA) {
280 for (i = 0; i < nb_samples; i++) {
281 int32_t f = samples_l[i];
282 crc = crc * 27 + get_mantissa(f) * 9 + get_exponent(f) * 3 + get_sign(f);
283
284 if (get_exponent(f) > s->max_exp && get_exponent(f) < 255)
285 s->max_exp = get_exponent(f);
286 }
287 } else {
288 for (i = 0; i < nb_samples; i++) {
289 int32_t f;
290
291 f = samples_l[i];
292 crc = crc * 27 + get_mantissa(f) * 9 + get_exponent(f) * 3 + get_sign(f);
293 if (get_exponent(f) > s->max_exp && get_exponent(f) < 255)
294 s->max_exp = get_exponent(f);
295
296 f = samples_r[i];
297 crc = crc * 27 + get_mantissa(f) * 9 + get_exponent(f) * 3 + get_sign(f);
298
299 if (get_exponent(f) > s->max_exp && get_exponent(f) < 255)
300 s->max_exp = get_exponent(f);
301 }
302 }
303
304 s->crc_x = crc;
305
306 if (s->flags & WV_MONO_DATA) {
307 for (i = 0; i < nb_samples; i++)
308 process_float(s, &samples_l[i]);
309 } else {
310 for (i = 0; i < nb_samples; i++) {
311 process_float(s, &samples_l[i]);
312 process_float(s, &samples_r[i]);
313 }
314 }
315
316 s->float_max_exp = s->max_exp;
317
318 if (s->shifted_both)
319 s->float_flags |= FLOAT_SHIFT_SENT;
320 else if (s->shifted_ones && !s->shifted_zeros)
321 s->float_flags |= FLOAT_SHIFT_ONES;
322 else if (s->shifted_ones && s->shifted_zeros)
323 s->float_flags |= FLOAT_SHIFT_SAME;
324 else if (s->ordata && !(s->ordata & 1)) {

Callers 1

wavpack_encode_blockFunction · 0.85

Calls 3

process_floatFunction · 0.85
shift_monoFunction · 0.85
shift_stereoFunction · 0.85

Tested by

no test coverage detected