[FFmpeg-cvslog] hevc/sao: do in-place band filtering when possible

Christophe Gisquet git at videolan.org
Sat Feb 7 18:12:45 CET 2015


ffmpeg | branch: master | Christophe Gisquet <christophe.gisquet at gmail.com> | Tue Feb  3 14:06:39 2015 +0100| [97996eff4f2631fa5fdb6bc76a32b58d8b9f7611] | committer: Michael Niedermayer

hevc/sao: do in-place band filtering when possible

The copies are only needed when data must be restored, so skip them
when it must not be.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/hevc_filter.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c
index 54dc708..855a619 100644
--- a/libavcodec/hevc_filter.c
+++ b/libavcodec/hevc_filter.c
@@ -319,16 +319,23 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y)
 
         switch (sao->type_idx[c_idx]) {
         case SAO_BAND:
+            copy_CTB_to_hv(s, src, stride_src, x0, y0, width, height, c_idx,
+                           x_ctb, y_ctb);
+            if (s->pps->transquant_bypass_enable_flag ||
+                (s->sps->pcm.loop_filter_disable_flag && s->sps->pcm_enabled_flag)) {
             dst = lc->edge_emu_buffer;
             stride_dst = 2*MAX_PB_SIZE;
             copy_CTB(dst, src, width << s->sps->pixel_shift, height, stride_dst, stride_src);
-            copy_CTB_to_hv(s, src, stride_src, x0, y0, width, height, c_idx,
-                           x_ctb, y_ctb);
             s->hevcdsp.sao_band_filter[tab](src, dst, stride_src, stride_dst,
                                             sao->offset_val[c_idx], sao->band_position[c_idx],
                                             width, height);
             restore_tqb_pixels(s, src, dst, stride_src, stride_dst,
                                x, y, width, height, c_idx);
+            } else {
+            s->hevcdsp.sao_band_filter[tab](src, src, stride_src, stride_src,
+                                            sao->offset_val[c_idx], sao->band_position[c_idx],
+                                            width, height);
+            }
             sao->type_idx[c_idx] = SAO_APPLIED;
             break;
         case SAO_EDGE:



More information about the ffmpeg-cvslog mailing list