mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
pcm: K&R formatting cosmetics
Signed-off-by: Diego Biurrun <diego@biurrun.de>
This commit is contained in:
parent
835a893bcb
commit
6d21f49879
@ -24,8 +24,8 @@
|
||||
* PCM codecs
|
||||
*/
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "libavutil/common.h" /* for av_reverse */
|
||||
#include "avcodec.h"
|
||||
#include "bytestream.h"
|
||||
#include "internal.h"
|
||||
#include "pcm_tablegen.h"
|
||||
@ -356,9 +356,8 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
DECODE(16, be16, src, samples, n, 0, 0x8000)
|
||||
break;
|
||||
case CODEC_ID_PCM_S8:
|
||||
for(;n>0;n--) {
|
||||
for (; n > 0; n--)
|
||||
*samples++ = *src++ + 128;
|
||||
}
|
||||
break;
|
||||
#if HAVE_BIGENDIAN
|
||||
case CODEC_ID_PCM_F64LE:
|
||||
@ -446,18 +445,23 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
const uint8_t *src8;
|
||||
dst_int32_t = (int32_t *)s->frame.data[0];
|
||||
n /= avctx->channels;
|
||||
//unpack and de-planerize
|
||||
// unpack and de-planarize
|
||||
for (i = 0; i < n; i++) {
|
||||
for (c = 0, src8 = src + i * 5; c < avctx->channels; c++, src8 += n * 5) {
|
||||
// extract low 20 bits and expand to 32 bits
|
||||
*dst_int32_t++ = (src8[2] << 28) | (src8[1] << 20) | (src8[0] << 12) |
|
||||
((src8[2] & 0xF) << 8) | src8[1];
|
||||
*dst_int32_t++ = (src8[2] << 28) |
|
||||
(src8[1] << 20) |
|
||||
(src8[0] << 12) |
|
||||
((src8[2] & 0xF) << 8) |
|
||||
src8[1];
|
||||
}
|
||||
|
||||
for (c = 0, src8 = src + i * 5; c < avctx->channels; c++, src8 += n * 5) {
|
||||
// extract high 20 bits and expand to 32 bits
|
||||
*dst_int32_t++ = (src8[4] << 24) | (src8[3] << 16) |
|
||||
((src8[2] & 0xF0) << 8) | (src8[4] << 4) | (src8[3] >> 4);
|
||||
*dst_int32_t++ = (src8[4] << 24) |
|
||||
(src8[3] << 16) |
|
||||
((src8[2] & 0xF0) << 8) |
|
||||
(src8[4] << 4) |
|
||||
(src8[3] >> 4);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -482,7 +486,8 @@ AVCodec ff_ ## name_ ## _encoder = { \
|
||||
.encode2 = pcm_encode_frame, \
|
||||
.close = pcm_encode_close, \
|
||||
.capabilities = CODEC_CAP_VARIABLE_FRAME_SIZE, \
|
||||
.sample_fmts = (const enum AVSampleFormat[]){sample_fmt_,AV_SAMPLE_FMT_NONE}, \
|
||||
.sample_fmts = (const enum AVSampleFormat[]){ sample_fmt_, \
|
||||
AV_SAMPLE_FMT_NONE }, \
|
||||
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
|
||||
}
|
||||
#else
|
||||
@ -499,7 +504,8 @@ AVCodec ff_ ## name_ ## _decoder = { \
|
||||
.init = pcm_decode_init, \
|
||||
.decode = pcm_decode_frame, \
|
||||
.capabilities = CODEC_CAP_DR1, \
|
||||
.sample_fmts = (const enum AVSampleFormat[]){sample_fmt_,AV_SAMPLE_FMT_NONE}, \
|
||||
.sample_fmts = (const enum AVSampleFormat[]){ sample_fmt_, \
|
||||
AV_SAMPLE_FMT_NONE }, \
|
||||
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
|
||||
}
|
||||
#else
|
||||
@ -507,7 +513,8 @@ AVCodec ff_ ## name_ ## _decoder = { \
|
||||
#endif
|
||||
|
||||
#define PCM_CODEC(id, sample_fmt_, name, long_name_) \
|
||||
PCM_ENCODER(id,sample_fmt_,name,long_name_); PCM_DECODER(id,sample_fmt_,name,long_name_)
|
||||
PCM_ENCODER(id, sample_fmt_, name, long_name_); \
|
||||
PCM_DECODER(id, sample_fmt_, name, long_name_)
|
||||
|
||||
/* Note: Do not forget to add new entries to the Makefile as well. */
|
||||
PCM_CODEC (CODEC_ID_PCM_ALAW, AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law");
|
||||
|
Loading…
Reference in New Issue
Block a user