If deblock_mode==2, we should deblock slice edges also. This
can obviously only be done once all slices have finished
decoding.
---
libavcodec/h264.c | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 616d0a4..aa63fb5 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2556,7 +2556,7 @@ static int fill_filter_caches(H264Context *h, int
mb_type){
return 0;
}
-static void loop_filter(H264Context *h){
+static void loop_filter(H264Context *h, int pass1){
MpegEncContext * const s = &h->s;
uint8_t *dest_y, *dest_cb, *dest_cr;
int linesize, uvlinesize, mb_x, mb_y;
@@ -2595,8 +2595,10 @@ static void loop_filter(H264Context *h){
linesize = h->mb_linesize = s->linesize;
uvlinesize = h->mb_uvlinesize = s->uvlinesize;
}
- backup_mb_border(h, dest_y, dest_cb, dest_cr, linesize,
uvlinesize, 0);
- if(fill_filter_caches(h, mb_type))
+ if (pass1)
+ backup_mb_border(h, dest_y, dest_cb, dest_cr, linesize,
uvlinesize, 0);
+ if((pass1 && h->deblocking_filter == 2 &&
s->avctx->active_thread_type & FF_THREAD_SLICE) ||
+ fill_filter_caches(h, mb_type))
continue;
h->chroma_qp[0] = get_chroma_qp(h, 0,
s->current_picture.qscale_table[mb_xy]);
h->chroma_qp[1] = get_chroma_qp(h, 1,
s->current_picture.qscale_table[mb_xy]);
@@ -2679,7 +2681,7 @@ static int decode_slice(struct AVCodecContext *avctx,
void *arg){
if( ++s->mb_x >= s->mb_width ) {
s->mb_x = 0;
- loop_filter(h);
+ loop_filter(h, 1);
ff_draw_horiz_band(s, 16*s->mb_y, 16);
++s->mb_y;
if(FIELD_OR_MBAFF_PICTURE) {
@@ -2719,7 +2721,7 @@ static int decode_slice(struct AVCodecContext *avctx,
void *arg){
if(++s->mb_x >= s->mb_width){
s->mb_x=0;
- loop_filter(h);
+ loop_filter(h, 1);
ff_draw_horiz_band(s, 16*s->mb_y, 16);
++s->mb_y;
if(FIELD_OR_MBAFF_PICTURE) {
@@ -2815,7 +2817,7 @@ static void execute_decode_slices(H264Context *h, int
context_count){
MpegEncContext * const s = &h->s;
AVCodecContext * const avctx= s->avctx;
H264Context *hx;
- int i;
+ int i, start_y = s->mb_y;
if (s->avctx->hwaccel)
return;
@@ -2842,6 +2844,15 @@ static void execute_decode_slices(H264Context *h, int
context_count){
for(i = 1; i < context_count; i++)
h->s.error_count += h->thread_context[i]->s.error_count;
}
+
+ if (h->deblocking_filter == 2 && s->avctx->active_thread_type &
FF_THREAD_SLICE) {
+ int end_y = s->mb_y, y;
+ /* run delayed loopfilter */
+ for (y = start_y; y < end_y; y++) {
+ s->mb_y = y;
+ loop_filter(h, 0);
+ }
+ }
}
--
1.7.4.4
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel