]> granicus.if.org Git - libvpx/commitdiff
Enable ADST for UV channel
authorhui su <huisu@google.com>
Mon, 24 Aug 2015 21:37:54 +0000 (14:37 -0700)
committerhui su <huisu@google.com>
Wed, 26 Aug 2015 20:25:30 +0000 (13:25 -0700)
derflr +0.202%
hevclf +0.207%
hevcmr +0.095%
hevchr +0.077%

Tested locally on several derf sequences, speed (encoder + decoder)
is slower by less than 1%.

It is part of the EXT_TX experiment, which is to be continued to
explore different transform variants.

Change-Id: I05d44994a62106538a9a241ed8d89bd7c5d14761

configure
vp10/common/blockd.h
vp10/decoder/decodeframe.c
vp10/encoder/encodemb.c
vp10/encoder/pickmode.c
vp10/encoder/rdopt.c
vp10/encoder/tokenize.c

index ac196dacb10e068b3176f219bb052001da38b086..6bb90e386eeca2e927fc0d9da03cbcfdec28d259 100755 (executable)
--- a/configure
+++ b/configure
@@ -264,6 +264,7 @@ EXPERIMENT_LIST="
     spatial_svc
     fp_mb_stats
     emulate_hardware
+    ext_tx
 "
 CONFIG_LIST="
     dependency_tracking
index 26703d1671bd9f0df930995b1c353e193d4c3baa..09406a32a34bc7fde49f9940254522cf5d726908 100644 (file)
@@ -219,15 +219,21 @@ static const TX_TYPE intra_mode_to_tx_type_lookup[INTRA_MODES] = {
 };
 
 static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd,
-                                  int block_idx) {
+                                  int block_idx, TX_SIZE tx_size) {
   const MODE_INFO *const mi = xd->mi[0];
   const MB_MODE_INFO *const mbmi = &mi->mbmi;
 
+#if CONFIG_EXT_TX
+  if (xd->lossless || is_inter_block(mbmi) || tx_size >= TX_32X32)
+    return DCT_DCT;
+  return intra_mode_to_tx_type_lookup[plane_type == PLANE_TYPE_Y ?
+      get_y_mode(mi, block_idx) : mbmi->uv_mode];
+#else
   if (plane_type != PLANE_TYPE_Y || xd->lossless || is_inter_block(mbmi) ||
-      mbmi->tx_size >= TX_32X32)
+      tx_size >= TX_32X32)
     return DCT_DCT;
-
   return intra_mode_to_tx_type_lookup[get_y_mode(mi, block_idx)];
+#endif  // CONFIG_EXT_TX
 }
 
 void vp10_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y);
index 6cb2ff54ca96600ec699892a5755bdc364ce8204..e113cdbe285f7acd0a26218ad2dd4cd5ff813d8b 100644 (file)
@@ -188,7 +188,7 @@ static void inverse_transform_block_inter(MACROBLOCKD* xd, int plane,
                                           uint8_t *dst, int stride,
                                           int eob, int block) {
   struct macroblockd_plane *const pd = &xd->plane[plane];
-  TX_TYPE tx_type = get_tx_type(pd->plane_type, xd, block);
+  TX_TYPE tx_type = get_tx_type(pd->plane_type, xd, block, tx_size);
   if (eob > 0) {
     tran_low_t *const dqcoeff = pd->dqcoeff;
 #if CONFIG_VP9_HIGHBITDEPTH
@@ -347,7 +347,7 @@ static void predict_and_reconstruct_intra_block(MACROBLOCKD *const xd,
                           col, row, plane);
 
   if (!mbmi->skip) {
-    TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx);
+    TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx, tx_size);
     const scan_order *sc = get_scan(tx_size, tx_type);
     const int eob = vp10_decode_block_tokens(xd, plane, sc, col, row, tx_size,
                                              r, mbmi->segment_id);
@@ -362,7 +362,7 @@ static int reconstruct_inter_block(MACROBLOCKD *const xd, vpx_reader *r,
   struct macroblockd_plane *const pd = &xd->plane[plane];
   PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV;
   int block_idx = (row << 1) + col;
-  TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx);
+  TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx, tx_size);
   const scan_order *sc = get_scan(tx_size, tx_type);
   const int eob = vp10_decode_block_tokens(xd, plane, sc, col, row, tx_size, r,
                                           mbmi->segment_id);
