28 #define ROQ_FIRST_FRAME_SIZE (735*8)
29 #define ROQ_FRAME_SIZE 735
32 #define MAX_DPCM (127*127)
74 diff = current - *previous;
83 result += diff > result*result+result;
91 predicted = *previous + diff;
94 if (predicted > 32767 || predicted < -32768) {
100 result |= negative << 7;
102 *previous = predicted;
108 unsigned char *frame,
int buf_size,
void *
data)
126 bytestream_put_byte(&out, stereo ? 0x21 : 0x20);
127 bytestream_put_byte(&out, 0x10);
131 bytestream_put_byte(&out, (context->
lastSample[1])>>8);
132 bytestream_put_byte(&out, (context->
lastSample[0])>>8);
134 bytestream_put_le16(&out, context->
lastSample[0]);
139 for (ch=0; ch<avctx->
channels; ch++)
AVFrame * coded_frame
the picture in the bitstream
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
static av_const unsigned int ff_sqrt(unsigned int a)
enum AVSampleFormat sample_fmt
audio sample format
static av_cold int roq_dpcm_encode_close(AVCodecContext *avctx)
static int init(AVCodecParserContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
AVFrame * avcodec_alloc_frame(void)
Allocate an AVFrame and set its fields to default values.
#define ROQ_FIRST_FRAME_SIZE
static av_cold int roq_dpcm_encode_init(AVCodecContext *avctx)
int frame_size
Samples per packet, initialized when calling 'init'.
static int roq_dpcm_encode_frame(AVCodecContext *avctx, unsigned char *frame, int buf_size, void *data)
int sample_rate
samples per second
main external API structure.
static void close(AVCodecParserContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static unsigned char dpcm_predict(short *previous, short current)
AVSampleFormat
all in native-endian format
int channels
number of audio channels
int key_frame
1 -> keyframe, 0-> not
AVCodec ff_roq_dpcm_encoder