mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-12 18:31:37 +00:00
avcodec/flacenc: Avoid shift where possible
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
0458fdbeed
commit
1533351990
@ -525,11 +525,10 @@ static void copy_samples(FlacEncodeContext *s, const void *samples)
|
|||||||
{
|
{
|
||||||
int i, j, ch;
|
int i, j, ch;
|
||||||
FlacFrame *frame;
|
FlacFrame *frame;
|
||||||
int shift = av_get_bytes_per_sample(s->avctx->sample_fmt) * 8 -
|
|
||||||
s->avctx->bits_per_raw_sample;
|
|
||||||
|
|
||||||
#define COPY_SAMPLES(bits) do { \
|
#define COPY_SAMPLES(bits, shift0) do { \
|
||||||
const int ## bits ## _t *samples0 = samples; \
|
const int ## bits ## _t *samples0 = samples; \
|
||||||
|
const int shift = shift0; \
|
||||||
frame = &s->frame; \
|
frame = &s->frame; \
|
||||||
for (i = 0, j = 0; i < frame->blocksize; i++) \
|
for (i = 0, j = 0; i < frame->blocksize; i++) \
|
||||||
for (ch = 0; ch < s->channels; ch++, j++) \
|
for (ch = 0; ch < s->channels; ch++, j++) \
|
||||||
@ -537,9 +536,9 @@ static void copy_samples(FlacEncodeContext *s, const void *samples)
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
if (s->avctx->sample_fmt == AV_SAMPLE_FMT_S16)
|
if (s->avctx->sample_fmt == AV_SAMPLE_FMT_S16)
|
||||||
COPY_SAMPLES(16);
|
COPY_SAMPLES(16, 0);
|
||||||
else
|
else
|
||||||
COPY_SAMPLES(32);
|
COPY_SAMPLES(32, 32 - s->avctx->bits_per_raw_sample);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user