[FFmpeg-cvslog] vp9: fix segmentation map retention with threading enabled.

2015-03-28 Thread Ronald S. Bultje
ffmpeg | branch: release/2.4 | Ronald S. Bultje  | Fri Mar  
6 21:07:54 2015 -0500| [54d40b7c459e1d87cea813eb34f14558f537e515] | committer: 
Michael Niedermayer

vp9: fix segmentation map retention with threading enabled.

Fixes ticket 4359.

Signed-off-by: Michael Niedermayer 
(cherry picked from commit efff3854f05d171f5ad3e4f4206533b255a6d267)

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=54d40b7c459e1d87cea813eb34f14558f537e515
---

 libavcodec/vp9.c |   16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index c8653d0..8861cc0 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -278,7 +278,8 @@ static int vp9_alloc_frame(AVCodecContext *ctx, VP9Frame *f)
 
 // retain segmentation map if it doesn't update
 if (s->segmentation.enabled && !s->segmentation.update_map &&
-!s->intraonly && !s->keyframe && !s->errorres) {
+!s->intraonly && !s->keyframe && !s->errorres &&
+ctx->active_thread_type != FF_THREAD_FRAME) {
 memcpy(f->segmentation_map, s->frames[LAST_FRAME].segmentation_map, 
sz);
 }
 
@@ -1350,9 +1351,18 @@ static void decode_mode(AVCodecContext *ctx)
 
 if (!s->last_uses_2pass)
 ff_thread_await_progress(&s->frames[LAST_FRAME].tf, row >> 3, 
0);
-for (y = 0; y < h4; y++)
+for (y = 0; y < h4; y++) {
+int idx_base = (y + row) * 8 * s->sb_cols + col;
 for (x = 0; x < w4; x++)
-pred = FFMIN(pred, refsegmap[(y + row) * 8 * s->sb_cols + 
x + col]);
+pred = FFMIN(pred, refsegmap[idx_base + x]);
+if (!s->segmentation.update_map && ctx->active_thread_type == 
FF_THREAD_FRAME) {
+// FIXME maybe retain reference to previous frame as
+// segmap reference instead of copying the whole map
+// into a new buffer
+memcpy(&s->frames[CUR_FRAME].segmentation_map[idx_base],
+   &refsegmap[idx_base], w4);
+}
+}
 av_assert1(pred < 8);
 b->seg_id = pred;
 } else {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] vp9: fix segmentation map retention with threading enabled.

2015-03-20 Thread Ronald S. Bultje
ffmpeg | branch: release/2.5 | Ronald S. Bultje  | Fri Mar  
6 21:07:54 2015 -0500| [032476f8309bdbed00b2a4da03eb5b64ec5877c2] | committer: 
Michael Niedermayer

vp9: fix segmentation map retention with threading enabled.

Fixes ticket 4359.

Signed-off-by: Michael Niedermayer 
(cherry picked from commit efff3854f05d171f5ad3e4f4206533b255a6d267)

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=032476f8309bdbed00b2a4da03eb5b64ec5877c2
---

 libavcodec/vp9.c |   16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index a956567..c10f85e 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -279,7 +279,8 @@ static int vp9_alloc_frame(AVCodecContext *ctx, VP9Frame *f)
 
 // retain segmentation map if it doesn't update
 if (s->segmentation.enabled && !s->segmentation.update_map &&
-!s->intraonly && !s->keyframe && !s->errorres) {
+!s->intraonly && !s->keyframe && !s->errorres &&
+ctx->active_thread_type != FF_THREAD_FRAME) {
 memcpy(f->segmentation_map, s->frames[LAST_FRAME].segmentation_map, 
sz);
 }
 
