There is still a race condition when fields are decoded in different threads,
so for now we pretend EMU_EDGE is set instead of using the edges.
---
libavcodec/h264.c | 7 ++++---
libavcodec/mpegvideo.c | 29 +++++++++++++++--------------
2 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index b7a7543..18cc5ad 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -4312,7 +4312,8 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
+(h->ref_list[j][i].reference&3);
}
- h->emu_edge_width= (s->flags&CODEC_FLAG_EMU_EDGE) ? 0 : 16;
+ //FIXME: fix draw_edges+PAFF+frame threads
+ h->emu_edge_width= (s->flags&CODEC_FLAG_EMU_EDGE || (!h->sps.frame_mbs_only_flag && USE_FRAME_THREADING(s->avctx))) ? 0 : 16;
h->emu_edge_height= (FRAME_MBAFF || FIELD_PICTURE) ? 0 : h->emu_edge_width;
if(!(s->flags2 & CODEC_FLAG2_CHUNKS) && h->slice_num==1)
@@ -6972,7 +6973,7 @@ static int decode_slice(struct AVCodecContext *avctx, H264Context *h){
if( ++s->mb_x >= s->mb_width ) {
s->mb_x = 0;
- ff_draw_horiz_band(s, 16*s->mb_y, (FIELD_OR_MBAFF_PICTURE && (s->mb_y + 1 < s->mb_height)) ? 32 : 16);
+ ff_draw_horiz_band(s, 16*s->mb_y >> FIELD_PICTURE, FRAME_MBAFF ? 32 : 16);
report_decode_progress(avctx, h);
++s->mb_y;
if(FIELD_OR_MBAFF_PICTURE) {
@@ -7010,7 +7011,7 @@ static int decode_slice(struct AVCodecContext *avctx, H264Context *h){
if(++s->mb_x >= s->mb_width){
s->mb_x=0;
- ff_draw_horiz_band(s, 16*s->mb_y, (FIELD_OR_MBAFF_PICTURE && (s->mb_y + 1 < s->mb_height)) ? 32 : 16);
+ ff_draw_horiz_band(s, 16*s->mb_y >> FIELD_PICTURE, FRAME_MBAFF ? 32 : 16);
report_decode_progress(avctx, h);
++s->mb_y;
if(FIELD_OR_MBAFF_PICTURE) {
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 5a24200..5f6473a 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1044,9 +1044,9 @@ void MPV_frame_end(MpegEncContext *s)
if(s->error_count && s->unrestricted_mv && s->current_picture.reference && !s->intra_only && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
int edges = EDGE_BOTTOM | EDGE_TOP, h = s->v_edge_pos;
- s->dsp.draw_edges(s->current_picture.data[0], s->linesize , s->h_edge_pos , h , EDGE_WIDTH , edges);
- s->dsp.draw_edges(s->current_picture.data[1], s->uvlinesize, s->h_edge_pos>>1, h>>1, EDGE_WIDTH/2, edges);
- s->dsp.draw_edges(s->current_picture.data[2], s->uvlinesize, s->h_edge_pos>>1, h>>1, EDGE_WIDTH/2, edges);
+ s->dsp.draw_edges(s->current_picture_ptr->data[0], s->linesize , s->h_edge_pos , h , EDGE_WIDTH , edges);
+ s->dsp.draw_edges(s->current_picture_ptr->data[1], s->uvlinesize, s->h_edge_pos>>1, h>>1, EDGE_WIDTH/2, edges);
+ s->dsp.draw_edges(s->current_picture_ptr->data[2], s->uvlinesize, s->h_edge_pos>>1, h>>1, EDGE_WIDTH/2, edges);
}
emms_c();
@@ -2119,28 +2119,29 @@ 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->picture_structure != PICT_FRAME){
+ h <<= 1;
+ y <<= 1;
+ }
+
+ h= FFMIN(h, s->avctx->height - y);
+
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;
- s->dsp.draw_edges(s->current_picture.data[0] + y *s->linesize , s->linesize , s->h_edge_pos , h , EDGE_WIDTH , sides);
- s->dsp.draw_edges(s->current_picture.data[1] + (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] + (y>>1)*s->uvlinesize, s->uvlinesize, s->h_edge_pos>>1, h>>1, EDGE_WIDTH/2, sides);
+ s->dsp.draw_edges(s->current_picture_ptr->data[0] + y *s->linesize , s->linesize , s->h_edge_pos , h , EDGE_WIDTH , sides);
+ s->dsp.draw_edges(s->current_picture_ptr->data[1] + (y>>1)*s->uvlinesize, s->uvlinesize, s->h_edge_pos>>1, h>>1, EDGE_WIDTH/2, sides);
+ s->dsp.draw_edges(s->current_picture_ptr->data[2] + (y>>1)*s->uvlinesize, s->uvlinesize, s->h_edge_pos>>1, h>>1, EDGE_WIDTH/2, sides);
}
+ if(s->picture_structure != PICT_FRAME && s->first_field && !(s->avctx->slice_flags&SLICE_FLAG_ALLOW_FIELD)) return;
+
if (s->avctx->draw_horiz_band) {
AVFrame *src;
int offset[4];
- if(s->picture_structure != PICT_FRAME){
- h <<= 1;
- y <<= 1;
- if(s->first_field && !(s->avctx->slice_flags&SLICE_FLAG_ALLOW_FIELD)) return;
- }
-
- h= FFMIN(h, s->avctx->height - y);
-
if(s->pict_type==FF_B_TYPE || s->low_delay || (s->avctx->slice_flags&SLICE_FLAG_CODED_ORDER))
src= (AVFrame*)s->current_picture_ptr;
else if(s->last_picture_ptr)
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc