History

mpegvideo: allocate edges when encoding.

Allocating edges will be removed from generic code, so the encoder must handle this explicitly.

Anton Khirnov committed 12 years ago

Commit 024db241 parent f7e85ee1 file · +20 −2Browse files

Unified · Split

libavcodec/mpegvideo.c+20−2
@@ -422,15 +422,21 @@ fail: · 421 unmodified lines
422 */422 */
423static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)423static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
424{424{
425 int edges_needed = av_codec_is_encoder(s->avctx->codec);
425 int r, ret;426 int r, ret;
426 427
427 pic->tf.f = &pic->f;428 pic->tf.f = &pic->f;
428 if (s->codec_id != AV_CODEC_ID_WMV3IMAGE &&429 if (s->codec_id != AV_CODEC_ID_WMV3IMAGE &&
429 s->codec_id != AV_CODEC_ID_VC1IMAGE &&430 s->codec_id != AV_CODEC_ID_VC1IMAGE &&
430 s->codec_id != AV_CODEC_ID_MSS2)431 s->codec_id != AV_CODEC_ID_MSS2) {
432 if (edges_needed) {
433 pic->f.width = s->avctx->width + 2 * EDGE_WIDTH;
434 pic->f.height = s->avctx->height + 2 * EDGE_WIDTH;
435 }
436
431 r = ff_thread_get_buffer(s->avctx, &pic->tf,437 r = ff_thread_get_buffer(s->avctx, &pic->tf,
432 pic->reference ? AV_GET_BUFFER_FLAG_REF : 0);438 pic->reference ? AV_GET_BUFFER_FLAG_REF : 0);
433 else {439 } else {
434 pic->f.width = s->avctx->width;440 pic->f.width = s->avctx->width;
435 pic->f.height = s->avctx->height;441 pic->f.height = s->avctx->height;
436 pic->f.format = s->avctx->pix_fmt;442 pic->f.format = s->avctx->pix_fmt;
@@ -443,6 +449,18 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic) · 6 unmodified lines
443 return -1;449 return -1;
444 }450 }
445 451
452 if (edges_needed) {
453 int i;
454 for (i = 0; pic->f.data[i]; i++) {
455 int offset = (EDGE_WIDTH >> (i ? s->chroma_y_shift : 0)) *
456 pic->f.linesize[i] +
457 (EDGE_WIDTH >> (i ? s->chroma_x_shift : 0));
458 pic->f.data[i] += offset;
459 }
460 pic->f.width = s->avctx->width;
461 pic->f.height = s->avctx->height;
462 }
463
446 if (s->avctx->hwaccel) {464 if (s->avctx->hwaccel) {
447 assert(!pic->hwaccel_picture_private);465 assert(!pic->hwaccel_picture_private);
448 if (s->avctx->hwaccel->priv_data_size) {466 if (s->avctx->hwaccel->priv_data_size) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t