Changeset 524254f836416fba567be30b2b168d63811fb3a5
- Timestamp:
- 21/10/05 00:37:14
(3 years ago)
- Author:
- Scott Caudle <zcot@videolan.org>
- git-committer:
- Scott Caudle <zcot@videolan.org> 1129847834 +0000
- git-parent:
[46d8d47a755832d9153d40825eefdfd5cd4737f5]
- git-author:
- Scott Caudle <zcot@videolan.org> 1129847834 +0000
- Message:
updates spectrometer visualization. some optimization tweaks and additional features.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r661e782 |
r524254f |
|
| 397 | 397 | |
|---|
| 398 | 398 | p_buffs = p_s16_buff; |
|---|
| 399 | | //i_nb_bands = config_GetInt ( p_aout, "visual-nbbands" ); |
|---|
| 400 | | //i_separ = config_GetInt( p_aout, "visual-separ" ); |
|---|
| 401 | | //i_amp = config_GetInt ( p_aout, "visual-amp" ); |
|---|
| 402 | | //i_peak = config_GetInt ( p_aout, "visual-peaks" ); |
|---|
| 403 | | /* previous 4 vars changed.. using them as `spect' variables */ |
|---|
| 404 | 399 | i_original = config_GetInt ( p_aout, "spect-show-original" ); |
|---|
| 405 | 400 | i_nb_bands = config_GetInt ( p_aout, "spect-nbbands" ); |
|---|
| … | … | |
| 421 | 416 | else |
|---|
| 422 | 417 | { |
|---|
| 423 | | i_nb_bands = 80; |
|---|
| | 418 | if( i_nb_bands > 80 ) |
|---|
| | 419 | i_nb_bands = 80; |
|---|
| 424 | 420 | xscale = xscale2; |
|---|
| 425 | 421 | } |
|---|
| 426 | | i_nb_bands *= i_sections; |
|---|
| 427 | | /* whoops, dont malloc the following memory for all the duplicated bands.. |
|---|
| 428 | | -only the original 20 or 80 will be fine */ |
|---|
| 429 | 422 | |
|---|
| 430 | 423 | if( !p_effect->p_data ) |
|---|
| … | … | |
| 447 | 440 | } |
|---|
| 448 | 441 | |
|---|
| 449 | | |
|---|
| 450 | 442 | height = (int *)malloc( i_nb_bands * sizeof(int) ); |
|---|
| 451 | 443 | if( !height) |
|---|
| … | … | |
| 454 | 446 | return -1; |
|---|
| 455 | 447 | } |
|---|
| | 448 | |
|---|
| 456 | 449 | /* Convert the buffer to int16_t */ |
|---|
| 457 | 450 | /* Pasted from float32tos16.c */ |
|---|
| … | … | |
| 482 | 475 | for(i= 0; i< FFT_BUFFER_SIZE ; i++ ) |
|---|
| 483 | 476 | p_dest[i] = ( (int) sqrt( p_output [ i + 1 ] ) ) >> 8; |
|---|
| | 477 | |
|---|
| | 478 | i_nb_bands *= i_sections; |
|---|
| 484 | 479 | |
|---|
| 485 | 480 | for ( i = 0 ; i< i_nb_bands/i_sections ;i++) |
|---|
| … | … | |
| 661 | 656 | |
|---|
| 662 | 657 | *(p_picture->p[1].p_pixels + x + y * p_picture->p[1].i_pitch |
|---|
| 663 | | - p_picture->p[1].i_pitch |
|---|
| 664 | 658 | ) = 0;/* U(R,G,B); */ |
|---|
| 665 | 659 | |
|---|
| … | … | |
| 668 | 662 | if ( 0x04 * (i_line + k ) -0x0f < 0xff) |
|---|
| 669 | 663 | *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch |
|---|
| 670 | | - p_picture->p[2].i_pitch |
|---|
| 671 | 664 | ) = ( 0x04 * ( i_line + k ) ) -(color1-1);/* -V(R,G,B); */ |
|---|
| 672 | 665 | else |
|---|
| 673 | 666 | *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch |
|---|
| 674 | | - p_picture->p[2].i_pitch |
|---|
| 675 | 667 | ) = 255;/* V(R,G,B); */ |
|---|
| 676 | 668 | } |
|---|
| … | … | |
| 678 | 670 | { |
|---|
| 679 | 671 | *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch |
|---|
| 680 | | - p_picture->p[2].i_pitch |
|---|
| 681 | 672 | ) = color1;/* V(R,G,B); */ |
|---|
| 682 | 673 | } |
|---|
| … | … | |
| 706 | 697 | |
|---|
| 707 | 698 | *(p_picture->p[1].p_pixels + x + y * p_picture->p[1].i_pitch |
|---|
| 708 | | - p_picture->p[1].i_pitch |
|---|
| 709 | 699 | ) = 0;/* U(R,G,B); */ |
|---|
| 710 | 700 | |
|---|
| … | … | |
| 713 | 703 | if( 0x04 * i_line -0x0f < 0xff) |
|---|
| 714 | 704 | *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch |
|---|
| 715 | | - p_picture->p[2].i_pitch |
|---|
| 716 | 705 | ) = ( 0x04 * i_line) -(color1-1);/* -V(R,G,B); */ |
|---|
| 717 | 706 | else |
|---|
| 718 | 707 | *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch |
|---|
| 719 | | - p_picture->p[2].i_pitch |
|---|
| 720 | 708 | ) = 255;/* V(R,G,B); */ |
|---|
| 721 | 709 | } |
|---|
| … | … | |
| 723 | 711 | { |
|---|
| 724 | 712 | *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch |
|---|
| 725 | | - p_picture->p[2].i_pitch |
|---|
| 726 | 713 | ) = color1;/* V(R,G,B); */ |
|---|
| 727 | 714 | } |
|---|
| … | … | |
| 756 | 743 | |
|---|
| 757 | 744 | *(p_picture->p[1].p_pixels + x + y * p_picture->p[1].i_pitch |
|---|
| 758 | | - p_picture->p[1].i_pitch |
|---|
| 759 | 745 | ) = 0; |
|---|
| 760 | 746 | |
|---|
| … | … | |
| 763 | 749 | if ( 0x04 * i_line -0x0f < 0xff) |
|---|
| 764 | 750 | *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch |
|---|
| 765 | | - p_picture->p[2].i_pitch |
|---|
| 766 | 751 | ) = ( 0x04 * i_line) -(color1-1); |
|---|
| 767 | 752 | else |
|---|
| 768 | 753 | *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch |
|---|
| 769 | | - p_picture->p[2].i_pitch |
|---|
| 770 | 754 | ) = 255; |
|---|
| 771 | 755 | } |
|---|
| … | … | |
| 773 | 757 | { |
|---|
| 774 | 758 | *(p_picture->p[2].p_pixels + x + y * p_picture->p[2].i_pitch |
|---|
| 775 | | - p_picture->p[2].i_pitch |
|---|
| 776 | 759 | ) = color1; |
|---|
| 777 | 760 | } |
|---|
| r2b6826a |
r524254f |
|
| 52 | 52 | #define NBBANDS_LONGTEXT N_( \ |
|---|
| 53 | 53 | "Number of bands used by spectrum analyzer, should be 20 or 80." ) |
|---|
| | 54 | #define SPNBBANDS_LONGTEXT N_( \ |
|---|
| | 55 | "Number of bands used by the spectrOmeter, from 20 to 80." ) |
|---|
| 54 | 56 | |
|---|
| 55 | 57 | #define SEPAR_TEXT N_( "Band separator" ) |
|---|
| … | … | |
| 126 | 128 | PEAKS_TEXT, PEAKS_LONGTEXT, VLC_TRUE ); |
|---|
| 127 | 129 | set_section( N_("Spectrometer") , NULL ); |
|---|
| 128 | | add_bool("spect-show-original", VLC_TRUE, NULL, |
|---|
| | 130 | add_bool("spect-show-original", VLC_FALSE, NULL, |
|---|
| 129 | 131 | ORIG_TEXT, ORIG_LONGTEXT, VLC_TRUE ); |
|---|
| 130 | 132 | add_bool("spect-show-base", VLC_TRUE, NULL, |
|---|
| 131 | 133 | BASE_TEXT, BASE_LONGTEXT, VLC_TRUE ); |
|---|
| 132 | | add_integer("spect-radius", 22, NULL, |
|---|
| | 134 | add_integer("spect-radius", 42, NULL, |
|---|
| 133 | 135 | RADIUS_TEXT, RADIUS_LONGTEXT, VLC_TRUE ); |
|---|
| 134 | | add_integer("spect-sections", 2, NULL, |
|---|
| | 136 | add_integer("spect-sections", 3, NULL, |
|---|
| 135 | 137 | SECT_TEXT, SECT_LONGTEXT, VLC_TRUE ); |
|---|
| 136 | | add_integer("spect-color", 16, NULL, |
|---|
| | 138 | add_integer("spect-color", 80, NULL, |
|---|
| 137 | 139 | COLOR1_TEXT, COLOR1_LONGTEXT, VLC_TRUE ); |
|---|
| 138 | 140 | add_bool("spect-show-bands", VLC_TRUE, NULL, |
|---|
| 139 | 141 | BANDS_TEXT, BANDS_LONGTEXT, VLC_TRUE ); |
|---|
| 140 | | add_integer("spect-nbbands", 80, NULL, |
|---|
| 141 | | NBBANDS_TEXT, NBBANDS_LONGTEXT, VLC_TRUE ); |
|---|
| | 142 | add_integer("spect-nbbands", 32, NULL, |
|---|
| | 143 | NBBANDS_TEXT, SPNBBANDS_LONGTEXT, VLC_TRUE ); |
|---|
| 142 | 144 | add_integer("spect-separ", 1, NULL, |
|---|
| 143 | 145 | SEPAR_TEXT, SEPAR_LONGTEXT, VLC_TRUE ); |
|---|
| 144 | | add_integer("spect-amp", 3, NULL, |
|---|
| | 146 | add_integer("spect-amp", 8, NULL, |
|---|
| 145 | 147 | AMP_TEXT, AMP_LONGTEXT, VLC_TRUE ); |
|---|
| 146 | 148 | add_bool("spect-show-peaks", VLC_TRUE, NULL, |
|---|
| 147 | 149 | PEAKS_TEXT, PEAKS_LONGTEXT, VLC_TRUE ); |
|---|
| 148 | | add_integer("spect-peak-width", 1, NULL, |
|---|
| | 150 | add_integer("spect-peak-width", 61, NULL, |
|---|
| 149 | 151 | PEAK_WIDTH_TEXT, PEAK_WIDTH_LONGTEXT, VLC_TRUE ); |
|---|
| 150 | 152 | add_integer("spect-peak-height", 1, NULL, |
|---|