]> granicus.if.org Git - libvpx/commitdiff
Resolve merge issues with --enable-pvq
authorYaowu Xu <yaowu@google.com>
Mon, 7 Nov 2016 18:24:14 +0000 (10:24 -0800)
committerYaowu Xu <yaowu@google.com>
Mon, 7 Nov 2016 18:35:55 +0000 (10:35 -0800)
This commit resolves some compiling issues due to merge.

Change-Id: I0eef8aa36c404e185e0b0004948a49307c360d3e

av1/decoder/decodeframe.c
av1/encoder/context_tree.c
av1/encoder/encodeframe.c
av1/encoder/encodemb.c
av1/encoder/encodemb.h
av1/encoder/firstpass.c
av1/encoder/pvq_encoder.c
av1/encoder/rdopt.c
av1/encoder/tokenize.c

index d0907eccca88ffc91e5da25c2fc443ddb82f07a9..de4066673f1964115720a6c8b552b4af3c57381c 100644 (file)
@@ -355,9 +355,8 @@ static int av1_pvq_decode_helper(od_dec_ctx *dec, int16_t *ref_coeff,
 
   od_pvq_decode(dec, ref_int32, out_int32, (int)quant[1] >> quant_shift, pli,
                 bs, OD_PVQ_BETA[use_activity_masking][pli][bs],
-                OD_ROBUST_STREAM,
-                is_keyframe, &flags, ac_dc_coded, dec->state.qm + off,
-                dec->state.qm_inv + off);
+                OD_ROBUST_STREAM, is_keyframe, &flags, ac_dc_coded,
+                dec->state.qm + off, dec->state.qm_inv + off);
 
   // copy int32 result back to int16
   for (i = 0; i < blk_size * blk_size; i++) dqcoeff_pvq[i] = out_int32[i];
@@ -379,9 +378,9 @@ static int av1_pvq_decode_helper(od_dec_ctx *dec, int16_t *ref_coeff,
   return eob;
 }
 
