diff options
Diffstat (limited to 'apps/codecs/libwavpack/pack.c')
-rw-r--r-- | apps/codecs/libwavpack/pack.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/apps/codecs/libwavpack/pack.c b/apps/codecs/libwavpack/pack.c index 588efccc6f..9ccfa07261 100644 --- a/apps/codecs/libwavpack/pack.c +++ b/apps/codecs/libwavpack/pack.c | |||
@@ -39,7 +39,7 @@ static const signed char fast_terms [] = { 17,17,0 }; | |||
39 | void pack_init (WavpackContext *wpc) | 39 | void pack_init (WavpackContext *wpc) |
40 | { | 40 | { |
41 | WavpackStream *wps = &wpc->stream; | 41 | WavpackStream *wps = &wpc->stream; |
42 | ulong flags = wps->wphdr.flags; | 42 | uint32_t flags = wps->wphdr.flags; |
43 | struct decorr_pass *dpp; | 43 | struct decorr_pass *dpp; |
44 | const signed char *term_string; | 44 | const signed char *term_string; |
45 | int ti; | 45 | int ti; |
@@ -264,19 +264,19 @@ int pack_start_block (WavpackContext *wpc) | |||
264 | return TRUE; | 264 | return TRUE; |
265 | } | 265 | } |
266 | 266 | ||
267 | static void decorr_stereo_pass (struct decorr_pass *dpp, long *bptr, long *eptr, int m); | 267 | static void decorr_stereo_pass (struct decorr_pass *dpp, int32_t *bptr, int32_t *eptr, int m); |
268 | static void decorr_stereo_pass_18 (struct decorr_pass *dpp, long *bptr, long *eptr); | 268 | static void decorr_stereo_pass_18 (struct decorr_pass *dpp, int32_t *bptr, int32_t *eptr); |
269 | static void decorr_stereo_pass_17 (struct decorr_pass *dpp, long *bptr, long *eptr); | 269 | static void decorr_stereo_pass_17 (struct decorr_pass *dpp, int32_t *bptr, int32_t *eptr); |
270 | static void decorr_stereo_pass_m2 (struct decorr_pass *dpp, long *bptr, long *eptr); | 270 | static void decorr_stereo_pass_m2 (struct decorr_pass *dpp, int32_t *bptr, int32_t *eptr); |
271 | 271 | ||
272 | int pack_samples (WavpackContext *wpc, long *buffer, ulong sample_count) | 272 | int pack_samples (WavpackContext *wpc, int32_t *buffer, uint32_t sample_count) |
273 | { | 273 | { |
274 | WavpackStream *wps = &wpc->stream; | 274 | WavpackStream *wps = &wpc->stream; |
275 | ulong flags = wps->wphdr.flags; | 275 | uint32_t flags = wps->wphdr.flags; |
276 | struct decorr_pass *dpp; | 276 | struct decorr_pass *dpp; |
277 | long *bptr, *eptr; | 277 | int32_t *bptr, *eptr; |
278 | int tcount, m; | 278 | int tcount, m; |
279 | ulong crc; | 279 | uint32_t crc; |
280 | 280 | ||
281 | if (!sample_count) | 281 | if (!sample_count) |
282 | return TRUE; | 282 | return TRUE; |
@@ -289,12 +289,12 @@ int pack_samples (WavpackContext *wpc, long *buffer, ulong sample_count) | |||
289 | 289 | ||
290 | if (!(flags & HYBRID_FLAG) && (flags & MONO_FLAG)) | 290 | if (!(flags & HYBRID_FLAG) && (flags & MONO_FLAG)) |
291 | for (bptr = buffer; bptr < eptr;) { | 291 | for (bptr = buffer; bptr < eptr;) { |
292 | long code; | 292 | int32_t code; |
293 | 293 | ||
294 | crc = crc * 3 + (code = *bptr); | 294 | crc = crc * 3 + (code = *bptr); |
295 | 295 | ||
296 | for (tcount = wps->num_terms, dpp = wps->decorr_passes; tcount--; dpp++) { | 296 | for (tcount = wps->num_terms, dpp = wps->decorr_passes; tcount--; dpp++) { |
297 | long sam; | 297 | int32_t sam; |
298 | 298 | ||
299 | if (dpp->term > MAX_TERM) { | 299 | if (dpp->term > MAX_TERM) { |
300 | if (dpp->term & 1) | 300 | if (dpp->term & 1) |
@@ -350,10 +350,10 @@ int pack_samples (WavpackContext *wpc, long *buffer, ulong sample_count) | |||
350 | return TRUE; | 350 | return TRUE; |
351 | } | 351 | } |
352 | 352 | ||
353 | static void decorr_stereo_pass (struct decorr_pass *dpp, long *bptr, long *eptr, int m) | 353 | static void decorr_stereo_pass (struct decorr_pass *dpp, int32_t *bptr, int32_t *eptr, int m) |
354 | { | 354 | { |
355 | int k = (m + dpp->term) & (MAX_TERM - 1); | 355 | int k = (m + dpp->term) & (MAX_TERM - 1); |
356 | long sam; | 356 | int32_t sam; |
357 | 357 | ||
358 | while (bptr < eptr) { | 358 | while (bptr < eptr) { |
359 | dpp->samples_A [k] = bptr [0]; | 359 | dpp->samples_A [k] = bptr [0]; |
@@ -369,9 +369,9 @@ static void decorr_stereo_pass (struct decorr_pass *dpp, long *bptr, long *eptr, | |||
369 | } | 369 | } |
370 | } | 370 | } |
371 | 371 | ||
372 | static void decorr_stereo_pass_18 (struct decorr_pass *dpp, long *bptr, long *eptr) | 372 | static void decorr_stereo_pass_18 (struct decorr_pass *dpp, int32_t *bptr, int32_t *eptr) |
373 | { | 373 | { |
374 | long sam; | 374 | int32_t sam; |
375 | 375 | ||
376 | while (bptr < eptr) { | 376 | while (bptr < eptr) { |
377 | sam = (3 * dpp->samples_A [0] - dpp->samples_A [1]) >> 1; | 377 | sam = (3 * dpp->samples_A [0] - dpp->samples_A [1]) >> 1; |
@@ -389,9 +389,9 @@ static void decorr_stereo_pass_18 (struct decorr_pass *dpp, long *bptr, long *ep | |||
389 | } | 389 | } |
390 | } | 390 | } |
391 | 391 | ||
392 | static void decorr_stereo_pass_m2 (struct decorr_pass *dpp, long *bptr, long *eptr) | 392 | static void decorr_stereo_pass_m2 (struct decorr_pass *dpp, int32_t *bptr, int32_t *eptr) |
393 | { | 393 | { |
394 | long sam_A, sam_B; | 394 | int32_t sam_A, sam_B; |
395 | 395 | ||
396 | for (; bptr < eptr; bptr += 2) { | 396 | for (; bptr < eptr; bptr += 2) { |
397 | sam_A = bptr [1]; | 397 | sam_A = bptr [1]; |
@@ -404,18 +404,18 @@ static void decorr_stereo_pass_m2 (struct decorr_pass *dpp, long *bptr, long *ep | |||
404 | } | 404 | } |
405 | } | 405 | } |
406 | 406 | ||
407 | static void decorr_stereo_pass_17 (struct decorr_pass *dpp, long *bptr, long *eptr) | 407 | static void decorr_stereo_pass_17 (struct decorr_pass *dpp, int32_t *bptr, int32_t *eptr) |
408 | { | 408 | { |
409 | long sam; | 409 | int32_t sam; |
410 | 410 | ||
411 | while (bptr < eptr) { | 411 | while (bptr < eptr) { |
412 | sam = 2 * dpp->samples_A [0] - dpp->samples_A [1]; | 412 | sam = 2 * dpp->samples_A [0] - dpp->samples_A [1]; |
413 | dpp->samples_A [1] = dpp->samples_A [0]; | 413 | dpp->samples_A [1] = dpp->samples_A [0]; |
414 | dpp->samples_A [0] = bptr [0]; | 414 | dpp->samples_A [0] = bptr [0]; |
415 | bptr [0] -= apply_weight_i (dpp->weight_A, sam); | 415 | bptr [0] -= apply_weight_i (dpp->weight_A, sam); |
416 | update_weight (dpp->weight_A, 2, sam, bptr [0]); | 416 | update_weight (dpp->weight_A, 2, sam, bptr [0]); |
417 | bptr++; | 417 | bptr++; |
418 | sam = 2 * dpp->samples_B [0] - dpp->samples_B [1]; | 418 | sam = 2 * dpp->samples_B [0] - dpp->samples_B [1]; |
419 | dpp->samples_B [1] = dpp->samples_B [0]; | 419 | dpp->samples_B [1] = dpp->samples_B [0]; |
420 | dpp->samples_B [0] = bptr [0]; | 420 | dpp->samples_B [0] = bptr [0]; |
421 | bptr [0] -= apply_weight_i (dpp->weight_B, sam); | 421 | bptr [0] -= apply_weight_i (dpp->weight_B, sam); |
@@ -428,7 +428,7 @@ int pack_finish_block (WavpackContext *wpc) | |||
428 | { | 428 | { |
429 | WavpackStream *wps = &wpc->stream; | 429 | WavpackStream *wps = &wpc->stream; |
430 | struct decorr_pass *dpp; | 430 | struct decorr_pass *dpp; |
431 | ulong data_count; | 431 | uint32_t data_count; |
432 | int tcount, m; | 432 | int tcount, m; |
433 | 433 | ||
434 | m = ((WavpackHeader *) wps->blockbuff)->block_samples & (MAX_TERM - 1); | 434 | m = ((WavpackHeader *) wps->blockbuff)->block_samples & (MAX_TERM - 1); |
@@ -436,7 +436,7 @@ int pack_finish_block (WavpackContext *wpc) | |||
436 | if (m) | 436 | if (m) |
437 | for (tcount = wps->num_terms, dpp = wps->decorr_passes; tcount--; dpp++) | 437 | for (tcount = wps->num_terms, dpp = wps->decorr_passes; tcount--; dpp++) |
438 | if (dpp->term > 0 && dpp->term <= MAX_TERM) { | 438 | if (dpp->term > 0 && dpp->term <= MAX_TERM) { |
439 | long temp_A [MAX_TERM], temp_B [MAX_TERM]; | 439 | int32_t temp_A [MAX_TERM], temp_B [MAX_TERM]; |
440 | int k; | 440 | int k; |
441 | 441 | ||
442 | memcpy (temp_A, dpp->samples_A, sizeof (dpp->samples_A)); | 442 | memcpy (temp_A, dpp->samples_A, sizeof (dpp->samples_A)); |
@@ -453,7 +453,7 @@ int pack_finish_block (WavpackContext *wpc) | |||
453 | data_count = bs_close_write (&wps->wvbits); | 453 | data_count = bs_close_write (&wps->wvbits); |
454 | 454 | ||
455 | if (data_count) { | 455 | if (data_count) { |
456 | if (data_count != (ulong) -1) { | 456 | if (data_count != (uint32_t) -1) { |
457 | uchar *cptr = wps->blockbuff + ((WavpackHeader *) wps->blockbuff)->ckSize + 8; | 457 | uchar *cptr = wps->blockbuff + ((WavpackHeader *) wps->blockbuff)->ckSize + 8; |
458 | 458 | ||
459 | *cptr++ = ID_WV_BITSTREAM | ID_LARGE; | 459 | *cptr++ = ID_WV_BITSTREAM | ID_LARGE; |