78 for (i = dx + h; i > dx; i--) {
79 nsptr = sptr + i * stride + dy * 3;
80 npfptr = pfptr + i * stride + dy * 3;
81 for (j = 0; j < w * 3; j++) {
82 diff |= npfptr[j] ^ nsptr[j];
100 "Input dimensions too large, input must be max 4096x4096 !\n");
105 memset(&s->
zstream, 0,
sizeof(z_stream));
125 int buf_size,
int block_width,
int block_height,
126 uint8_t *previous_frame,
int *I_frame)
130 int h_blocks, v_blocks, h_part, v_part, i, j;
136 put_bits(&pb, 4, block_width / 16 - 1);
138 put_bits(&pb, 4, block_height / 16 - 1);
149 for (j = 0; j < v_blocks + (v_part ? 1 : 0); j++) {
151 int y_pos = j * block_height;
152 int cur_blk_height = (j < v_blocks) ? block_height : v_part;
155 for (i = 0; i < h_blocks + (h_part ? 1 : 0); i++) {
156 int x_pos = i * block_width;
157 int cur_blk_width = (i < h_blocks) ? block_width : h_part;
165 x_pos, cur_blk_height, cur_blk_width,
168 if (res || *I_frame) {
169 unsigned long zsize = 3 * block_width * block_height;
170 ret = compress2(ptr + 2, &zsize, s->
tmpblock,
171 3 * cur_blk_width * cur_blk_height, 9);
176 "error while compressing block %dx%d\n", i, j);
178 bytestream_put_be16(&ptr, zsize);
179 buf_pos += zsize + 2;
183 bytestream_put_be16(&ptr, 0);
199 const AVFrame *pict,
int *got_packet)
206 int opt_w = 4, opt_h = 4;
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
Check AVPacket size and/or allocate data.
This structure describes decoded (raw) audio or video data.
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
static av_cold int init(AVCodecContext *avctx)
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...
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)
if((e=av_dict_get(options,"", NULL, AV_DICT_IGNORE_SUFFIX)))
packed RGB 8:8:8, 24bpp, BGRBGR...
const char * name
Name of the codec implementation.
static int encode_bitstream(FlashSVContext *s, AVFrame *p, uint8_t *buf, int buf_size, int block_width, int block_height, uint8_t *previous_frame, int *I_frame)
static int copy_region_enc(uint8_t *sptr, uint8_t *dptr, int dx, int dy, int h, int w, int stride, uint8_t *pfptr)
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
static int flashsv_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
AVCodec ff_flashsv_encoder
Libavcodec external API header.
AVPixelFormat
Pixel format.
int flags
A combination of AV_PKT_FLAG values.
enum AVPictureType pict_type
Picture type of the frame.
static av_cold int flashsv_encode_end(AVCodecContext *avctx)
int width
picture width / height.
main external API structure.
static void close(AVCodecParserContext *s)
AVFrame * coded_frame
the picture in the bitstream
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
int gop_size
the number of pictures in a group of pictures, or 0 for intra_only
common internal api header.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
static av_cold int flashsv_encode_init(AVCodecContext *avctx)
#define AVERROR_INVALIDDATA
int key_frame
1 -> keyframe, 0-> not
int frame_number
Frame counter, set by libavcodec.
This structure stores compressed data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
void * av_mallocz(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...