1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

ws_snd: misc cosmetic clean-ups

This commit is contained in:
Justin Ruggles 2011-09-12 10:28:56 -04:00
parent 659c719bc7
commit 3d371f417e

View File

@ -25,7 +25,7 @@
/** /**
* @file * @file
* Westwood SNDx codecs. * Westwood SNDx codecs
* *
* Reference documents about VQA format and its audio codecs * Reference documents about VQA format and its audio codecs
* can be found here: * can be found here:
@ -34,12 +34,11 @@
static const int8_t ws_adpcm_4bit[] = { static const int8_t ws_adpcm_4bit[] = {
-9, -8, -6, -5, -4, -3, -2, -1, -9, -8, -6, -5, -4, -3, -2, -1,
0, 1, 2, 3, 4, 5, 6, 8 }; 0, 1, 2, 3, 4, 5, 6, 8
};
static av_cold int ws_snd_decode_init(AVCodecContext * avctx) static av_cold int ws_snd_decode_init(AVCodecContext *avctx)
{ {
// WSSNDContext *c = avctx->priv_data;
if (avctx->channels != 1) { if (avctx->channels != 1) {
av_log_ask_for_sample(avctx, "unsupported number of channels\n"); av_log_ask_for_sample(avctx, "unsupported number of channels\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
@ -49,13 +48,11 @@ static av_cold int ws_snd_decode_init(AVCodecContext * avctx)
return 0; return 0;
} }
static int ws_snd_decode_frame(AVCodecContext *avctx, static int ws_snd_decode_frame(AVCodecContext *avctx, void *data,
void *data, int *data_size, int *data_size, AVPacket *avpkt)
AVPacket *avpkt)
{ {
const uint8_t *buf = avpkt->data; const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size; int buf_size = avpkt->size;
// WSSNDContext *c = avctx->priv_data;
int in_size, out_size; int in_size, out_size;
int sample = 128; int sample = 128;
@ -71,7 +68,7 @@ static int ws_snd_decode_frame(AVCodecContext *avctx,
} }
out_size = AV_RL16(&buf[0]); out_size = AV_RL16(&buf[0]);
in_size = AV_RL16(&buf[2]); in_size = AV_RL16(&buf[2]);
buf += 4; buf += 4;
if (out_size > *data_size) { if (out_size > *data_size) {
@ -93,8 +90,8 @@ static int ws_snd_decode_frame(AVCodecContext *avctx,
while (samples < samples_end && buf - avpkt->data < buf_size) { while (samples < samples_end && buf - avpkt->data < buf_size) {
int code, smp, size; int code, smp, size;
uint8_t count; uint8_t count;
code = (*buf) >> 6; code = *buf >> 6;
count = (*buf) & 0x3F; count = *buf & 0x3F;
buf++; buf++;
/* make sure we don't write past the output buffer */ /* make sure we don't write past the output buffer */
@ -112,7 +109,7 @@ static int ws_snd_decode_frame(AVCodecContext *avctx,
if ((buf - avpkt->data) + size > buf_size) if ((buf - avpkt->data) + size > buf_size)
break; break;
switch(code) { switch (code) {
case 0: /* ADPCM 2-bit */ case 0: /* ADPCM 2-bit */
for (count++; count > 0; count--) { for (count++; count > 0; count--) {
code = *buf++; code = *buf++;