1 /*****************************************************************************
2 * headphone.c : headphone virtual spatialization channel mixer module
3 * -> gives the feeling of a real room with a simple headphone
4 *****************************************************************************
5 * Copyright (C) 2002-2006 the VideoLAN team
8 * Authors: Boris Dorès <babal@via.ecp.fr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
28 #include <math.h> /* sqrt */
35 #include <vlc_plugin.h>
37 #include <vlc_filter.h>
38 #include <vlc_block.h>
40 /*****************************************************************************
42 *****************************************************************************/
43 static int Create ( vlc_object_t * );
44 static void Destroy ( vlc_object_t * );
46 static void DoWork ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
50 static int OpenFilter ( vlc_object_t * );
51 static void CloseFilter( vlc_object_t * );
52 static block_t *Convert( filter_t *, block_t * );
54 /*****************************************************************************
56 *****************************************************************************/
57 #define MODULE_DESCRIPTION N_ ( \
58 "This effect gives you the feeling that you are standing in a room " \
59 "with a complete 7.1 speaker set when using only a headphone, " \
60 "providing a more realistic sound experience. It should also be " \
61 "more comfortable and less tiring when listening to music for " \
62 "long periods of time.\nIt works with any source format from mono " \
65 #define HEADPHONE_DIM_TEXT N_("Characteristic dimension")
66 #define HEADPHONE_DIM_LONGTEXT N_( \
67 "Distance between front left speaker and listener in meters.")
69 #define HEADPHONE_COMPENSATE_TEXT N_("Compensate delay")
70 #define HEADPHONE_COMPENSATE_LONGTEXT N_( \
71 "The delay which is introduced by the physical algorithm may "\
72 "sometimes be disturbing for the synchronization between lips-movement "\
73 "and speech. In case, turn this on to compensate.")
75 #define HEADPHONE_DOLBY_TEXT N_("No decoding of Dolby Surround")
76 #define HEADPHONE_DOLBY_LONGTEXT N_( \
77 "Dolby Surround encoded streams won't be decoded before being " \
78 "processed by this filter. Enabling this setting is not recommended.")
81 set_description( N_("Headphone virtual spatialization effect") );
82 set_shortname( N_("Headphone effect") );
83 set_help( MODULE_DESCRIPTION );
84 set_category( CAT_AUDIO );
85 set_subcategory( SUBCAT_AUDIO_AFILTER );
87 add_integer( "headphone-dim", 10, NULL, HEADPHONE_DIM_TEXT,
88 HEADPHONE_DIM_LONGTEXT, false );
89 add_bool( "headphone-compensate", 0, NULL, HEADPHONE_COMPENSATE_TEXT,
90 HEADPHONE_COMPENSATE_LONGTEXT, true );
91 add_bool( "headphone-dolby", 0, NULL, HEADPHONE_DOLBY_TEXT,
92 HEADPHONE_DOLBY_LONGTEXT, true );
94 set_capability( "audio filter", 0 );
95 set_callbacks( Create, Destroy );
96 add_shortcut( "headphone" );
100 set_description( N_("Headphone virtual spatialization effect") );
101 set_capability( "audio filter2", 0 );
102 set_callbacks( OpenFilter, CloseFilter );
106 /*****************************************************************************
107 * Internal data structures
108 *****************************************************************************/
109 struct atomic_operation_t
111 int i_source_channel_offset;
112 int i_dest_channel_offset;
113 unsigned int i_delay;/* in sample unit */
114 double d_amplitude_factor;
117 struct aout_filter_sys_t
119 size_t i_overflow_buffer_size;/* in bytes */
120 uint8_t * p_overflow_buffer;
121 unsigned int i_nb_atomic_operations;
122 struct atomic_operation_t * p_atomic_operations;
127 size_t i_overflow_buffer_size;/* in bytes */
128 uint8_t * p_overflow_buffer;
129 unsigned int i_nb_atomic_operations;
130 struct atomic_operation_t * p_atomic_operations;
133 /*****************************************************************************
134 * Init: initialize internal data structures
135 * and computes the needed atomic operations
136 *****************************************************************************/
137 /* x and z represent the coordinates of the virtual speaker
138 * relatively to the center of the listener's head, measured in meters :
147 * rear left rear right
151 static void ComputeChannelOperations( struct aout_filter_sys_t * p_data
152 , unsigned int i_rate, unsigned int i_next_atomic_operation
153 , int i_source_channel_offset, double d_x, double d_z
154 , double d_compensation_length, double d_channel_amplitude_factor )
156 double d_c = 340; /*sound celerity (unit: m/s)*/
157 double d_compensation_delay = (d_compensation_length-0.1) / d_c * i_rate;
160 p_data->p_atomic_operations[i_next_atomic_operation]
161 .i_source_channel_offset = i_source_channel_offset;
162 p_data->p_atomic_operations[i_next_atomic_operation]
163 .i_dest_channel_offset = 0;/* left */
164 p_data->p_atomic_operations[i_next_atomic_operation]
165 .i_delay = (int)( sqrt( (-0.1-d_x)*(-0.1-d_x) + (0-d_z)*(0-d_z) )
166 / d_c * i_rate - d_compensation_delay );
169 p_data->p_atomic_operations[i_next_atomic_operation]
170 .d_amplitude_factor = d_channel_amplitude_factor * 1.1 / 2;
174 p_data->p_atomic_operations[i_next_atomic_operation]
175 .d_amplitude_factor = d_channel_amplitude_factor * 0.9 / 2;
179 p_data->p_atomic_operations[i_next_atomic_operation]
180 .d_amplitude_factor = d_channel_amplitude_factor / 2;
184 p_data->p_atomic_operations[i_next_atomic_operation + 1]
185 .i_source_channel_offset = i_source_channel_offset;
186 p_data->p_atomic_operations[i_next_atomic_operation + 1]
187 .i_dest_channel_offset = 1;/* right */
188 p_data->p_atomic_operations[i_next_atomic_operation + 1]
189 .i_delay = (int)( sqrt( (0.1-d_x)*(0.1-d_x) + (0-d_z)*(0-d_z) )
190 / d_c * i_rate - d_compensation_delay );
193 p_data->p_atomic_operations[i_next_atomic_operation + 1]
194 .d_amplitude_factor = d_channel_amplitude_factor * 0.9 / 2;
198 p_data->p_atomic_operations[i_next_atomic_operation + 1]
199 .d_amplitude_factor = d_channel_amplitude_factor * 1.1 / 2;
203 p_data->p_atomic_operations[i_next_atomic_operation + 1]
204 .d_amplitude_factor = d_channel_amplitude_factor / 2;
208 static int Init( vlc_object_t *p_this, struct aout_filter_sys_t * p_data
209 , unsigned int i_nb_channels, uint32_t i_physical_channels
210 , unsigned int i_rate )
212 double d_x = config_GetInt( p_this, "headphone-dim" );
214 double d_z_rear = -d_x/3;
216 unsigned int i_next_atomic_operation;
217 int i_source_channel_offset;
222 msg_Dbg( p_this, "passing a null pointer as argument" );
226 if( config_GetInt( p_this, "headphone-compensate" ) )
228 /* minimal distance to any speaker */
229 if( i_physical_channels & AOUT_CHAN_REARCENTER )
239 /* Number of elementary operations */
240 p_data->i_nb_atomic_operations = i_nb_channels * 2;
241 if( i_physical_channels & AOUT_CHAN_CENTER )
243 p_data->i_nb_atomic_operations += 2;
245 p_data->p_atomic_operations = malloc( sizeof(struct atomic_operation_t)
246 * p_data->i_nb_atomic_operations );
247 if( p_data->p_atomic_operations == NULL )
249 msg_Err( p_this, "out of memory" );
253 /* For each virtual speaker, computes elementary wave propagation time
255 i_next_atomic_operation = 0;
256 i_source_channel_offset = 0;
257 if( i_physical_channels & AOUT_CHAN_LEFT )
259 ComputeChannelOperations( p_data , i_rate
260 , i_next_atomic_operation , i_source_channel_offset
261 , -d_x , d_z , d_min , 2.0 / i_nb_channels );
262 i_next_atomic_operation += 2;
263 i_source_channel_offset++;
265 if( i_physical_channels & AOUT_CHAN_RIGHT )
267 ComputeChannelOperations( p_data , i_rate
268 , i_next_atomic_operation , i_source_channel_offset
269 , d_x , d_z , d_min , 2.0 / i_nb_channels );
270 i_next_atomic_operation += 2;
271 i_source_channel_offset++;
273 if( i_physical_channels & AOUT_CHAN_MIDDLELEFT )
275 ComputeChannelOperations( p_data , i_rate
276 , i_next_atomic_operation , i_source_channel_offset
277 , -d_x , 0 , d_min , 1.5 / i_nb_channels );
278 i_next_atomic_operation += 2;
279 i_source_channel_offset++;
281 if( i_physical_channels & AOUT_CHAN_MIDDLERIGHT )
283 ComputeChannelOperations( p_data , i_rate
284 , i_next_atomic_operation , i_source_channel_offset
285 , d_x , 0 , d_min , 1.5 / i_nb_channels );
286 i_next_atomic_operation += 2;
287 i_source_channel_offset++;
289 if( i_physical_channels & AOUT_CHAN_REARLEFT )
291 ComputeChannelOperations( p_data , i_rate
292 , i_next_atomic_operation , i_source_channel_offset
293 , -d_x , d_z_rear , d_min , 1.5 / i_nb_channels );
294 i_next_atomic_operation += 2;
295 i_source_channel_offset++;
297 if( i_physical_channels & AOUT_CHAN_REARRIGHT )
299 ComputeChannelOperations( p_data , i_rate
300 , i_next_atomic_operation , i_source_channel_offset
301 , d_x , d_z_rear , d_min , 1.5 / i_nb_channels );
302 i_next_atomic_operation += 2;
303 i_source_channel_offset++;
305 if( i_physical_channels & AOUT_CHAN_REARCENTER )
307 ComputeChannelOperations( p_data , i_rate
308 , i_next_atomic_operation , i_source_channel_offset
309 , 0 , -d_z , d_min , 1.5 / i_nb_channels );
310 i_next_atomic_operation += 2;
311 i_source_channel_offset++;
313 if( i_physical_channels & AOUT_CHAN_CENTER )
315 /* having two center channels increases the spatialization effect */
316 ComputeChannelOperations( p_data , i_rate
317 , i_next_atomic_operation , i_source_channel_offset
318 , d_x / 5.0 , d_z , d_min , 0.75 / i_nb_channels );
319 i_next_atomic_operation += 2;
320 ComputeChannelOperations( p_data , i_rate
321 , i_next_atomic_operation , i_source_channel_offset
322 , -d_x / 5.0 , d_z , d_min , 0.75 / i_nb_channels );
323 i_next_atomic_operation += 2;
324 i_source_channel_offset++;
326 if( i_physical_channels & AOUT_CHAN_LFE )
328 ComputeChannelOperations( p_data , i_rate
329 , i_next_atomic_operation , i_source_channel_offset
330 , 0 , d_z_rear , d_min , 5.0 / i_nb_channels );
331 i_next_atomic_operation += 2;
332 i_source_channel_offset++;
335 /* Initialize the overflow buffer
336 * we need it because the process induce a delay in the samples */
337 p_data->i_overflow_buffer_size = 0;
338 for( i = 0 ; i < p_data->i_nb_atomic_operations ; i++ )
340 if( p_data->i_overflow_buffer_size
341 < p_data->p_atomic_operations[i].i_delay * 2 * sizeof (float) )
343 p_data->i_overflow_buffer_size
344 = p_data->p_atomic_operations[i].i_delay * 2 * sizeof (float);
347 p_data->p_overflow_buffer = malloc( p_data->i_overflow_buffer_size );
348 if( p_data->p_atomic_operations == NULL )
350 msg_Err( p_this, "out of memory" );
353 memset( p_data->p_overflow_buffer, 0 , p_data->i_overflow_buffer_size );
359 /*****************************************************************************
360 * Create: allocate headphone downmixer
361 *****************************************************************************/
362 static int Create( vlc_object_t *p_this )
364 aout_filter_t * p_filter = (aout_filter_t *)p_this;
367 /* Activate this filter only with stereo devices */
368 if( p_filter->output.i_physical_channels
369 != (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT) )
371 msg_Dbg( p_filter, "filter discarded (incompatible format)" );
375 /* Request a specific format if not already compatible */
376 if( p_filter->input.i_original_channels
377 != p_filter->output.i_original_channels )
380 p_filter->input.i_original_channels =
381 p_filter->output.i_original_channels;
383 if( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
384 || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
387 p_filter->input.i_format = VLC_FOURCC('f','l','3','2');
388 p_filter->output.i_format = VLC_FOURCC('f','l','3','2');
390 if( p_filter->input.i_rate != p_filter->output.i_rate )
393 p_filter->input.i_rate = p_filter->output.i_rate;
395 if( p_filter->input.i_physical_channels == (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT)
396 && ( p_filter->input.i_original_channels & AOUT_CHAN_DOLBYSTEREO )
397 && ! config_GetInt ( p_filter , "headphone-dolby" ) )
400 p_filter->input.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
407 msg_Dbg( p_filter, "requesting specific format" );
411 /* Allocate the memory needed to store the module's structure */
412 p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) );
413 if( p_filter->p_sys == NULL )
415 msg_Err( p_filter, "out of memory" );
418 p_filter->p_sys->i_overflow_buffer_size = 0;
419 p_filter->p_sys->p_overflow_buffer = NULL;
420 p_filter->p_sys->i_nb_atomic_operations = 0;
421 p_filter->p_sys->p_atomic_operations = NULL;
423 if( Init( VLC_OBJECT(p_filter), p_filter->p_sys
424 , aout_FormatNbChannels ( &p_filter->input )
425 , p_filter->input.i_physical_channels
426 , p_filter->input.i_rate ) < 0 )
431 p_filter->pf_do_work = DoWork;
432 p_filter->b_in_place = 0;
437 /*****************************************************************************
438 * Destroy: deallocate resources associated with headphone downmixer
439 *****************************************************************************/
440 static void Destroy( vlc_object_t *p_this )
442 aout_filter_t * p_filter = (aout_filter_t *)p_this;
444 if( p_filter->p_sys != NULL )
446 if( p_filter->p_sys->p_overflow_buffer != NULL )
448 free( p_filter->p_sys->p_overflow_buffer );
450 if( p_filter->p_sys->p_atomic_operations != NULL )
452 free( p_filter->p_sys->p_atomic_operations );
454 free( p_filter->p_sys );
455 p_filter->p_sys = NULL;
459 /*****************************************************************************
460 * DoWork: convert a buffer
461 *****************************************************************************/
462 static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
463 aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
466 int i_input_nb = aout_FormatNbChannels( &p_filter->input );
467 int i_output_nb = aout_FormatNbChannels( &p_filter->output );
469 float * p_in = (float*) p_in_buf->p_buffer;
471 uint8_t * p_overflow;
474 size_t i_overflow_size; /* in bytes */
475 size_t i_out_size; /* in bytes */
479 int i_source_channel_offset;
480 int i_dest_channel_offset;
481 unsigned int i_delay;
482 double d_amplitude_factor;
484 /* out buffer characterisitcs */
485 p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
486 p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * i_output_nb / i_input_nb;
487 p_out = p_out_buf->p_buffer;
488 i_out_size = p_out_buf->i_nb_bytes;
490 if( p_filter->p_sys != NULL )
492 /* Slide the overflow buffer */
493 p_overflow = p_filter->p_sys->p_overflow_buffer;
494 i_overflow_size = p_filter->p_sys->i_overflow_buffer_size;
496 memset( p_out, 0, i_out_size );
497 if ( i_out_size > i_overflow_size )
498 memcpy( p_out, p_overflow, i_overflow_size );
500 memcpy( p_out, p_overflow, i_out_size );
502 p_slide = p_filter->p_sys->p_overflow_buffer;
503 while( p_slide < p_overflow + i_overflow_size )
505 if( p_slide + i_out_size < p_overflow + i_overflow_size )
507 memset( p_slide, 0, i_out_size );
508 if( p_slide + 2 * i_out_size < p_overflow + i_overflow_size )
509 memcpy( p_slide, p_slide + i_out_size, i_out_size );
511 memcpy( p_slide, p_slide + i_out_size,
512 p_overflow + i_overflow_size - ( p_slide + i_out_size ) );
516 memset( p_slide, 0, p_overflow + i_overflow_size - p_slide );
518 p_slide += i_out_size;
521 /* apply the atomic operations */
522 for( i = 0; i < p_filter->p_sys->i_nb_atomic_operations; i++ )
524 /* shorter variable names */
525 i_source_channel_offset
526 = p_filter->p_sys->p_atomic_operations[i].i_source_channel_offset;
527 i_dest_channel_offset
528 = p_filter->p_sys->p_atomic_operations[i].i_dest_channel_offset;
529 i_delay = p_filter->p_sys->p_atomic_operations[i].i_delay;
531 = p_filter->p_sys->p_atomic_operations[i].d_amplitude_factor;
533 if( p_out_buf->i_nb_samples > i_delay )
535 /* current buffer coefficients */
536 for( j = 0; j < p_out_buf->i_nb_samples - i_delay; j++ )
538 ((float*)p_out)[ (i_delay+j)*i_output_nb + i_dest_channel_offset ]
539 += p_in[ j * i_input_nb + i_source_channel_offset ]
540 * d_amplitude_factor;
543 /* overflow buffer coefficients */
544 for( j = 0; j < i_delay; j++ )
546 ((float*)p_overflow)[ j*i_output_nb + i_dest_channel_offset ]
547 += p_in[ (p_out_buf->i_nb_samples - i_delay + j)
548 * i_input_nb + i_source_channel_offset ]
549 * d_amplitude_factor;
554 /* overflow buffer coefficients only */
555 for( j = 0; j < p_out_buf->i_nb_samples; j++ )
557 ((float*)p_overflow)[ (i_delay - p_out_buf->i_nb_samples + j)
558 * i_output_nb + i_dest_channel_offset ]
559 += p_in[ j * i_input_nb + i_source_channel_offset ]
560 * d_amplitude_factor;
567 memset( p_out, 0, i_out_size );
574 /*****************************************************************************
576 *****************************************************************************/
577 static int OpenFilter( vlc_object_t *p_this )
579 filter_t *p_filter = (filter_t *)p_this;
582 /* Activate this filter only with stereo devices */
583 if( p_filter->fmt_out.audio.i_physical_channels
584 != (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT) )
586 msg_Dbg( p_filter, "filter discarded (incompatible format)" );
590 /* Request a specific format if not already compatible */
591 if( p_filter->fmt_in.audio.i_original_channels
592 != p_filter->fmt_out.audio.i_original_channels )
595 p_filter->fmt_in.audio.i_original_channels =
596 p_filter->fmt_out.audio.i_original_channels;
598 if( p_filter->fmt_in.audio.i_format != VLC_FOURCC('f','l','3','2')
599 || p_filter->fmt_out.audio.i_format != VLC_FOURCC('f','l','3','2') )
602 p_filter->fmt_in.audio.i_format = VLC_FOURCC('f','l','3','2');
603 p_filter->fmt_out.audio.i_format = VLC_FOURCC('f','l','3','2');
605 if( p_filter->fmt_in.audio.i_rate != p_filter->fmt_out.audio.i_rate )
608 p_filter->fmt_in.audio.i_rate = p_filter->fmt_out.audio.i_rate;
610 if( p_filter->fmt_in.audio.i_physical_channels == (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT)
611 && ( p_filter->fmt_in.audio.i_original_channels & AOUT_CHAN_DOLBYSTEREO )
612 && !config_GetInt( p_filter, "headphone-dolby" ) )
615 p_filter->fmt_in.audio.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
622 msg_Dbg( p_filter, "requesting specific format" );
626 /* Allocate the memory needed to store the module's structure */
627 p_filter->p_sys = malloc( sizeof(struct filter_sys_t) );
628 if( p_filter->p_sys == NULL )
630 msg_Err( p_filter, "out of memory" );
633 p_filter->p_sys->i_overflow_buffer_size = 0;
634 p_filter->p_sys->p_overflow_buffer = NULL;
635 p_filter->p_sys->i_nb_atomic_operations = 0;
636 p_filter->p_sys->p_atomic_operations = NULL;
638 if( Init( VLC_OBJECT(p_filter), (struct aout_filter_sys_t *)p_filter->p_sys
639 , aout_FormatNbChannels ( &(p_filter->fmt_in.audio) )
640 , p_filter->fmt_in.audio.i_physical_channels
641 , p_filter->fmt_in.audio.i_rate ) < 0 )
646 p_filter->pf_audio_filter = Convert;
647 p_filter->fmt_out.audio.i_rate = p_filter->fmt_in.audio.i_rate;
652 /*****************************************************************************
653 * CloseFilter : deallocate data structures
654 *****************************************************************************/
655 static void CloseFilter( vlc_object_t *p_this )
657 filter_t *p_filter = (filter_t *)p_this;
659 if( p_filter->p_sys != NULL )
661 if( p_filter->p_sys->p_overflow_buffer != NULL )
663 free ( p_filter->p_sys->p_overflow_buffer );
665 if( p_filter->p_sys->p_atomic_operations != NULL )
667 free ( p_filter->p_sys->p_atomic_operations );
669 free( p_filter->p_sys );
670 p_filter->p_sys = NULL;
674 static block_t *Convert( filter_t *p_filter, block_t *p_block )
676 aout_filter_t aout_filter;
677 aout_buffer_t in_buf, out_buf;
681 if( !p_block || !p_block->i_samples )
683 if( p_block ) p_block->pf_release( p_block );
687 i_out_size = p_block->i_samples *
688 p_filter->fmt_out.audio.i_bitspersample/8 *
689 aout_FormatNbChannels( &(p_filter->fmt_out.audio) );
691 p_out = p_filter->pf_audio_buffer_new( p_filter, i_out_size );
694 msg_Warn( p_filter, "can't get output buffer" );
695 if( p_block ) p_block->pf_release( p_block );
699 p_out->i_samples = p_block->i_samples;
700 p_out->i_dts = p_block->i_dts;
701 p_out->i_pts = p_block->i_pts;
702 p_out->i_length = p_block->i_length;
704 aout_filter.p_sys = (struct aout_filter_sys_t *)p_filter->p_sys;
705 aout_filter.input = p_filter->fmt_in.audio;
706 aout_filter.input.i_format = p_filter->fmt_in.i_codec;
707 aout_filter.output = p_filter->fmt_out.audio;
708 aout_filter.output.i_format = p_filter->fmt_out.i_codec;
709 aout_filter.b_in_place = 0;
711 in_buf.p_buffer = p_block->p_buffer;
712 in_buf.i_nb_bytes = p_block->i_buffer;
713 in_buf.i_nb_samples = p_block->i_samples;
714 out_buf.p_buffer = p_out->p_buffer;
715 out_buf.i_nb_bytes = p_out->i_buffer;
716 out_buf.i_nb_samples = p_out->i_samples;
718 DoWork( (aout_instance_t *)p_filter, &aout_filter, &in_buf, &out_buf );
720 p_out->i_buffer = out_buf.i_nb_bytes;
721 p_out->i_samples = out_buf.i_nb_samples;
723 if( p_block ) p_block->pf_release( p_block );