index fbc9848c53a4f5a6506f042254df953704f939d6..51b47c9fe3b0782c5efcb8b81468ec53728f5ef6 100644 (file)
@@ -104,7 +104,7 @@ static int optimize_b(MACROBLOCK *mb, int plane, int block,
   const int mul = 1 + (tx_size == TX_32X32);
   const int16_t *dequant_ptr = pd->dequant;
   const uint8_t *const band_translate = get_band_translate(tx_size);
-  TX_TYPE tx_type = get_tx_type(type, xd, block);
+  TX_TYPE tx_type = get_tx_type(type, xd, block, tx_size);
   const scan_order *const so = get_scan(tx_size, tx_type);
   const int16_t *const scan = so->scan;
   const int16_t *const nb = so->neighbors;
@@ -329,7 +329,7 @@ void vp10_xform_quant_fp(MACROBLOCK *x, int plane, int block,
   const struct macroblock_plane *const p = &x->plane[plane];
   const struct macroblockd_plane *const pd = &xd->plane[plane];
   PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV;
-  TX_TYPE tx_type = get_tx_type(plane_type, xd, block);
+  TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
   const scan_order *const scan_order = get_scan(tx_size, tx_type);
   tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block);
   tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
@@ -642,7 +642,7 @@ void vp10_xform_quant(MACROBLOCK *x, int plane, int block,
   const struct macroblock_plane *const p = &x->plane[plane];
   const struct macroblockd_plane *const pd = &xd->plane[plane];
   PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV;
-  TX_TYPE tx_type = get_tx_type(plane_type, xd, block);
+  TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
   const scan_order *const scan_order = get_scan(tx_size, tx_type);
   tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block);
   tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
@@ -741,7 +741,7 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize,
   int i, j;
   uint8_t *dst;
   ENTROPY_CONTEXT *a, *l;
-  TX_TYPE tx_type = get_tx_type(pd->plane_type, xd, block);
+  TX_TYPE tx_type = get_tx_type(pd->plane_type, xd, block, tx_size);
   txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
   dst = &pd->dst.buf[4 * j * pd->dst.stride + 4 * i];
   a = &ctx->ta[plane][i];
@@ -928,7 +928,7 @@ void vp10_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
   tran_low_t *qcoeff = BLOCK_OFFSET(p->qcoeff, block);
   tran_low_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
   PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV;
-  TX_TYPE tx_type = get_tx_type(plane_type, xd, block);
+  TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
   const scan_order *const scan_order = get_scan(tx_size, tx_type);
   PREDICTION_MODE mode;
   const int bwl = b_width_log2_lookup[plane_bsize];
index ef1a0606117778fdfdafd9ee35864dd5b78d07ec..3a542b939fac04141506559228a5e7deeb1427b6 100644 (file)
@@ -601,7 +601,7 @@ static void block_yrd(VP10_COMP *cpi, MACROBLOCK *x, int *rate, int64_t *dist,
     for (c = 0; c < num_4x4_w; c += block_step) {
       if (c < max_blocks_wide) {
         PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV;
-        TX_TYPE tx_type = get_tx_type(plane_type, xd, block);
+        TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
         const scan_order *const scan_order = get_scan(tx_size, tx_type);
         tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block);
         tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
index 14efe0ef08b8e873b3792d36dfc1495530b1f896..ea4dce5b1001f575c426741f64695089503d0fae 100644 (file)
@@ -570,7 +570,7 @@ static void txfm_rd_in_plane(MACROBLOCK *x,
 
   vp10_get_entropy_contexts(bsize, tx_size, pd, args.t_above, args.t_left);
 
-  tx_type = get_tx_type(pd->plane_type, xd, 0);
+  tx_type = get_tx_type(pd->plane_type, xd, 0, tx_size);
   args.so = get_scan(tx_size, tx_type);
 
   vp10_foreach_transformed_block_in_plane(xd, bsize, plane,
@@ -804,7 +804,7 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x,
           vpx_highbd_subtract_block(4, 4, src_diff, 8, src, src_stride,
                                     dst, dst_stride, xd->bd);
           if (xd->lossless) {
-            TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block);
+            TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block, TX_4X4);
             const scan_order *so = get_scan(TX_4X4, tx_type);
             vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT,
                                      vp10_highbd_fwht4x4);
@@ -820,7 +820,7 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x,
                                          vp10_highbd_iwht4x4_add);
           } else {
             int64_t unused;
-            TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block);
+            TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block, TX_4X4);
             const scan_order *so = get_scan(TX_4X4, tx_type);
             vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, tx_type,
                                      vpx_highbd_fdct4x4);
@@ -909,7 +909,7 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x,
         vpx_subtract_block(4, 4, src_diff, 8, src, src_stride, dst, dst_stride);
 
         if (xd->lossless) {
-          TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block);
+          TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block, TX_4X4);
           const scan_order *so = get_scan(TX_4X4, tx_type);
           vp10_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, vp10_fwht4x4);
           vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan);
@@ -923,7 +923,7 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x,
                                 vp10_iwht4x4_add);
         } else {
           int64_t unused;
-          TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block);
+          TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block, TX_4X4);
           const scan_order *so = get_scan(TX_4X4, tx_type);
           vp10_fwd_txfm_4x4(src_diff, coeff, 8, tx_type, vpx_fdct4x4);
           vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan);
@@ -1316,7 +1316,7 @@ static int64_t encode_inter_mb_segment(VP10_COMP *cpi,
                                                             pd->dst.stride)];
   int64_t thisdistortion = 0, thissse = 0;
   int thisrate = 0, ref;
-  TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, i);
+  TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, i, TX_4X4);
   const scan_order *so = get_scan(TX_4X4, tx_type);
   const int is_compound = has_second_ref(&mi->mbmi);
   const InterpKernel *kernel = vp10_filter_kernels[mi->mbmi.interp_filter];
index af915feeda49453c683fc53793f6339de3fd4e4d..b2ee95e7f429166e37b5470b7f003c8fae1691a2 100644 (file)
@@ -507,7 +507,7 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize,
   const tran_low_t *qcoeff = BLOCK_OFFSET(p->qcoeff, block);
   const int segment_id = mbmi->segment_id;
   const int16_t *scan, *nb;
-  const TX_TYPE tx_type = get_tx_type(type, xd, block);
+  const TX_TYPE tx_type = get_tx_type(type, xd, block, tx_size);
   const scan_order *const so = get_scan(tx_size, tx_type);
   const int ref = is_inter_block(mbmi);
   unsigned int (*const counts)[COEFF_CONTEXTS][ENTROPY_TOKENS] =