@@ -1351,9 +1352,18 @@ static void decode_mode(AVCodecContext *ctx)
 
 if (!s->last_uses_2pass)
 ff_thread_await_progress(&s->frames[LAST_FRAME].tf, row >> 3, 
0);
-for (y = 0; y < h4; y++)
+for (y = 0; y < h4; y++) {
+int idx_base = (y + row) * 8 * s->sb_cols + col;
 for (x = 0; x < w4; x++)
-pred = FFMIN(pred, refsegmap[(y + row) * 8 * s->sb_cols + 
x + col]);
+pred = FFMIN(pred, refsegmap[idx_base + x]);
+if (!s->segmentation.update_map && ctx->active_thread_type == 
FF_THREAD_FRAME) {
+// FIXME maybe retain reference to previous frame as
+// segmap reference instead of copying the whole map
+// into a new buffer
+memcpy(&s->frames[CUR_FRAME].segmentation_map[idx_base],
+   &refsegmap[idx_base], w4);
+}
+}
 av_assert1(pred < 8);
 b->seg_id = pred;
 } else {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] vp9: fix segmentation map retention with threading enabled.

2015-03-14 Thread Ronald S. Bultje
ffmpeg | branch: release/2.2 | Ronald S. Bultje  | Fri Mar  
6 21:07:54 2015 -0500| [2cde388aeabcbeb69fd899c4171729ddd824be7f] | committer: 
Michael Niedermayer

vp9: fix segmentation map retention with threading enabled.

Fixes ticket 4359.

Signed-off-by: Michael Niedermayer 
(cherry picked from commit efff3854f05d171f5ad3e4f4206533b255a6d267)

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2cde388aeabcbeb69fd899c4171729ddd824be7f
---

 libavcodec/vp9.c |   16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 3306c57..07d1497 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -278,7 +278,8 @@ static int vp9_alloc_frame(AVCodecContext *ctx, VP9Frame *f)
 
 // retain segmentation map if it doesn't update
 if (s->segmentation.enabled && !s->segmentation.update_map &&
-!s->intraonly && !s->keyframe && !s->errorres) {
+!s->intraonly && !s->keyframe && !s->errorres &&
+ctx->active_thread_type != FF_THREAD_FRAME) {
 memcpy(f->segmentation_map, s->frames[LAST_FRAME].segmentation_map, 
sz);
 }
 
@@ -1350,9 +1351,18 @@ static void decode_mode(AVCodecContext *ctx)
 
 if (!s->last_uses_2pass)
 ff_thread_await_progress(&s->frames[LAST_FRAME].tf, row >> 3, 
0);
-for (y = 0; y < h4; y++)
+for (y = 0; y < h4; y++) {
+int idx_base = (y + row) * 8 * s->sb_cols + col;
 for (x = 0; x < w4; x++)
-pred = FFMIN(pred, refsegmap[(y + row) * 8 * s->sb_cols + 
x + col]);
+pred = FFMIN(pred, refsegmap[idx_base + x]);
+if (!s->segmentation.update_map && ctx->active_thread_type == 
FF_THREAD_FRAME) {
+// FIXME maybe retain reference to previous frame as
+// segmap reference instead of copying the whole map
+// into a new buffer
+memcpy(&s->frames[CUR_FRAME].segmentation_map[idx_base],
+   &refsegmap[idx_base], w4);
+}
+}
 av_assert1(pred < 8);
 b->seg_id = pred;
 } else {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] vp9: fix segmentation map retention with threading enabled.

2015-03-07 Thread Ronald S. Bultje
ffmpeg | branch: release/2.6 | Ronald S. Bultje  | Fri Mar  
6 21:07:54 2015 -0500| [1caad745333c0477edbb3ef873612165f4455026] | committer: 
Michael Niedermayer

vp9: fix segmentation map retention with threading enabled.

Fixes ticket 4359.

