50 const unsigned char *
buf;
55 #define ADVANCE_BLOCK() \
58 if (pixel_ptr >= width) \
61 row_ptr += stride * 4; \
64 if (total_blocks < 0) \
66 av_log(s->avctx, AV_LOG_ERROR, "warning: block counter just went negative (this should not happen)\n"); \
75 int row_inc = stride - 4;
80 unsigned short colorA = 0, colorB;
81 unsigned short color4[4];
82 unsigned char index, idx;
83 unsigned short ta, tb;
84 unsigned short *pixels = (
unsigned short *)s->
frame.
data[0];
93 if (s->
buf[stream_ptr] != 0xe1)
98 chunk_size =
AV_RB32(&s->
buf[stream_ptr]) & 0x00FFFFFF;
102 if (chunk_size != s->
size)
105 chunk_size = s->
size;
111 while (stream_ptr < chunk_size) {
112 opcode = s->
buf[stream_ptr++];
114 n_blocks = (opcode & 0x1f) + 1;
117 if ((opcode & 0x80) == 0) {
118 colorA = (opcode << 8) | (s->
buf[stream_ptr++]);
120 if ((s->
buf[stream_ptr] & 0x80) != 0) {
129 switch (opcode & 0xe0) {
143 block_ptr = row_ptr + pixel_ptr;
144 for (pixel_y = 0; pixel_y < 4; pixel_y++) {
145 for (pixel_x = 0; pixel_x < 4; pixel_x++){
146 pixels[block_ptr] = colorA;
149 block_ptr += row_inc;
170 ta = (colorA >> 10) & 0x1F;
171 tb = (colorB >> 10) & 0x1F;
172 color4[1] |= ((11 * ta + 21 * tb) >> 5) << 10;
173 color4[2] |= ((21 * ta + 11 * tb) >> 5) << 10;
176 ta = (colorA >> 5) & 0x1F;
177 tb = (colorB >> 5) & 0x1F;
178 color4[1] |= ((11 * ta + 21 * tb) >> 5) << 5;
179 color4[2] |= ((21 * ta + 11 * tb) >> 5) << 5;
184 color4[1] |= ((11 * ta + 21 * tb) >> 5);
185 color4[2] |= ((21 * ta + 11 * tb) >> 5);
187 if (s->
size - stream_ptr < n_blocks * 4)
190 block_ptr = row_ptr + pixel_ptr;
191 for (pixel_y = 0; pixel_y < 4; pixel_y++) {
192 index = s->
buf[stream_ptr++];
193 for (pixel_x = 0; pixel_x < 4; pixel_x++){
194 idx = (index >> (2 * (3 - pixel_x))) & 0x03;
195 pixels[block_ptr] = color4[idx];
198 block_ptr += row_inc;
206 if (s->
size - stream_ptr < 30)
208 block_ptr = row_ptr + pixel_ptr;
209 for (pixel_y = 0; pixel_y < 4; pixel_y++) {
210 for (pixel_x = 0; pixel_x < 4; pixel_x++){
212 if ((pixel_y != 0) || (pixel_x !=0)) {
216 pixels[block_ptr] = colorA;
219 block_ptr += row_inc;
227 " Skip remaining %d bytes of chunk data.\n", opcode,
228 chunk_size - stream_ptr);
247 void *
data,
int *got_frame,
251 int buf_size = avpkt->
size;
static int rpza_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
This structure describes decoded (raw) audio or video data.
struct RpzaContext RpzaContext
int buffer_hints
codec suggestion on buffer type if != 0
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int(* reget_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called at the beginning of a frame to get cr buffer for it.
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
static void rpza_decode_stream(RpzaContext *s)
#define AV_PIX_FMT_RGB555
static int init(AVCodecParserContext *s)
static av_cold int rpza_decode_end(AVCodecContext *avctx)
int reference
is this picture used as reference The values for this are the same as the MpegEncContext.picture_structure variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
#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.
common internal API header
int width
picture width / height.
static av_cold int rpza_decode_init(AVCodecContext *avctx)
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
main external API structure.
static void close(AVCodecParserContext *s)
const unsigned char * buf
#define FF_BUFFER_HINTS_REUSABLE
#define FF_BUFFER_HINTS_PRESERVE
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
#define FF_BUFFER_HINTS_VALID
This structure stores compressed data.
if(!(ptr_align%ac->ptr_align)&&samples_align >=aligned_len)