Changeset 10e4032179794aa614cf029de90dd3d4b66f15f8
- Timestamp:
- 19/08/08 21:13:22
(4 months ago)
- Author:
- Laurent Aimar <fenrir@videolan.org>
- git-committer:
- Laurent Aimar <fenrir@videolan.org> 1219173202 +0200
- git-parent:
[1e4a18a2156a1bb3743601c0273997a08b56e50a]
- git-author:
- Laurent Aimar <fenrir@videolan.org> 1219172081 +0200
- Message:
Added s32l/b to float conversion support (close #1872).
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r9e50567 |
r10e4032 |
|
| 77 | 77 | static void Do_S24ToFL32( aout_instance_t *, aout_filter_t *, aout_buffer_t *, |
|---|
| 78 | 78 | aout_buffer_t * ); |
|---|
| | 79 | static void Do_S32ToFL32( aout_instance_t *, aout_filter_t *, aout_buffer_t *, |
|---|
| | 80 | aout_buffer_t * ); |
|---|
| 79 | 81 | |
|---|
| 80 | 82 | static int Create_S16ToFL32_SW( vlc_object_t * ); |
|---|
| … | … | |
| 82 | 84 | aout_buffer_t * ); |
|---|
| 83 | 85 | static void Do_S24ToFL32_SW( aout_instance_t *, aout_filter_t *, aout_buffer_t *, |
|---|
| | 86 | aout_buffer_t * ); |
|---|
| | 87 | static void Do_S32ToFL32_SW( aout_instance_t *, aout_filter_t *, aout_buffer_t *, |
|---|
| 84 | 88 | aout_buffer_t * ); |
|---|
| 85 | 89 | |
|---|
| … | … | |
| 394 | 398 | |
|---|
| 395 | 399 | if ( ( p_filter->input.i_format != AOUT_FMT_S16_NE && |
|---|
| 396 | | p_filter->input.i_format != AOUT_FMT_S24_NE ) |
|---|
| | 400 | p_filter->input.i_format != AOUT_FMT_S24_NE && |
|---|
| | 401 | p_filter->input.i_format != AOUT_FMT_S32_NE ) |
|---|
| 397 | 402 | || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') ) |
|---|
| 398 | 403 | { |
|---|
| … | … | |
| 405 | 410 | } |
|---|
| 406 | 411 | |
|---|
| 407 | | if( p_filter->input.i_format == AOUT_FMT_S24_NE ) |
|---|
| | 412 | if( p_filter->input.i_format == AOUT_FMT_S32_NE ) |
|---|
| | 413 | p_filter->pf_do_work = Do_S32ToFL32; |
|---|
| | 414 | else if( p_filter->input.i_format == AOUT_FMT_S24_NE ) |
|---|
| 408 | 415 | p_filter->pf_do_work = Do_S24ToFL32; |
|---|
| 409 | 416 | else |
|---|
| … | … | |
| 443 | 450 | |
|---|
| 444 | 451 | p_out_buf->i_nb_samples = p_in_buf->i_nb_samples; |
|---|
| 445 | | p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * 2; |
|---|
| | 452 | p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * 4 / 2; |
|---|
| 446 | 453 | } |
|---|
| 447 | 454 | |
|---|
| … | … | |
| 472 | 479 | } |
|---|
| 473 | 480 | |
|---|
| | 481 | static void Do_S32ToFL32( aout_instance_t * p_aout, aout_filter_t * p_filter, |
|---|
| | 482 | aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf ) |
|---|
| | 483 | { |
|---|
| | 484 | VLC_UNUSED(p_aout); |
|---|
| | 485 | int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input ); |
|---|
| | 486 | |
|---|
| | 487 | /* We start from the end because b_in_place is true */ |
|---|
| | 488 | int32_t * p_in = (int32_t *)p_in_buf->p_buffer + i - 1; |
|---|
| | 489 | float * p_out = (float *)p_out_buf->p_buffer + i - 1; |
|---|
| | 490 | |
|---|
| | 491 | while( i-- ) |
|---|
| | 492 | { |
|---|
| | 493 | *p_out-- = (float)*p_in-- / 2147483648.0; |
|---|
| | 494 | } |
|---|
| | 495 | |
|---|
| | 496 | p_out_buf->i_nb_samples = p_in_buf->i_nb_samples; |
|---|
| | 497 | p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * 4 / 4; |
|---|
| | 498 | } |
|---|
| | 499 | |
|---|
| 474 | 500 | /***************************************************************************** |
|---|
| 475 | 501 | * S16 To Float32 with endianness conversion |
|---|
| … | … | |
| 505 | 531 | return 0; |
|---|
| 506 | 532 | } |
|---|
| | 533 | |
|---|
| | 534 | if ( (p_filter->input.i_format == VLC_FOURCC('s','3','2','l') || |
|---|
| | 535 | p_filter->input.i_format == VLC_FOURCC('s','3','2','b')) |
|---|
| | 536 | && p_filter->output.i_format == VLC_FOURCC('f','l','3','2') |
|---|
| | 537 | && p_filter->input.i_format != AOUT_FMT_S32_NE ) |
|---|
| | 538 | { |
|---|
| | 539 | p_filter->pf_do_work = Do_S32ToFL32_SW; |
|---|
| | 540 | p_filter->b_in_place = true; |
|---|
| | 541 | |
|---|
| | 542 | return 0; |
|---|
| | 543 | } |
|---|
| | 544 | |
|---|
| 507 | 545 | return -1; |
|---|
| 508 | 546 | } |
|---|
| 509 | 547 | |
|---|
| 510 | 548 | static void Do_S16ToFL32_SW( aout_instance_t * p_aout, aout_filter_t * p_filter, |
|---|
| 511 | | aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf ) |
|---|
| | 549 | aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf ) |
|---|
| 512 | 550 | { |
|---|
| 513 | 551 | VLC_UNUSED(p_aout); |
|---|
| … | … | |
| 552 | 590 | |
|---|
| 553 | 591 | p_out_buf->i_nb_samples = p_in_buf->i_nb_samples; |
|---|
| 554 | | p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * 2; |
|---|
| | 592 | p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * 4 / 2; |
|---|
| 555 | 593 | } |
|---|
| 556 | 594 | |
|---|
| 557 | 595 | static void Do_S24ToFL32_SW( aout_instance_t * p_aout, aout_filter_t * p_filter, |
|---|
| 558 | | aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf ) |
|---|
| | 596 | aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf ) |
|---|
| 559 | 597 | { |
|---|
| 560 | 598 | VLC_UNUSED(p_aout); |
|---|
| … | … | |
| 587 | 625 | } |
|---|
| 588 | 626 | |
|---|
| | 627 | static void Do_S32ToFL32_SW( aout_instance_t * p_aout, aout_filter_t * p_filter, |
|---|
| | 628 | aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf ) |
|---|
| | 629 | { |
|---|
| | 630 | VLC_UNUSED(p_aout); |
|---|
| | 631 | int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input ); |
|---|
| | 632 | |
|---|
| | 633 | /* We start from the end because b_in_place is true */ |
|---|
| | 634 | int32_t * p_in = (int32_t *)p_in_buf->p_buffer + i - 1; |
|---|
| | 635 | float * p_out = (float *)p_out_buf->p_buffer + i - 1; |
|---|
| | 636 | |
|---|
| | 637 | while( i-- ) |
|---|
| | 638 | { |
|---|
| | 639 | *p_out-- = (float)*p_in-- / 2147483648.0; |
|---|
| | 640 | } |
|---|
| | 641 | |
|---|
| | 642 | p_out_buf->i_nb_samples = p_in_buf->i_nb_samples; |
|---|
| | 643 | p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * 4 / 4; |
|---|
| | 644 | } |
|---|
| | 645 | |
|---|
| | 646 | |
|---|
| 589 | 647 | /***************************************************************************** |
|---|
| 590 | 648 | * S8 To FL32 |
|---|