38 #define ZMBV_KEYFRAME 1
39 #define ZMBV_DELTAPAL 2
86 int d, dx, dy, bw2, bh2;
95 for (i = 0; i < 768; i++)
100 src += ((c->
bx * c->
by * 2 + 3) & ~3);
103 for (y = 0; y < c->
height; y += c->
bh) {
105 for (x = 0; x < c->
width; x += c->
bw) {
109 dx = mvec[
block] >> 1;
110 dy = mvec[block + 1] >> 1;
117 tprev = prev + x + dx + dy * c->
width;
120 for (j = 0; j < bh2; j++) {
121 if (my + j < 0 || my + j >= c->
height) {
124 for (i = 0; i < bw2; i++) {
125 if (mx + i < 0 || mx + i >= c->
width)
137 for (j = 0; j < bh2; j++) {
138 for (i = 0; i < bw2; i++)
160 uint16_t *output, *
prev;
163 int d, dx, dy, bw2, bh2;
168 output = (uint16_t*)c->
cur;
169 prev = (uint16_t*)c->
prev;
172 src += ((c->
bx * c->
by * 2 + 3) & ~3);
175 for (y = 0; y < c->
height; y += c->
bh) {
177 for (x = 0; x < c->
width; x += c->
bw) {
178 uint16_t *
out, *tprev;
181 dx = mvec[
block] >> 1;
182 dy = mvec[block + 1] >> 1;
189 tprev = prev + x + dx + dy * c->
width;
192 for (j = 0; j < bh2; j++) {
193 if (my + j < 0 || my + j >= c->
height) {
194 memset(out, 0, bw2 * 2);
196 for (i = 0; i < bw2; i++) {
197 if (mx + i < 0 || mx + i >= c->
width)
209 for (j = 0; j < bh2; j++){
210 for (i = 0; i < bw2; i++) {
211 out[i] ^= *((uint16_t*)src);
227 #ifdef ZMBV_ENABLE_24BPP
238 int d, dx, dy, bw2, bh2;
247 stride = c->
width * 3;
249 src += ((c->
bx * c->
by * 2 + 3) & ~3);
252 for (y = 0; y < c->
height; y += c->
bh) {
254 for (x = 0; x < c->
width; x += c->
bw) {
258 dx = mvec[
block] >> 1;
259 dy = mvec[block + 1] >> 1;
265 out = output + x * 3;
266 tprev = prev + (x + dx) * 3 + dy * stride;
269 for (j = 0; j < bh2; j++) {
270 if (my + j < 0 || my + j >= c->
height) {
271 memset(out, 0, bw2 * 3);
273 for (i = 0; i < bw2; i++){
274 if (mx + i < 0 || mx + i >= c->
width) {
279 out[i * 3 + 0] = tprev[i * 3 + 0];
280 out[i * 3 + 1] = tprev[i * 3 + 1];
281 out[i * 3 + 2] = tprev[i * 3 + 2];
290 out = output + x * 3;
291 for (j = 0; j < bh2; j++) {
292 for (i = 0; i < bw2; i++) {
293 out[i * 3 + 0] ^= *src++;
294 out[i * 3 + 1] ^= *src++;
295 out[i * 3 + 2] ^= *src++;
301 output += stride * c->
bh;
302 prev += stride * c->
bh;
309 #endif //ZMBV_ENABLE_24BPP
318 uint32_t *output, *
prev;
321 int d, dx, dy, bw2, bh2;
326 output = (uint32_t*)c->
cur;
327 prev = (uint32_t*)c->
prev;
330 src += ((c->
bx * c->
by * 2 + 3) & ~3);
333 for (y = 0; y < c->
height; y += c->
bh) {
335 for (x = 0; x < c->
width; x += c->
bw) {
336 uint32_t *
out, *tprev;
339 dx = mvec[
block] >> 1;
340 dy = mvec[block + 1] >> 1;
347 tprev = prev + x + dx + dy * c->
width;
350 for (j = 0; j < bh2; j++) {
351 if (my + j < 0 || my + j >= c->
height) {
352 memset(out, 0, bw2 * 4);
354 for (i = 0; i < bw2; i++){
355 if (mx + i < 0 || mx + i >= c->
width)
367 for (j = 0; j < bh2; j++){
368 for (i = 0; i < bw2; i++) {
369 out[i] ^= *((uint32_t *) src);
394 memcpy(c->
pal, src, 768);
406 int buf_size = avpkt->
size;
410 int hi_ver, lo_ver,
ret;
435 "Flags=%X ver=%i.%i comp=%i fmt=%i blk=%ix%i\n",
437 if (hi_ver != 0 || lo_ver != 1) {
441 if (c->
bw == 0 || c->
bh == 0) {
469 #ifdef ZMBV_ENABLE_24BPP
477 #endif //ZMBV_ENABLE_24BPP
491 zret = inflateReset(&c->
zstream);
528 zret = inflate(&c->
zstream, Z_SYNC_FLUSH);
529 if (zret != Z_OK && zret != Z_STREAM_END) {
551 out = frame->
data[0];
555 for (j = 0; j < 256; j++)
559 #ifdef ZMBV_ENABLE_24BPP
590 memset(&c->
zstream, 0,
sizeof(z_stream));
598 "Can't allocate decompression buffer.\n");
606 zret = inflateInit(&c->
zstream);
int(* decode_xor)(struct ZmbvContext *c)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define av_realloc_f(p, o, n)
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
packed RGB 8:8:8, 24bpp, RGBRGB...
static av_cold int init(AVCodecContext *avctx)
static int zmbv_decode_xor_32(ZmbvContext *c)
Decode XOR'ed frame - 32bpp version.
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined ...
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
8 bit with AV_PIX_FMT_RGB32 palette
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static av_cold int decode_init(AVCodecContext *avctx)
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
static int zmbv_decode_xor_8(ZmbvContext *c)
Decode XOR'ed frame - 8bpp version.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define PTRDIFF_SPECIFIER
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
const char * name
Name of the codec implementation.
static av_cold int decode_end(AVCodecContext *avctx)
Libavcodec external API header.
enum AVPictureType pict_type
Picture type of the frame.
int width
picture width / height.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_RB24
static int zmbv_decode_xor_16(ZmbvContext *c)
Decode XOR'ed frame - 15bpp and 16bpp version.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
common internal api header.
common internal and external API header
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
int key_frame
1 -> keyframe, 0-> not
int(* decode_intra)(struct ZmbvContext *c)
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> out
static int zmbv_decode_intra(ZmbvContext *c)
Decode intraframe.
#define FFSWAP(type, a, b)
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
This structure stores compressed data.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...