mirror of
https://github.com/mpv-player/mpv
synced 2025-03-30 15:29:56 +00:00
af: remove a pointless macro
The code should be equivalent; a compatibility macro definition is left. (It should be mass-replaced later.)
This commit is contained in:
parent
d74bac22b9
commit
1889c62b85
@ -704,16 +704,6 @@ struct mp_audio *af_play(struct af_stream *s, struct mp_audio *data)
|
||||
return data;
|
||||
}
|
||||
|
||||
/* Calculate the minimum output buffer size for given input data d
|
||||
* when using the RESIZE_LOCAL_BUFFER macro. The +t+1 part ensures the
|
||||
* value is >= len*mul rounded upwards to whole samples even if the
|
||||
* double 'mul' is inexact. */
|
||||
int af_lencalc(double mul, struct mp_audio *d)
|
||||
{
|
||||
int t = d->bps * d->nch;
|
||||
return d->len * mul + t + 1;
|
||||
}
|
||||
|
||||
// Calculate average ratio of filter output size to input size
|
||||
double af_calc_filter_multiplier(struct af_stream *s)
|
||||
{
|
||||
@ -742,10 +732,23 @@ double af_calc_delay(struct af_stream *s)
|
||||
return delay;
|
||||
}
|
||||
|
||||
/* Helper function called by the macro with the same name this
|
||||
function should not be called directly */
|
||||
/* Calculate the minimum output buffer size for given input data d
|
||||
* when using the af_resize_local_buffer function. The +t+1 part ensures the
|
||||
* value is >= len*mul rounded upwards to whole samples even if the
|
||||
* double 'mul' is inexact. */
|
||||
static int af_lencalc(double mul, struct mp_audio *d)
|
||||
{
|
||||
int t = d->bps * d->nch;
|
||||
return d->len * mul + t + 1;
|
||||
}
|
||||
|
||||
/* I a local buffer is used (i.e. if the filter doesn't operate on the incoming
|
||||
* buffer), this macro must be called to ensure the buffer is big enough. */
|
||||
int af_resize_local_buffer(struct af_instance *af, struct mp_audio *data)
|
||||
{
|
||||
if (af->data->len >= af_lencalc(af->mul, data))
|
||||
return AF_OK;
|
||||
|
||||
// Calculate new length
|
||||
register int len = af_lencalc(af->mul, data);
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "[libaf] Reallocating memory in module %s, "
|
||||
|
@ -182,14 +182,9 @@ double af_calc_delay(struct af_stream *s);
|
||||
* \{
|
||||
*/
|
||||
|
||||
/* Helper function called by the macro with the same name only to be
|
||||
called from inside filters */
|
||||
int af_resize_local_buffer(struct af_instance *af, struct mp_audio *data);
|
||||
|
||||
/* Helper function used to calculate the exact buffer length needed
|
||||
when buffers are resized. The returned length is >= than what is
|
||||
needed */
|
||||
int af_lencalc(double mul, struct mp_audio *data);
|
||||
#define RESIZE_LOCAL_BUFFER af_resize_local_buffer
|
||||
|
||||
/**
|
||||
* \brief convert dB to gain value
|
||||
@ -253,14 +248,4 @@ int af_test_output(struct af_instance *af, struct mp_audio *out);
|
||||
*/
|
||||
float af_softclip(float a);
|
||||
|
||||
/** \} */ // end of af_filter group, but more functions of this group below
|
||||
|
||||
/** Memory reallocation macro: if a local buffer is used (i.e. if the
|
||||
filter doesn't operate on the incoming buffer this macro must be
|
||||
called to ensure the buffer is big enough.
|
||||
* \ingroup af_filter
|
||||
*/
|
||||
#define RESIZE_LOCAL_BUFFER(a, d) \
|
||||
((a->data->len < af_lencalc(a->mul, d)) ? af_resize_local_buffer(a, d) : AF_OK)
|
||||
|
||||
#endif /* MPLAYER_AF_H */
|
||||
|
Loading…
Reference in New Issue
Block a user