25 #define BITSTREAM_READER_LE
101 static const int8_t
luma_adjust[] = { -4, -3, -2, -1, 1, 2, 3, 4 };
104 { 1, 1, 0, -1, -1, -1, 0, 1 },
105 { 0, 1, 1, 1, 0, -1, -1, -1 }
109 20, 28, 36, 44, 52, 60, 68, 76,
110 84, 92, 100, 106, 112, 116, 120, 124,
111 128, 132, 136, 140, 144, 150, 156, 164,
112 172, 180, 188, 196, 204, 212, 220, 228
122 "Dimensions should be a multiple of two.\n");
192 int buf_size = avpkt->
size;
198 uint8_t *old_y, *old_cb, *old_cr,
199 *new_y, *new_cb, *new_cr;
201 unsigned old_y_stride, old_cb_stride, old_cr_stride,
202 new_y_stride, new_cb_stride, new_cr_stride;
203 unsigned total_blocks = avctx->
width * avctx->
height / 4,
204 block_index, block_x = 0;
205 unsigned y[4] = { 0 }, cb = 0x10, cr = 0x10;
206 int skip = -1, y_avg = 0, i, j;
210 if (buf_size <= 16) {
233 for (block_index = 0; block_index < total_blocks; block_index++) {
246 y[2] = old_y[old_y_stride];
247 y[3] = old_y[old_y_stride + 1];
253 unsigned sign_selector =
get_bits(&gb, 6);
254 unsigned difference_selector =
get_bits(&gb, 2);
256 for (i = 0; i < 4; i++) {
257 y[i] = av_clip(y_avg +
offset_table[difference_selector] *
264 unsigned adjust_index =
get_bits(&gb, 3);
267 for (i = 0; i < 4; i++)
276 unsigned adjust_index =
get_bits(&gb, 3);
286 new_y[new_y_stride] = y[2];
287 new_y[new_y_stride + 1] = y[3];
298 if (block_x * 2 == avctx->
width) {
300 old_y += old_y_stride * 2 - avctx->
width;
301 old_cb += old_cb_stride - avctx->
width / 2;
302 old_cr += old_cr_stride - avctx->
width / 2;
303 new_y += new_y_stride * 2 - avctx->
width;
304 new_cb += new_cb_stride - avctx->
width / 2;
305 new_cr += new_cr_stride - avctx->
width / 2;
317 for (j = 0; j < avctx->
height; j++) {
318 for (i = 0; i < avctx->
width; i++)
319 dstY[i] = new_y[i] << 2;
321 new_y += new_y_stride;
323 for (j = 0; j < avctx->
height / 2; j++) {
324 for (i = 0; i < avctx->
width / 2; i++) {
330 new_cb += new_cb_stride;
331 new_cr += new_cr_stride;
334 av_dlog(avctx,
"Frame data: provided %d bytes, used %d bytes\n",
const uint8_t chroma_vals[]
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
memory handling functions
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (%s)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic?ac->func_descr_generic:ac->func_descr)
Macro definitions for various function/variable attributes.
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 int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
static av_cold int escape130_decode_close(AVCodecContext *avctx)
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static int get_bits_count(const GetBitContext *s)
bitstream reader API header.
static const int8_t chroma_adjust[2][8]
static const int8_t sign_table[64][4]
static int escape130_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#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.
int width
picture width / height.
static int decode_skip_count(GetBitContext *gb)
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
static const int8_t luma_adjust[]
main external API structure.
static void close(AVCodecParserContext *s)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
AVCodec ff_escape130_decoder
static unsigned int get_bits1(GetBitContext *s)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
common internal api header.
static av_cold int init(AVCodecParserContext *s)
static const uint8_t offset_table[]
static av_cold int escape130_decode_init(AVCodecContext *avctx)
#define FFSWAP(type, a, b)
This structure stores compressed data.