---
libavcodec/mpegvideo.c | 18 ++++++++++++++++--
libavcodec/mpegvideo.h | 2 ++
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index cc444a2..1b373b6 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -884,7 +884,7 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
{
int i;
AVFrame *pic;
- s->mb_skipped = 0;
+ s->mb_skipped = s->edge_y = 0;
assert(s->last_picture_ptr==NULL || s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3);
@@ -1020,7 +1020,7 @@ void MPV_frame_end(MpegEncContext *s)
XVMC_field_end(s);
}else
#endif
- if(s->unrestricted_mv && s->current_picture.reference && !s->intra_only && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
+ if(s->unrestricted_mv && s->current_picture.reference && !s->intra_only && !(s->flags&CODEC_FLAG_EMU_EDGE) && (s->edge_y < s->v_edge_pos)) {
s->dsp.draw_edges(s->current_picture.data[0], s->linesize , s->h_edge_pos , s->v_edge_pos , EDGE_WIDTH , EDGE_TOP|EDGE_BOTTOM);
s->dsp.draw_edges(s->current_picture.data[1], s->uvlinesize, s->h_edge_pos>>1, s->v_edge_pos>>1, EDGE_WIDTH/2, EDGE_TOP|EDGE_BOTTOM);
s->dsp.draw_edges(s->current_picture.data[2], s->uvlinesize, s->h_edge_pos>>1, s->v_edge_pos>>1, EDGE_WIDTH/2, EDGE_TOP|EDGE_BOTTOM);
@@ -2092,6 +2092,20 @@ void MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64]){
* @param h is the normal height, this will be reduced automatically if needed for the last row
*/
void ff_draw_horiz_band(MpegEncContext *s, int y, int h){
+ if (s->unrestricted_mv && !s->intra_only && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
+ int sides = 0;
+ if (y==0) sides |= EDGE_TOP;
+ if (y + h >= s->v_edge_pos) sides |= EDGE_BOTTOM;
+
+ assert(y + h >= EDGE_WIDTH && s->edge_y <= s->v_edge_pos);
+
+ s->dsp.draw_edges(s->current_picture.data[0] + s->edge_y *s->linesize , s->linesize , s->h_edge_pos , h , EDGE_WIDTH , sides);
+ s->dsp.draw_edges(s->current_picture.data[1] + (s->edge_y>>1)*s->uvlinesize, s->uvlinesize, s->h_edge_pos>>1, h>>1, EDGE_WIDTH/2, sides);
+ s->dsp.draw_edges(s->current_picture.data[2] + (s->edge_y>>1)*s->uvlinesize, s->uvlinesize, s->h_edge_pos>>1, h>>1, EDGE_WIDTH/2, sides);
+
+ s->edge_y += h;
+ }
+
if (s->avctx->draw_horiz_band) {
AVFrame *src;
int offset[4];
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 892d403..02ae738 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -635,6 +635,8 @@ typedef struct MpegEncContext {
int swap_uv;//vcr2 codec is mpeg2 varint with UV swaped
short * pblocks[12];
+ int edge_y; ///< lowest row draw_edges has been called on
+
DCTELEM (*block)[64]; ///< points to one of the following blocks
DCTELEM (*blocks)[8][64]; // for HQ mode we need to keep the best block
int (*decode_mb)(struct MpegEncContext *s, DCTELEM block[6][64]); // used by some codecs to avoid a switch()
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc