31#define ROQ_FRAME_SIZE 735
32#define ROQ_HEADER_SIZE 8
34#define MAX_DPCM (127*127)
99 result +=
diff > result*result+result;
104 diff = result*result;
107 predicted = *previous +
diff;
110 if (predicted > 32767 || predicted < -32768) {
116 result |= negative << 7;
118 *previous = predicted;
126 int i, stereo, data_size, ret;
127 const int16_t *in =
frame ? (
const int16_t *)
frame->data[0] :
NULL;
166 bytestream_put_byte(&
out, stereo ? 0x21 : 0x20);
167 bytestream_put_byte(&
out, 0x10);
168 bytestream_put_le32(&
out, data_size);
177 for (
i = 0;
i < data_size;
i++)
192 .p.name =
"roq_dpcm",
const FFCodec ff_roq_dpcm_encoder
Libavcodec external API header.
#define i(width, name, range_min, range_max)
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
#define CODEC_SAMPLEFMTS(...)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
int(* init)(AVBSFContext *ctx)
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
static struct @111144215057303131116103221376075045141373005341 current
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AV_SAMPLE_FMT_S16
signed 16 bits
Memory handling functions.
static av_cold int roq_dpcm_encode_close(AVCodecContext *avctx)
static av_cold int roq_dpcm_encode_init(AVCodecContext *avctx)
static unsigned char dpcm_predict(short *previous, short current)
static int roq_dpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
int nb_channels
Number of channels in this layout.
main external API structure.
AVChannelLayout ch_layout
Audio channel layout.
int64_t bit_rate
the average bitrate
int sample_rate
samples per second
int frame_size
Number of samples per channel in an audio frame.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)