aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2011-05-19 16:47:59 -0400
committerRonald S. Bultje <rsbultje@gmail.com>2011-05-19 20:32:18 -0400
commit4e987f8282ff7658a6f804b9db39954bb59fa72e (patch)
tree0c4ed079eba59a0b027d6de6fee34776d5e02365 /libavcodec
parent0ffc84150599d15b66a3960202e07755f99fe0d0 (diff)
downloadffmpeg-4e987f8282ff7658a6f804b9db39954bb59fa72e.tar.gz
h264: correct border check.
When backing up the top-left border, check that the top-left (rather than left) MB indeed does belong to our slice. If it doesn't, backing up has no positive effect but may accidentally interfere with other threads writing in the same space. Fixes occasional one-off effects when enabling slice-MT.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 5338146499..5fb303c82f 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1034,7 +1034,7 @@ static inline void xchg_mb_border(H264Context *h, uint8_t *src_y,
int linesize, int uvlinesize,
int xchg, int simple, int pixel_shift){
MpegEncContext * const s = &h->s;
- int deblock_left;
+ int deblock_topleft;
int deblock_top;
int top_idx = 1;
uint8_t *top_border_m1;
@@ -1050,11 +1050,11 @@ static inline void xchg_mb_border(H264Context *h, uint8_t *src_y,
}
if(h->deblocking_filter == 2) {
- deblock_left = h->left_type[0];
- deblock_top = h->top_type;
+ deblock_topleft = h->slice_table[h->mb_xy - 1 - s->mb_stride] == h->slice_num;
+ deblock_top = h->top_type;
} else {
- deblock_left = (s->mb_x > 0);
- deblock_top = (s->mb_y > !!MB_FIELD);
+ deblock_topleft = (s->mb_x > 0);
+ deblock_top = (s->mb_y > !!MB_FIELD);
}
src_y -= linesize + 1 + pixel_shift;
@@ -1077,7 +1077,7 @@ if (xchg) AV_SWAP64(b,a);\
else AV_COPY64(b,a);
if(deblock_top){
- if(deblock_left){
+ if(deblock_topleft){
XCHG(top_border_m1 + (8 << pixel_shift), src_y - (7 << pixel_shift), 1);
}
XCHG(top_border + (0 << pixel_shift), src_y + (1 << pixel_shift), xchg);
@@ -1088,7 +1088,7 @@ else AV_COPY64(b,a);
}
if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
if(deblock_top){
- if(deblock_left){
+ if(deblock_topleft){
XCHG(top_border_m1 + (16 << pixel_shift), src_cb - (7 << pixel_shift), 1);
XCHG(top_border_m1 + (24 << pixel_shift), src_cr - (7 << pixel_shift), 1);
}
@@ -2611,7 +2611,7 @@ static void loop_filter(H264Context *h, int start_x, int end_x){
}
}
h->slice_type= old_slice_type;
- s->mb_x= 0;
+ s->mb_x= end_x;
s->mb_y= end_mb_y - FRAME_MBAFF;
h->chroma_qp[0] = get_chroma_qp(h, 0, s->qscale);
h->chroma_qp[1] = get_chroma_qp(h, 1, s->qscale);