1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-03 05:10:03 +02:00

avcodec/mlpenc: use ff_ctz()

This commit is contained in:
Paul B Mahol 2021-09-05 00:06:00 +02:00
parent d18b445689
commit 5b28a5db03

View File

@ -28,6 +28,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/crc.h"
#include "libavutil/avstring.h"
#include "libavutil/intmath.h"
#include "libavutil/samplefmt.h"
#include "libavutil/thread.h"
#include "mlp.h"
@ -1303,13 +1304,11 @@ static void input_to_sample_buffer(MLPEncodeContext *ctx)
/** Counts the number of trailing zeroes in a value */
static int number_trailing_zeroes(int32_t sample)
{
int bits;
for (bits = 0; bits < 24 && !(sample & (1<<bits)); bits++);
int bits = ff_ctz(sample);
/* All samples are 0. TODO Return previous quant_step_size to avoid
* writing a new header. */
if (bits == 24)
if (bits >= 24)
return 0;
return bits;