30 #include "libavutil/common.h"
31 #include "libavutil/intreadwrite.h"
49 static const int shift1[6] = { 0, 8, 8, 8, 4, 4 };
50 static const int shift2[6] = { 0, 0, 8, 4, 0, 4 };
57 int type, x,
y, d, d2;
61 data = code + ((avctx->
width * avctx->
height) >> 4);
65 for(j = 0; j < avctx->
height; j += 4){
66 for(i = 0; i < avctx->
width; i += 4){
72 x = (*mv) >> 4;
if(x & 8) x = 8 - x;
73 y = (*mv++) & 0xF;
if(y & 8) y = 8 -
y;
74 if (i < -x || avctx->
width - i - 4 < x ||
75 j < -y || avctx->
height - j - 4 < y) {
82 for(y = 0; y < 4; y++){
100 mask = ((msk[0] & 0xF0) <<
shift1[type]) | ((msk[0] & 0xF) <<
shift2[type]);
103 for(y = 0; y < 4; y++){
104 for(x = 0; x < 4; x++){
105 tmp[x] = (mask & 0x8000) ? *data++ : tmp2[x];
113 for(y = 0; y < 4; y++){
114 memset(tmp, data[0], 4);
120 for(y = 0; y < 4; y++){
121 memcpy(tmp, data, 4);
128 for(k = 0; k < 4; k++){
129 d = ((k & 1) << 1) + ((k & 2) * stride);
130 d2 = ((k & 1) << 1) + ((k & 2) * stride);
134 x = (*mv) >> 4;
if(x & 8) x = 8 - x;
135 y = (*mv++) & 0xF;
if(y & 8) y = 8 -
y;
136 if (i + 2*(k & 1) < -x || avctx->
width - i - 2*(k & 1) - 2 < x ||
137 j + (k & 2) < -y || avctx->
height - j - (k & 2) - 2 < y) {
143 tmp[d + 0 ] = tmp2[0];
144 tmp[d + 1 ] = tmp2[1];
149 tmp[d + 0 ] = data[0];
150 tmp[d + 1 ] = data[0];
151 tmp[d + 0 +
stride] = data[0];
152 tmp[d + 1 +
stride] = data[0];
156 tmp[d + 0 ] = *data++;
157 tmp[d + 1 ] = *data++;
158 tmp[d + 0 +
stride] = *data++;
159 tmp[d + 1 +
stride] = *data++;
168 for(y = 0; y < 4; y++){
169 for(x = 0; x < 4; x++){
170 tmp[x] = data[mask & 1];
182 for(y = 0; y < 4; y++){
183 for(x = 0; x < 4; x++){
184 tmp[x] = data[mask & 3];
207 uint8_t *outptr, *srcptr, *tmpptr;
209 int i, j, compr,
ret;
217 if (bytestream2_peek_le32(&gb) ==
MKTAG(
'C',
'M',
'A',
'P')) {
219 for(i = 0; i < 256; i++){
220 c->
pal[i] = 0xFF
U << 24 | bytestream2_get_be24(&gb);
230 outptr = frame->
data[0];
235 if (bytestream2_get_le32(&gb) ==
MKTAG(
'N',
'U',
'L',
'L'))
238 compr = bytestream2_get_byte(&gb);
241 if (compr != 4 && compr != -1) {
269 for (j = 0; j < avctx->
height; j++) {
270 memcpy(outptr, srcptr, avctx->
width);
272 srcptr += avctx->
width;
284 for (j = 0; j < avctx->
height; j++) {
286 for(i = 0; i < avctx->
width; i++)
287 outptr[i] = srcptr[i] ^ tmpptr[i];
290 memcpy(outptr, srcptr, avctx->
width);
292 srcptr += avctx->
width;
This structure describes decoded (raw) audio or video data.
static av_cold int init(AVCodecContext *avctx)
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
static av_cold int decode_end(AVCodecContext *avctx)
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
const char * name
Name of the codec implementation.
int av_frame_ref(AVFrame *dst, AVFrame *src)
Setup a new reference to the data described by a given frame.
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const int shift1[6]
static const uint16_t mask[17]
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Libavcodec external API header.
static int decode_13(AVCodecContext *avctx, DxaDecContext *c, uint8_t *dst, int stride, uint8_t *src, uint8_t *ref)
#define CODEC_FLAG2_SHOW_ALL
Show all frames before the first keyframe.
enum AVPictureType pict_type
Picture type of the frame.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
int width
picture width / height.
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
static const int8_t mv[256][2]
static av_always_inline int bytestream2_tell(GetByteContext *g)
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.
BYTE int const BYTE int int int height
#define MKTAG(a, b, c, d)
int palette_has_changed
Tell user application that palette has changed from previous frame.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
#define FF_DEBUG_PICT_INFO
common internal api header.
static av_cold int decode_init(AVCodecContext *avctx)
static const int shift2[6]
#define AVERROR_INVALIDDATA
int key_frame
1 -> keyframe, 0-> not
static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
8 bit with PIX_FMT_RGB32 palette
This structure stores compressed data.
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.