Signed-off-by: Michael Niedermayer 
(cherry picked from commit efff3854f05d171f5ad3e4f4206533b255a6d267)

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1caad745333c0477edbb3ef873612165f4455026
---

 libavcodec/vp9.c |   16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index c7f351b..b25409f 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -279,7 +279,8 @@ static int vp9_alloc_frame(AVCodecContext *ctx, VP9Frame *f)
 
 // retain segmentation map if it doesn't update
 if (s->segmentation.enabled && !s->segmentation.update_map &&
-!s->intraonly && !s->keyframe && !s->errorres) {
+!s->intraonly && !s->keyframe && !s->errorres &&
+ctx->active_thread_type != FF_THREAD_FRAME) {
 memcpy(f->segmentation_map, s->frames[LAST_FRAME].segmentation_map, 
sz);
 }
 
@@ -1351,9 +1352,18 @@ static void decode_mode(AVCodecContext *ctx)
 
 if (!s->last_uses_2pass)
 ff_thread_await_progress(&s->frames[LAST_FRAME].tf, row >> 3, 
0);
-for (y = 0; y < h4; y++)
+for (y = 0; y < h4; y++) {
+int idx_base = (y + row) * 8 * s->sb_cols + col;
 for (x = 0; x < w4; x++)
-pred = FFMIN(pred, refsegmap[(y + row) * 8 * s->sb_cols + 
x + col]);
+pred = FFMIN(pred, refsegmap[idx_base + x]);
+if (!s->segmentation.update_map && ctx->active_thread_type == 
FF_THREAD_FRAME) {
+// FIXME maybe retain reference to previous frame as
+// segmap reference instead of copying the whole map
+// into a new buffer
+memcpy(&s->frames[CUR_FRAME].segmentation_map[idx_base],
+   &refsegmap[idx_base], w4);
+}
+}
 av_assert1(pred < 8);
 b->seg_id = pred;
 } else {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] vp9: fix segmentation map retention with threading enabled.

2015-03-06 Thread Ronald S. Bultje
ffmpeg | branch: master | Ronald S. Bultje  | Fri Mar  6 
21:07:54 2015 -0500| [efff3854f05d171f5ad3e4f4206533b255a6d267] | committer: 
Michael Niedermayer

vp9: fix segmentation map retention with threading enabled.

Fixes ticket 4359.

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=efff3854f05d171f5ad3e4f4206533b255a6d267
---

 libavcodec/vp9.c |   16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index c7f351b..b25409f 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -279,7 +279,8 @@ static int vp9_alloc_frame(AVCodecContext *ctx, VP9Frame *f)
 
 // retain segmentation map if it doesn't update
 if (s->segmentation.enabled && !s->segmentation.update_map &&
-!s->intraonly && !s->keyframe && !s->errorres) {
+!s->intraonly && !s->keyframe && !s->errorres &&
+ctx->active_thread_type != FF_THREAD_FRAME) {
 memcpy(f->segmentation_map, s->frames[LAST_FRAME].segmentation_map, 
sz);
 }
 
@@ -1351,9 +1352,18 @@ static void decode_mode(AVCodecContext *ctx)
 
 if (!s->last_uses_2pass)
 ff_thread_await_progress(&s->frames[LAST_FRAME].tf, row >> 3, 
0);
-for (y = 0; y < h4; y++)
+for (y = 0; y < h4; y++) {
+int idx_base = (y + row) * 8 * s->sb_cols + col;
 for (x = 0; x < w4; x++)
-pred = FFMIN(pred, refsegmap[(y + row) * 8 * s->sb_cols + 
x + col]);
+pred = FFMIN(pred, refsegmap[idx_base + x]);
+if (!s->segmentation.update_map && ctx->active_thread_type == 
FF_THREAD_FRAME) {
+// FIXME maybe retain reference to previous frame as
+// segmap reference instead of copying the whole map
+// into a new buffer
+memcpy(&s->frames[CUR_FRAME].segmentation_map[idx_base],
+   &refsegmap[idx_base], w4);
+}
+}
 av_assert1(pred < 8);
 b->seg_id = pred;
 } else {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog