|
...
|
...
|
@@ -104,7 +104,8 @@ static av_cold int flashsv_encode_init(AVCodecContext *avctx)
|
|
104
|
104
|
s->avctx = avctx;
|
|
105
|
105
|
|
|
106
|
106
|
if (avctx->width > 4095 || avctx->height > 4095) {
|
|
107
|
|
- av_log(avctx, AV_LOG_ERROR, "Input dimensions too large, input must be max 4096x4096 !\n");
|
|
|
107
|
+ av_log(avctx, AV_LOG_ERROR,
|
|
|
108
|
+ "Input dimensions too large, input must be max 4096x4096 !\n");
|
|
108
|
109
|
return AVERROR_INVALIDDATA;
|
|
109
|
110
|
}
|
|
110
|
111
|
|
|
...
|
...
|
@@ -181,7 +182,8 @@ static int encode_bitstream(FlashSVContext *s, AVFrame *p, uint8_t *buf,
|
|
181
|
181
|
|
|
182
|
182
|
//ret = deflateReset(&s->zstream);
|
|
183
|
183
|
if (ret != Z_OK)
|
|
184
|
|
- av_log(s->avctx, AV_LOG_ERROR, "error while compressing block %dx%d\n", i, j);
|
|
|
184
|
+ av_log(s->avctx, AV_LOG_ERROR,
|
|
|
185
|
+ "error while compressing block %dx%d\n", i, j);
|
|
185
|
186
|
|
|
186
|
187
|
bytestream_put_be16(&ptr, (unsigned int) zsize);
|
|
187
|
188
|
buf_pos += zsize + 2;
|
|
...
|
...
|
@@ -241,26 +243,28 @@ static int flashsv_encode_frame(AVCodecContext *avctx, uint8_t *buf,
|
|
241
|
241
|
opt_w = 4;
|
|
242
|
242
|
opt_h = 4;
|
|
243
|
243
|
|
|
244
|
|
- if (buf_size < s->image_width*s->image_height*3) {
|
|
|
244
|
+ if (buf_size < s->image_width * s->image_height * 3) {
|
|
245
|
245
|
//Conservative upper bound check for compressed data
|
|
246
|
246
|
av_log(avctx, AV_LOG_ERROR, "buf_size %d < %d\n",
|
|
247
|
247
|
buf_size, s->image_width * s->image_height * 3);
|
|
248
|
248
|
return -1;
|
|
249
|
249
|
}
|
|
250
|
250
|
|
|
251
|
|
- res = encode_bitstream(s, p, buf, buf_size, opt_w * 16, opt_h * 16, pfptr, &I_frame);
|
|
|
251
|
+ res = encode_bitstream(s, p, buf, buf_size, opt_w * 16, opt_h * 16,
|
|
|
252
|
+ pfptr, &I_frame);
|
|
252
|
253
|
|
|
253
|
254
|
//save the current frame
|
|
254
|
255
|
if (p->linesize[0] > 0)
|
|
255
|
256
|
memcpy(s->previous_frame, p->data[0], s->image_height * p->linesize[0]);
|
|
256
|
257
|
else
|
|
257
|
|
- memcpy(s->previous_frame, p->data[0] + p->linesize[0] * (s->image_height - 1),
|
|
|
258
|
+ memcpy(s->previous_frame,
|
|
|
259
|
+ p->data[0] + p->linesize[0] * (s->image_height - 1),
|
|
258
|
260
|
s->image_height * FFABS(p->linesize[0]));
|
|
259
|
261
|
|
|
260
|
262
|
//mark the frame type so the muxer can mux it correctly
|
|
261
|
263
|
if (I_frame) {
|
|
262
|
|
- p->pict_type = AV_PICTURE_TYPE_I;
|
|
263
|
|
- p->key_frame = 1;
|
|
|
264
|
+ p->pict_type = AV_PICTURE_TYPE_I;
|
|
|
265
|
+ p->key_frame = 1;
|
|
264
|
266
|
s->last_key_frame = avctx->frame_number;
|
|
265
|
267
|
av_log(avctx, AV_LOG_DEBUG, "Inserting key frame at frame %d\n", avctx->frame_number);
|
|
266
|
268
|
} else {
|