-static int av1_pvq_decode_helper2(
-    MACROBLOCKD *const xd, MB_MODE_INFO *const mbmi, int plane, int row,
-    int col, TX_SIZE tx_size, TX_TYPE tx_type ) {
+static int av1_pvq_decode_helper2(MACROBLOCKD *const xd,
+                                  MB_MODE_INFO *const mbmi, int plane, int row,
+                                  int col, TX_SIZE tx_size, TX_TYPE tx_type) {
   struct macroblockd_plane *const pd = &xd->plane[plane];
   // transform block size in pixels
   int tx_blk_size = tx_size_wide[tx_size];
@@ -411,6 +410,8 @@ static int av1_pvq_decode_helper2(
     int seg_id = mbmi->segment_id;
     int16_t *quant;
     FWD_TXFM_PARAM fwd_txfm_param;
+    // ToDo(yaowu): figure out how to initialize this
+    int max_scan_line = 0;
 
     for (j = 0; j < tx_blk_size; j++)
       for (i = 0; i < tx_blk_size; i++) {
@@ -436,8 +437,8 @@ static int av1_pvq_decode_helper2(
     for (j = 0; j < tx_blk_size; j++)
       for (i = 0; i < tx_blk_size; i++) dst[j * pd->dst.stride + i] = 0;
 
-    inverse_transform_block(xd, plane, tx_type, tx_size, dst,
-                            pd->dst.stride, eob);
+    inverse_transform_block(xd, plane, tx_type, tx_size, dst, pd->dst.stride,
+                            max_scan_line, eob);
   }
 
   return eob;
@@ -553,7 +554,6 @@ static int reconstruct_inter_block(AV1_COMMON *cm, MACROBLOCKD *const xd,
 #endif
                                    int segment_id, int plane, int row, int col,
                                    TX_SIZE tx_size) {
-  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_size);
@@ -561,6 +561,9 @@ static int reconstruct_inter_block(AV1_COMMON *cm, MACROBLOCKD *const xd,
   int eob;
   (void)cm;
   (void)r;
+  (void)segment_id;
+#else
+  struct macroblockd_plane *const pd = &xd->plane[plane];
 #endif
 
 #if !CONFIG_PVQ
@@ -577,7 +580,8 @@ static int reconstruct_inter_block(AV1_COMMON *cm, MACROBLOCKD *const xd,
                             &pd->dst.buf[4 * row * pd->dst.stride + 4 * col],
                             pd->dst.stride, max_scan_line, eob);
 #else
-  eob = av1_pvq_decode_helper2(xd, mbmi, plane, row, col, tx_size, tx_type);
+  eob = av1_pvq_decode_helper2(xd, &xd->mi[0]->mbmi, plane, row, col, tx_size,
+                               tx_type);
 #endif
   return eob;
 }
@@ -3032,7 +3036,7 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
               : NULL;
       av1_zero(td->dqcoeff);
 #if CONFIG_PVQ
-      av1_zero(tile_data->pvq_ref_coeff);
+      av1_zero(td->pvq_ref_coeff);
 #endif
       av1_tile_init(&td->xd.tile, td->cm, tile_row, tile_col);
 #if !CONFIG_ANS
@@ -3394,7 +3398,7 @@ static const uint8_t *decode_tiles_mt(AV1Decoder *pbi, const uint8_t *data,
 #endif
                              twd->dqcoeff);
 #if CONFIG_PVQ
-      daala_dec_init(&twd->xd.daala_dec, &twd->bit_reader.ec);
+        daala_dec_init(&twd->xd.daala_dec, &twd->bit_reader.ec);
 #endif
 #if CONFIG_PALETTE
         twd->xd.plane[0].color_index_map = twd->color_index_map[0];
index 239c365fa2a9e896c494cab199d40e2893eb00f5..5a26d9bc42de858d34d3440bcfdd876797cf8339 100644 (file)
@@ -78,8 +78,8 @@ static void free_mode_context(PICK_MODE_CONTEXT *ctx) {
       aom_free(ctx->dqcoeff[i][k]);
       ctx->dqcoeff[i][k] = 0;
 #if CONFIG_PVQ
-    aom_free(ctx->pvq_ref_coeff[i]);
-    ctx->pvq_ref_coeff[i] = 0;
+      aom_free(ctx->pvq_ref_coeff[i]);
+      ctx->pvq_ref_coeff[i] = 0;
 #endif
       aom_free(ctx->eobs[i][k]);
       ctx->eobs[i][k] = 0;
index bb1c15135cdbe48083b649e09d34002c7317400e..0a301861960fe2971eea375c4857a6b563b89437 100644 (file)
@@ -2084,11 +2084,11 @@ typedef struct {
 
 static void restore_context(MACROBLOCK *x,
                             const RD_SEARCH_MACROBLOCK_CONTEXT *ctx, int mi_row,
-                            int mi_col, 
+                            int mi_col,
 #if CONFIG_PVQ
                             od_rollback_buffer *rdo_buf,
-#endif                                                                                                         
-                                                       BLOCK_SIZE bsize) {
+#endif
+                            BLOCK_SIZE bsize) {
   MACROBLOCKD *xd = &x->e_mbd;
   int p;
   const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];
@@ -2124,11 +2124,11 @@ static void restore_context(MACROBLOCK *x,
 }
 
 static void save_context(const MACROBLOCK *x, RD_SEARCH_MACROBLOCK_CONTEXT *ctx,
-                         int mi_row, int mi_col, 
+                         int mi_row, int mi_col,
 #if CONFIG_PVQ
                          od_rollback_buffer *rdo_buf,
 #endif
-                                                BLOCK_SIZE bsize) {
+                         BLOCK_SIZE bsize) {
   const MACROBLOCKD *xd = &x->e_mbd;
   int p;
   const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];
@@ -4499,8 +4499,9 @@ void av1_init_tile_data(AV1_COMP *cpi) {
 #if CONFIG_PVQ
         // This will be dynamically increased as more pvq block is encoded.
         tile_data->pvq_q.buf_len = 1000;
-        CHECK_MEM_ERROR(cm, tile_data->pvq_q.buf,
-                        aom_malloc(tile_data->pvq_q.buf_len * sizeof(PVQ_INFO)));
+        CHECK_MEM_ERROR(
+            cm, tile_data->pvq_q.buf,
+            aom_malloc(tile_data->pvq_q.buf_len * sizeof(PVQ_INFO)));
         tile_data->pvq_q.curr_pos = 0;
 #endif
       }
index 83d463b7bc71a56b54ad65cb4d8f1dcce6dc5829..4d035ae9e928957870015e59e16627535b171dca 100644 (file)
@@ -62,7 +62,6 @@ typedef struct av1_token_state {
   tran_low_t dqc;
 } av1_token_state;
 
-#if !CONFIG_PVQ
 // These numbers are empirically obtained.
 static const int plane_rd_mult[REF_TYPES][PLANE_TYPES] = {
   { 10, 6 }, { 8, 5 },
@@ -404,7 +403,6 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
   assert(final_eob <= default_eob);
   return final_eob;
 }
-#endif  // !CONFIG_PVG
 
 #if CONFIG_AOM_HIGHBITDEPTH
 typedef enum QUANT_FUNC {
@@ -1166,7 +1164,7 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
                             BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
                             void *arg) {
   struct encode_b_args *const args = arg;
-#if !CONFIG_PVG
+#if !CONFIG_PVQ
   AV1_COMMON *cm = args->cm;
 #endif
   MACROBLOCK *const x = args->x;
@@ -1431,8 +1429,7 @@ int av1_pvq_encode_helper(daala_enc_ctx *daala_enc, tran_low_t *const coeff,
       (int)quant[1] >> quant_shift,  // scale/quantizer
       // TODO(yushin): Instead of 0,
       //   use daala_enc->use_activity_masking for activity masking.
-      plane, tx_size, OD_PVQ_BETA[0][plane][tx_size],
-      OD_ROBUST_STREAM,
+      plane, tx_size, OD_PVQ_BETA[0][plane][tx_size], OD_ROBUST_STREAM,
       0,        // is_keyframe,
       0, 0, 0,  // q_scaling, bx, by,
       daala_enc->state.qm + off, daala_enc->state.qm_inv + off,
index 3c496d908bbd6c718b5fed0154c34aad624c66d8..2f2b93bc0bf6bb1e544c19b9a8043b015025026b 100644 (file)
@@ -13,6 +13,7 @@
 #define AV1_ENCODER_ENCODEMB_H_
 
 #include "./aom_config.h"
+#include "av1/common/onyxc_int.h"
 #include "av1/encoder/block.h"
 
 #ifdef __cplusplus
index 2f6731eba87b2472316efb69344ff3d9d361f16a..52a1cce8e0a82261b50a071f7ebe265904a778cc 100644 (file)
@@ -536,7 +536,8 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) {
     od_adapt_ctx *adapt;
 
     pvq_q.buf_len = 5000;
-    CHECK_MEM_ERROR(cm, pvq_q.buf, aom_malloc(pvq_q.buf_len * sizeof(PVQ_INFO)));
+    CHECK_MEM_ERROR(cm, pvq_q.buf,
+                    aom_malloc(pvq_q.buf_len * sizeof(PVQ_INFO)));
     pvq_q.curr_pos = 0;
     x->pvq_coded = 0;
 
index b0ee102a639b1549b8c3f56011c0d21173a135f0..611f0b61a52c01dd0f5974a63f6130bb0e7e6358 100644 (file)
@@ -25,7 +25,7 @@
 #include "av1/common/partition.h"
 #include "av1/common/pvq_state.h"
 #include "av1/encoder/encodemb.h"
-#include "pvq_encoder.h"
+#include "av1/encoder/pvq_encoder.h"
 
 #define OD_PVQ_RATE_APPROX (0)
 /*Shift to ensure that the upper bound (i.e. for the max blocksize) of the
index c0abb68cb6d8d2e663f13dc492c3f636e8ab0e79..9e5419f371f55321f3b96f99cf4ba4c75f0c1cad 100644 (file)
@@ -68,7 +68,6 @@ static const int filter_sets[9][2] = {
 #endif
 #endif
 
-
 #if CONFIG_EXT_REFS
 
 #define LAST_FRAME_MODE_MASK                                      \
@@ -1031,7 +1030,7 @@ static void dist_block(const AV1_COMP *cpi, MACROBLOCK *x, int plane, int block,
     tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block);
     tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
 #if CONFIG_PVQ
-  tran_low_t *ref_coeff = BLOCK_OFFSET(pd->pvq_ref_coeff, block);
+    tran_low_t *ref_coeff = BLOCK_OFFSET(pd->pvq_ref_coeff, block);
 #endif
 #if CONFIG_AOM_HIGHBITDEPTH
     const int bd = (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) ? xd->bd : 8;
index 50735adc99a8f280f48650cbedfe1edfadf2671a..5aafa798e3144790592db1a5590de754231110f1 100644 (file)
@@ -320,6 +320,7 @@ struct tokenize_b_args {
   int this_rate;
 };
 
+#if !CONFIG_PVQ
 static void cost_coeffs_b(int plane, int block, int blk_row, int blk_col,
                           BLOCK_SIZE plane_bsize, TX_SIZE tx_size, void *arg) {
   struct tokenize_b_args *const args = arg;
@@ -343,7 +344,6 @@ static void cost_coeffs_b(int plane, int block, int blk_row, int blk_col,
   av1_set_contexts(xd, pd, tx_size, p->eobs[block] > 0, blk_col, blk_row);
 }
 
-#if !CONFIG_PVQ
 static void set_entropy_context_b(int plane, int block, int blk_row,
                                   int blk_col, BLOCK_SIZE plane_bsize,
                                   TX_SIZE tx_size, void *arg) {
@@ -567,9 +567,10 @@ void add_pvq_block(AV1_COMMON *const cm, MACROBLOCK *const x, PVQ_INFO *pvq) {
   PVQ_QUEUE *q = x->pvq_q;
   if (q->curr_pos >= q->buf_len) {
     q->buf_len = 2 * q->buf_len + 1;
-    CHECK_MEM_ERROR(cm, q->buf, aom_realloc(q->buf, q->buf_len * sizeof(PVQ_INFO)));
+    CHECK_MEM_ERROR(cm, q->buf,
+                    aom_realloc(q->buf, q->buf_len * sizeof(PVQ_INFO)));
   }
-  //memcpy(q->buf + q->curr_pos, pvq, sizeof(PVQ_INFO));
+  // memcpy(q->buf + q->curr_pos, pvq, sizeof(PVQ_INFO));
   OD_COPY(q->buf + q->curr_pos, pvq, 1);
   ++q->curr_pos;
 }
@@ -594,7 +595,7 @@ static void tokenize_pvq(int plane, int block, int blk_row, int blk_col,
 
   assert(block < MAX_PVQ_BLOCKS_IN_SB);
   pvq_info = &x->pvq[block][plane];
-  add_pvq_block((AV1_COMMON *const)cm, x, pvq_info);
+  add_pvq_block((AV1_COMMON * const)cm, x, pvq_info);
 }
 #endif
 #if CONFIG_VAR_TX