vp9_onyx_if.c 133 KB
Newer Older
John Koleszar's avatar
John Koleszar committed
1
/*
2
 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar's avatar
John Koleszar committed
3
 *
4
 *  Use of this source code is governed by a BSD-style license
5
6
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
7
 *  in the file PATENTS.  All contributing project authors may
8
 *  be found in the AUTHORS file in the root of the source tree.
John Koleszar's avatar
John Koleszar committed
9
10
11
 */


12
#include "vpx_config.h"
13
#include "vp9/common/vp9_filter.h"
14
#include "vp9/common/vp9_onyxc_int.h"
15
#include "vp9/common/vp9_reconinter.h"
16
#include "vp9/encoder/vp9_onyx_int.h"
17
#include "vp9/common/vp9_systemdependent.h"
18
#include "vp9/encoder/vp9_quantize.h"
19
#include "vp9/common/vp9_alloccommon.h"
20
21
22
#include "vp9/encoder/vp9_mcomp.h"
#include "vp9/encoder/vp9_firstpass.h"
#include "vp9/encoder/vp9_psnr.h"
Johann's avatar
Johann committed
23
#include "vpx_scale/vpx_scale.h"
24
#include "vp9/common/vp9_extend.h"
25
#include "vp9/encoder/vp9_ratectrl.h"
26
#include "vp9/common/vp9_quant_common.h"
27
#include "vp9/common/vp9_tile_common.h"
28
#include "vp9/encoder/vp9_segmentation.h"
29
#include "./vp9_rtcd.h"
30
#include "./vpx_scale_rtcd.h"
31
#if CONFIG_VP9_POSTPROC
32
#include "vp9/common/vp9_postproc.h"
33
#endif
John Koleszar's avatar
John Koleszar committed
34
35
#include "vpx_mem/vpx_mem.h"
#include "vpx_ports/vpx_timer.h"
36

37
#include "vp9/common/vp9_seg_common.h"
38
#include "vp9/encoder/vp9_mbgraph.h"
39
40
#include "vp9/common/vp9_pred_common.h"
#include "vp9/encoder/vp9_rdopt.h"
41
#include "vp9/encoder/vp9_bitstream.h"
42
43
#include "vp9/encoder/vp9_picklpf.h"
#include "vp9/common/vp9_mvref_common.h"
44
#include "vp9/encoder/vp9_temporal_filter.h"
Paul Wilkins's avatar
Paul Wilkins committed
45

John Koleszar's avatar
John Koleszar committed
46
47
48
49
50
#include <math.h>
#include <stdio.h>
#include <limits.h>

extern void print_tree_update_probs();
51

52
static void set_default_lf_deltas(struct loopfilter *lf);
John Koleszar's avatar
John Koleszar committed
53

Adrian Grange's avatar
Adrian Grange committed
54
55
#define DEFAULT_INTERP_FILTER SWITCHABLE

56
57
58
59
60
61
62
63
#define SHARP_FILTER_QTHRESH 0          /* Q threshold for 8-tap sharp filter */

#define ALTREF_HIGH_PRECISION_MV 1      /* whether to use high precision mv
                                           for altref computation */
#define HIGH_PRECISION_MV_QTHRESH 200   /* Q threshold for use of high precision
                                           mv. Choose a very high value for
                                           now so that HIGH_PRECISION is always
                                           chosen */
64

65
#if CONFIG_INTERNAL_STATS
John Koleszar's avatar
John Koleszar committed
66
67
#include "math.h"

68
extern double vp9_calc_ssim(YV12_BUFFER_CONFIG *source,
69
70
                            YV12_BUFFER_CONFIG *dest, int lumamask,
                            double *weight);
John Koleszar's avatar
John Koleszar committed
71

72

73
extern double vp9_calc_ssimg(YV12_BUFFER_CONFIG *source,
74
75
                             YV12_BUFFER_CONFIG *dest, double *ssim_y,
                             double *ssim_u, double *ssim_v);
John Koleszar's avatar
John Koleszar committed
76
77
78
79


#endif

John Koleszar's avatar
John Koleszar committed
80
// #define OUTPUT_YUV_REC
John Koleszar's avatar
John Koleszar committed
81
82
83
84

#ifdef OUTPUT_YUV_SRC
FILE *yuv_file;
#endif
85
86
87
#ifdef OUTPUT_YUV_REC
FILE *yuv_rec_file;
#endif
John Koleszar's avatar
John Koleszar committed
88
89
90

#if 0
FILE *framepsnr;
Yaowu Xu's avatar
Yaowu Xu committed
91
FILE *kf_list;
John Koleszar's avatar
John Koleszar committed
92
93
94
95
96
FILE *keyfile;
#endif


#ifdef ENTROPY_STATS
97
98
99
extern int intra_mode_stats[INTRA_MODES]
                           [INTRA_MODES]
                           [INTRA_MODES];
John Koleszar's avatar
John Koleszar committed
100
101
#endif

102
103
104
#ifdef MODE_STATS
extern void init_tx_count_stats();
extern void write_tx_count_stats();
105
106
extern void init_switchable_interp_stats();
extern void write_switchable_interp_stats();
107
#endif
108

John Koleszar's avatar
John Koleszar committed
109
110
111
112
#ifdef SPEEDSTATS
unsigned int frames_at_speed[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
#endif

113
114
115
#if defined(SECTIONBITS_OUTPUT)
extern unsigned __int64 Sectionbits[500];
#endif
John Koleszar's avatar
John Koleszar committed
116

117
extern void vp9_init_quantizer(VP9_COMP *cpi);
Paul Wilkins's avatar
Paul Wilkins committed
118

119
// Tables relating active max Q to active min Q
120
121
122
123
124
static int kf_low_motion_minq[QINDEX_RANGE];
static int kf_high_motion_minq[QINDEX_RANGE];
static int gf_low_motion_minq[QINDEX_RANGE];
static int gf_high_motion_minq[QINDEX_RANGE];
static int inter_minq[QINDEX_RANGE];
125
126
static int afq_low_motion_minq[QINDEX_RANGE];
static int afq_high_motion_minq[QINDEX_RANGE];
127

128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
static INLINE void Scale2Ratio(int mode, int *hr, int *hs) {
  switch (mode) {
    case NORMAL:
      *hr = 1;
      *hs = 1;
      break;
    case FOURFIVE:
      *hr = 4;
      *hs = 5;
      break;
    case THREEFIVE:
      *hr = 3;
      *hs = 5;
    break;
    case ONETWO:
      *hr = 1;
      *hs = 2;
    break;
    default:
      *hr = 1;
      *hs = 1;
       assert(0);
      break;
  }
}

154
155
156
157
// Functions to compute the active minq lookup table entries based on a
// formulaic approach to facilitate easier adjustment of the Q tables.
// The formulae were derived from computing a 3rd order polynomial best
// fit to the original data (after plotting real maxq vs minq (not q index))
158
static int calculate_minq_index(double maxq,
Dmitry Kovalev's avatar
Dmitry Kovalev committed
159
                                double x3, double x2, double x1, double c) {
John Koleszar's avatar
John Koleszar committed
160
  int i;
Dmitry Kovalev's avatar
Dmitry Kovalev committed
161
162
  const double minqtarget = MIN(((x3 * maxq + x2) * maxq + x1) * maxq + c,
                                maxq);
John Koleszar's avatar
John Koleszar committed
163

Paul Wilkins's avatar
Paul Wilkins committed
164
165
166
167
168
  // Special case handling to deal with the step from q2.0
  // down to lossless mode represented by q 1.0.
  if (minqtarget <= 2.0)
    return 0;

John Koleszar's avatar
John Koleszar committed
169
  for (i = 0; i < QINDEX_RANGE; i++) {
170
    if (minqtarget <= vp9_convert_qindex_to_q(i))
John Koleszar's avatar
John Koleszar committed
171
172
      return i;
  }
Dmitry Kovalev's avatar
Dmitry Kovalev committed
173

John Koleszar's avatar
John Koleszar committed
174
  return QINDEX_RANGE - 1;
175
}
176

177
static void init_minq_luts(void) {
John Koleszar's avatar
John Koleszar committed
178
179
180
  int i;

  for (i = 0; i < QINDEX_RANGE; i++) {
Dmitry Kovalev's avatar
Dmitry Kovalev committed
181
    const double maxq = vp9_convert_qindex_to_q(i);
John Koleszar's avatar
John Koleszar committed
182
183
184


    kf_low_motion_minq[i] = calculate_minq_index(maxq,
185
186
187
                                                 0.000001,
                                                 -0.0004,
                                                 0.15,
John Koleszar's avatar
John Koleszar committed
188
189
                                                 0.0);
    kf_high_motion_minq[i] = calculate_minq_index(maxq,
190
191
192
                                                  0.000002,
                                                  -0.0012,
                                                  0.5,
John Koleszar's avatar
John Koleszar committed
193
                                                  0.0);
194

John Koleszar's avatar
John Koleszar committed
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
    gf_low_motion_minq[i] = calculate_minq_index(maxq,
                                                 0.0000015,
                                                 -0.0009,
                                                 0.33,
                                                 0.0);
    gf_high_motion_minq[i] = calculate_minq_index(maxq,
                                                  0.0000021,
                                                  -0.00125,
                                                  0.45,
                                                  0.0);
    inter_minq[i] = calculate_minq_index(maxq,
                                         0.00000271,
                                         -0.00113,
                                         0.697,
                                         0.0);
210
211
212
213
214
215
216
217
    afq_low_motion_minq[i] = calculate_minq_index(maxq,
                                                  0.0000015,
                                                  -0.0009,
                                                  0.33,
                                                  0.0);
    afq_high_motion_minq[i] = calculate_minq_index(maxq,
                                                   0.0000021,
                                                   -0.00125,
218
                                                   0.55,
219
                                                   0.0);
John Koleszar's avatar
John Koleszar committed
220
  }
221
}
222

223
224
225
226
227
228
229
230
231
static void set_mvcost(MACROBLOCK *mb) {
  if (mb->e_mbd.allow_high_precision_mv) {
    mb->mvcost = mb->nmvcost_hp;
    mb->mvsadcost = mb->nmvsadcost_hp;
  } else {
    mb->mvcost = mb->nmvcost;
    mb->mvsadcost = mb->nmvsadcost;
  }
}
Paul Wilkins's avatar
Paul Wilkins committed
232

233
void vp9_initialize_enc() {
John Koleszar's avatar
John Koleszar committed
234
235
236
  static int init_done = 0;

  if (!init_done) {
237
    vp9_initialize_common();
238
    vp9_tokenize_initialize();
239
    vp9_init_quant_tables();
240
    vp9_init_me_luts();
John Koleszar's avatar
John Koleszar committed
241
    init_minq_luts();
Deb Mukherjee's avatar
Deb Mukherjee committed
242
    // init_base_skip_probs();
John Koleszar's avatar
John Koleszar committed
243
244
    init_done = 1;
  }
John Koleszar's avatar
John Koleszar committed
245
246
}

247
248
249
static void setup_features(VP9_COMMON *cm) {
  struct loopfilter *const lf = &cm->lf;
  struct segmentation *const seg = &cm->seg;
Paul Wilkins's avatar
Paul Wilkins committed
250

John Koleszar's avatar
John Koleszar committed
251
  // Set up default state for MB feature flags
252
  seg->enabled = 0;
253

254
255
256
  seg->update_map = 0;
  seg->update_data = 0;
  vpx_memset(seg->tree_probs, 255, sizeof(seg->tree_probs));
Paul Wilkins's avatar
Paul Wilkins committed
257

258
  vp9_clearall_segfeatures(seg);
Paul Wilkins's avatar
Paul Wilkins committed
259

260
261
262
263
264
265
  lf->mode_ref_delta_enabled = 0;
  lf->mode_ref_delta_update = 0;
  vp9_zero(lf->ref_deltas);
  vp9_zero(lf->mode_deltas);
  vp9_zero(lf->last_ref_deltas);
  vp9_zero(lf->last_mode_deltas);
John Koleszar's avatar
John Koleszar committed
266

267
  set_default_lf_deltas(lf);
John Koleszar's avatar
John Koleszar committed
268
269
}

270
static void dealloc_compressor_data(VP9_COMP *cpi) {
John Koleszar's avatar
John Koleszar committed
271
272
273
274
275
276
277
  // Delete sementation map
  vpx_free(cpi->segmentation_map);
  cpi->segmentation_map = 0;
  vpx_free(cpi->common.last_frame_seg_map);
  cpi->common.last_frame_seg_map = 0;
  vpx_free(cpi->coding_context.last_frame_seg_map_copy);
  cpi->coding_context.last_frame_seg_map_copy = 0;
John Koleszar's avatar
John Koleszar committed
278

John Koleszar's avatar
John Koleszar committed
279
280
  vpx_free(cpi->active_map);
  cpi->active_map = 0;
John Koleszar's avatar
John Koleszar committed
281

Dmitry Kovalev's avatar
Dmitry Kovalev committed
282
  vp9_free_frame_buffers(&cpi->common);
John Koleszar's avatar
John Koleszar committed
283

284
285
286
  vp9_free_frame_buffer(&cpi->last_frame_uf);
  vp9_free_frame_buffer(&cpi->scaled_source);
  vp9_free_frame_buffer(&cpi->alt_ref_buffer);
287
  vp9_lookahead_destroy(cpi->lookahead);
John Koleszar's avatar
John Koleszar committed
288

John Koleszar's avatar
John Koleszar committed
289
290
  vpx_free(cpi->tok);
  cpi->tok = 0;
John Koleszar's avatar
John Koleszar committed
291

John Koleszar's avatar
John Koleszar committed
292
293
294
295
296
  // Activity mask based per mb zbin adjustments
  vpx_free(cpi->mb_activity_map);
  cpi->mb_activity_map = 0;
  vpx_free(cpi->mb_norm_activity_map);
  cpi->mb_norm_activity_map = 0;
297

John Koleszar's avatar
John Koleszar committed
298
299
  vpx_free(cpi->mb.pip);
  cpi->mb.pip = 0;
John Koleszar's avatar
John Koleszar committed
300
301
}

302
303
304
// Computes a q delta (in "q index" terms) to get from a starting q value
// to a target value
// target q value
305
static int compute_qdelta(VP9_COMP *cpi, double qstart, double qtarget) {
John Koleszar's avatar
John Koleszar committed
306
307
308
309
310
311
312
  int i;
  int start_index = cpi->worst_quality;
  int target_index = cpi->worst_quality;

  // Convert the average q value to an index.
  for (i = cpi->best_quality; i < cpi->worst_quality; i++) {
    start_index = i;
313
    if (vp9_convert_qindex_to_q(i) >= qstart)
John Koleszar's avatar
John Koleszar committed
314
315
316
317
318
319
      break;
  }

  // Convert the q target to an index
  for (i = cpi->best_quality; i < cpi->worst_quality; i++) {
    target_index = i;
320
    if (vp9_convert_qindex_to_q(i) >= qtarget)
John Koleszar's avatar
John Koleszar committed
321
322
323
324
      break;
  }

  return target_index - start_index;
325
326
}

327
static void configure_static_seg_features(VP9_COMP *cpi) {
328
  VP9_COMMON *cm = &cpi->common;
329
  struct segmentation *seg = &cm->seg;
330

John Koleszar's avatar
John Koleszar committed
331
332
  int high_q = (int)(cpi->avg_q > 48.0);
  int qi_delta;
333

John Koleszar's avatar
John Koleszar committed
334
335
336
  // Disable and clear down for KF
  if (cm->frame_type == KEY_FRAME) {
    // Clear down the global segmentation map
337
    vpx_memset(cpi->segmentation_map, 0, cm->mi_rows * cm->mi_cols);
338
339
    seg->update_map = 0;
    seg->update_data = 0;
John Koleszar's avatar
John Koleszar committed
340
    cpi->static_mb_pct = 0;
341

John Koleszar's avatar
John Koleszar committed
342
    // Disable segmentation
343
    vp9_disable_segmentation((VP9_PTR)cpi);
Paul Wilkins's avatar
Paul Wilkins committed
344

John Koleszar's avatar
John Koleszar committed
345
    // Clear down the segment features.
346
    vp9_clearall_segfeatures(seg);
347
348
  } else if (cpi->refresh_alt_ref_frame) {
    // If this is an alt ref frame
John Koleszar's avatar
John Koleszar committed
349
    // Clear down the global segmentation map
350
    vpx_memset(cpi->segmentation_map, 0, cm->mi_rows * cm->mi_cols);
351
352
    seg->update_map = 0;
    seg->update_data = 0;
John Koleszar's avatar
John Koleszar committed
353
    cpi->static_mb_pct = 0;
Paul Wilkins's avatar
Paul Wilkins committed
354

John Koleszar's avatar
John Koleszar committed
355
    // Disable segmentation and individual segment features by default
356
    vp9_disable_segmentation((VP9_PTR)cpi);
357
    vp9_clearall_segfeatures(seg);
Paul Wilkins's avatar
Paul Wilkins committed
358

John Koleszar's avatar
John Koleszar committed
359
360
    // Scan frames from current to arf frame.
    // This function re-enables segmentation if appropriate.
361
    vp9_update_mbgraph_stats(cpi);
Paul Wilkins's avatar
Paul Wilkins committed
362

John Koleszar's avatar
John Koleszar committed
363
364
    // If segmentation was enabled set those features needed for the
    // arf itself.
365
366
367
    if (seg->enabled) {
      seg->update_map = 1;
      seg->update_data = 1;
Paul Wilkins's avatar
Paul Wilkins committed
368

John Koleszar's avatar
John Koleszar committed
369
      qi_delta = compute_qdelta(cpi, cpi->avg_q, (cpi->avg_q * 0.875));
370
371
      vp9_set_segdata(seg, 1, SEG_LVL_ALT_Q, (qi_delta - 2));
      vp9_set_segdata(seg, 1, SEG_LVL_ALT_LF, -2);
Paul Wilkins's avatar
Paul Wilkins committed
372

373
374
      vp9_enable_segfeature(seg, 1, SEG_LVL_ALT_Q);
      vp9_enable_segfeature(seg, 1, SEG_LVL_ALT_LF);
375

John Koleszar's avatar
John Koleszar committed
376
      // Where relevant assume segment data is delta data
377
      seg->abs_delta = SEGMENT_DELTADATA;
Paul Wilkins's avatar
Paul Wilkins committed
378

379
    }
380
  } else if (seg->enabled) {
381
382
    // All other frames if segmentation has been enabled

John Koleszar's avatar
John Koleszar committed
383
    // First normal frame in a valid gf or alt ref group
384
    if (cpi->frames_since_golden == 0) {
Paul Wilkins's avatar
Paul Wilkins committed
385
      // Set up segment features for normal frames in an arf group
John Koleszar's avatar
John Koleszar committed
386
      if (cpi->source_alt_ref_active) {
387
388
389
        seg->update_map = 0;
        seg->update_data = 1;
        seg->abs_delta = SEGMENT_DELTADATA;
Paul Wilkins's avatar
Paul Wilkins committed
390

John Koleszar's avatar
John Koleszar committed
391
392
        qi_delta = compute_qdelta(cpi, cpi->avg_q,
                                  (cpi->avg_q * 1.125));
393
394
        vp9_set_segdata(seg, 1, SEG_LVL_ALT_Q, (qi_delta + 2));
        vp9_enable_segfeature(seg, 1, SEG_LVL_ALT_Q);
Paul Wilkins's avatar
Paul Wilkins committed
395

396
397
        vp9_set_segdata(seg, 1, SEG_LVL_ALT_LF, -2);
        vp9_enable_segfeature(seg, 1, SEG_LVL_ALT_LF);
Paul Wilkins's avatar
Paul Wilkins committed
398

John Koleszar's avatar
John Koleszar committed
399
400
        // Segment coding disabled for compred testing
        if (high_q || (cpi->static_mb_pct == 100)) {
401
402
403
          vp9_set_segdata(seg, 1, SEG_LVL_REF_FRAME, ALTREF_FRAME);
          vp9_enable_segfeature(seg, 1, SEG_LVL_REF_FRAME);
          vp9_enable_segfeature(seg, 1, SEG_LVL_SKIP);
John Koleszar's avatar
John Koleszar committed
404
        }
405
406
407
408
      } else {
        // Disable segmentation and clear down features if alt ref
        // is not active for this group

409
        vp9_disable_segmentation((VP9_PTR)cpi);
Paul Wilkins's avatar
Paul Wilkins committed
410

411
        vpx_memset(cpi->segmentation_map, 0, cm->mi_rows * cm->mi_cols);
Paul Wilkins's avatar
Paul Wilkins committed
412

413
414
        seg->update_map = 0;
        seg->update_data = 0;
Paul Wilkins's avatar
Paul Wilkins committed
415

416
        vp9_clearall_segfeatures(seg);
John Koleszar's avatar
John Koleszar committed
417
      }
418
419
420
421
    } else if (cpi->is_src_frame_alt_ref) {
      // Special case where we are coding over the top of a previous
      // alt ref frame.
      // Segment coding disabled for compred testing
John Koleszar's avatar
John Koleszar committed
422

Paul Wilkins's avatar
Paul Wilkins committed
423
      // Enable ref frame features for segment 0 as well
424
425
      vp9_enable_segfeature(seg, 0, SEG_LVL_REF_FRAME);
      vp9_enable_segfeature(seg, 1, SEG_LVL_REF_FRAME);
John Koleszar's avatar
John Koleszar committed
426

Paul Wilkins's avatar
Paul Wilkins committed
427
      // All mbs should use ALTREF_FRAME
428
429
430
431
      vp9_clear_segdata(seg, 0, SEG_LVL_REF_FRAME);
      vp9_set_segdata(seg, 0, SEG_LVL_REF_FRAME, ALTREF_FRAME);
      vp9_clear_segdata(seg, 1, SEG_LVL_REF_FRAME);
      vp9_set_segdata(seg, 1, SEG_LVL_REF_FRAME, ALTREF_FRAME);
John Koleszar's avatar
John Koleszar committed
432

Paul Wilkins's avatar
Paul Wilkins committed
433
      // Skip all MBs if high Q (0,0 mv and skip coeffs)
John Koleszar's avatar
John Koleszar committed
434
      if (high_q) {
435
436
          vp9_enable_segfeature(seg, 0, SEG_LVL_SKIP);
          vp9_enable_segfeature(seg, 1, SEG_LVL_SKIP);
John Koleszar's avatar
John Koleszar committed
437
      }
Adrian Grange's avatar
Adrian Grange committed
438
      // Enable data update
439
      seg->update_data = 1;
440
441
442
    } else {
      // All other frames.

John Koleszar's avatar
John Koleszar committed
443
      // No updates.. leave things as they are.
444
445
      seg->update_map = 0;
      seg->update_data = 0;
John Koleszar's avatar
John Koleszar committed
446
447
    }
  }
448
449
}

Paul Wilkins's avatar
Paul Wilkins committed
450
451
452
453
#ifdef ENTROPY_STATS
void vp9_update_mode_context_stats(VP9_COMP *cpi) {
  VP9_COMMON *cm = &cpi->common;
  int i, j;
454
  unsigned int (*inter_mode_counts)[INTER_MODES - 1][2] =
455
      cm->fc.inter_mode_counts;
456
  int64_t (*mv_ref_stats)[INTER_MODES - 1][2] = cpi->mv_ref_stats;
Paul Wilkins's avatar
Paul Wilkins committed
457
458
459
460
461
462
463
464
465
466
467
468
469
  FILE *f;

  // Read the past stats counters
  f = fopen("mode_context.bin",  "rb");
  if (!f) {
    vpx_memset(cpi->mv_ref_stats, 0, sizeof(cpi->mv_ref_stats));
  } else {
    fread(cpi->mv_ref_stats, sizeof(cpi->mv_ref_stats), 1, f);
    fclose(f);
  }

  // Add in the values for this frame
  for (i = 0; i < INTER_MODE_CONTEXTS; i++) {
470
    for (j = 0; j < INTER_MODES - 1; j++) {
471
472
      mv_ref_stats[i][j][0] += (int64_t)inter_mode_counts[i][j][0];
      mv_ref_stats[i][j][1] += (int64_t)inter_mode_counts[i][j][1];
Paul Wilkins's avatar
Paul Wilkins committed
473
474
475
476
477
478
479
480
481
482
483
484
485
486
    }
  }

  // Write back the accumulated stats
  f = fopen("mode_context.bin",  "wb");
  fwrite(cpi->mv_ref_stats, sizeof(cpi->mv_ref_stats), 1, f);
  fclose(f);
}

void print_mode_context(VP9_COMP *cpi) {
  FILE *f = fopen("vp9_modecont.c", "a");
  int i, j;

  fprintf(f, "#include \"vp9_entropy.h\"\n");
487
488
  fprintf(
      f,
489
      "const int inter_mode_probs[INTER_MODE_CONTEXTS][INTER_MODES - 1] =");
Paul Wilkins's avatar
Paul Wilkins committed
490
491
492
493
  fprintf(f, "{\n");
  for (j = 0; j < INTER_MODE_CONTEXTS; j++) {
    fprintf(f, "  {/* %d */ ", j);
    fprintf(f, "    ");
494
    for (i = 0; i < INTER_MODES - 1; i++) {
Paul Wilkins's avatar
Paul Wilkins committed
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
      int this_prob;
      int64_t count = cpi->mv_ref_stats[j][i][0] + cpi->mv_ref_stats[j][i][1];
      if (count)
        this_prob = ((cpi->mv_ref_stats[j][i][0] * 256) + (count >> 1)) / count;
      else
        this_prob = 128;

      // context probs
      fprintf(f, "%5d, ", this_prob);
    }
    fprintf(f, "  },\n");
  }

  fprintf(f, "};\n");
  fclose(f);
}
#endif  // ENTROPY_STATS

513
// DEBUG: Print out the segment id of each MB in the current frame.
514
515
static void print_seg_map(VP9_COMP *cpi) {
  VP9_COMMON *cm = &cpi->common;
John Koleszar's avatar
John Koleszar committed
516
517
  int row, col;
  int map_index = 0;
Dmitry Kovalev's avatar
Dmitry Kovalev committed
518
  FILE *statsfile = fopen("segmap.stt", "a");
519

Dmitry Kovalev's avatar
Dmitry Kovalev committed
520
  fprintf(statsfile, "%10d\n", cm->current_video_frame);
521

522
523
  for (row = 0; row < cpi->common.mi_rows; row++) {
    for (col = 0; col < cpi->common.mi_cols; col++) {
Dmitry Kovalev's avatar
Dmitry Kovalev committed
524
      fprintf(statsfile, "%10d", cpi->segmentation_map[map_index]);
John Koleszar's avatar
John Koleszar committed
525
      map_index++;
526
527
    }
    fprintf(statsfile, "\n");
John Koleszar's avatar
John Koleszar committed
528
529
  }
  fprintf(statsfile, "\n");
530

John Koleszar's avatar
John Koleszar committed
531
  fclose(statsfile);
532
533
}

534
static void update_reference_segmentation_map(VP9_COMP *cpi) {
Ronald S. Bultje's avatar
Ronald S. Bultje committed
535
536
  VP9_COMMON *const cm = &cpi->common;
  int row, col;
537
  MODE_INFO **mi_8x8, **mi_8x8_ptr = cm->mi_grid_visible;
Ronald S. Bultje's avatar
Ronald S. Bultje committed
538
539
  uint8_t *cache_ptr = cm->last_frame_seg_map, *cache;

540
  for (row = 0; row < cm->mi_rows; row++) {
541
    mi_8x8 = mi_8x8_ptr;
Ronald S. Bultje's avatar
Ronald S. Bultje committed
542
    cache = cache_ptr;
543
544
545
    for (col = 0; col < cm->mi_cols; col++, mi_8x8++, cache++)
      cache[0] = mi_8x8[0]->mbmi.segment_id;
    mi_8x8_ptr += cm->mode_info_stride;
546
    cache_ptr += cm->mi_cols;
Ronald S. Bultje's avatar
Ronald S. Bultje committed
547
548
549
  }
}

550
static void set_default_lf_deltas(struct loopfilter *lf) {
551
552
553
554
555
  lf->mode_ref_delta_enabled = 1;
  lf->mode_ref_delta_update = 1;

  vp9_zero(lf->ref_deltas);
  vp9_zero(lf->mode_deltas);
John Koleszar's avatar
John Koleszar committed
556

John Koleszar's avatar
John Koleszar committed
557
  // Test of ref frame deltas
558
559
560
561
  lf->ref_deltas[INTRA_FRAME] = 2;
  lf->ref_deltas[LAST_FRAME] = 0;
  lf->ref_deltas[GOLDEN_FRAME] = -2;
  lf->ref_deltas[ALTREF_FRAME] = -2;
John Koleszar's avatar
John Koleszar committed
562

563
564
  lf->mode_deltas[0] = 0;   // Zero
  lf->mode_deltas[1] = 0;   // New mv
John Koleszar's avatar
John Koleszar committed
565
566
}

Deb Mukherjee's avatar
Deb Mukherjee committed
567
static void set_rd_speed_thresholds(VP9_COMP *cpi, int mode) {
568
569
570
571
  SPEED_FEATURES *sf = &cpi->sf;
  int i;

  // Set baseline threshold values
572
573
  for (i = 0; i < MAX_MODES; ++i)
    sf->thresh_mult[i] = mode == 0 ? -500 : 0;
574
575

  sf->thresh_mult[THR_NEARESTMV] = 0;
576
577
578
  sf->thresh_mult[THR_NEARESTG] = 0;
  sf->thresh_mult[THR_NEARESTA] = 0;

Deb Mukherjee's avatar
Deb Mukherjee committed
579
580
  sf->thresh_mult[THR_DC] += 1000;

Paul Wilkins's avatar
Paul Wilkins committed
581
  sf->thresh_mult[THR_NEWMV] += 1000;
Deb Mukherjee's avatar
Deb Mukherjee committed
582
  sf->thresh_mult[THR_NEWA] += 1000;
Paul Wilkins's avatar
Paul Wilkins committed
583
584
585
  sf->thresh_mult[THR_NEWG] += 1000;

  sf->thresh_mult[THR_NEARMV] += 1000;
Deb Mukherjee's avatar
Deb Mukherjee committed
586
  sf->thresh_mult[THR_NEARA] += 1000;
Paul Wilkins's avatar
Paul Wilkins committed
587
588
  sf->thresh_mult[THR_COMP_NEARESTLA] += 1000;
  sf->thresh_mult[THR_COMP_NEARESTGA] += 1000;
Deb Mukherjee's avatar
Deb Mukherjee committed
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618

  sf->thresh_mult[THR_TM] += 1000;

  sf->thresh_mult[THR_COMP_NEARLA] += 1500;
  sf->thresh_mult[THR_COMP_NEWLA] += 2000;
  sf->thresh_mult[THR_NEARG] += 1000;
  sf->thresh_mult[THR_COMP_NEARGA] += 1500;
  sf->thresh_mult[THR_COMP_NEWGA] += 2000;

  sf->thresh_mult[THR_SPLITMV] += 2500;
  sf->thresh_mult[THR_SPLITG] += 2500;
  sf->thresh_mult[THR_SPLITA] += 2500;
  sf->thresh_mult[THR_COMP_SPLITLA] += 4500;
  sf->thresh_mult[THR_COMP_SPLITGA] += 4500;

  sf->thresh_mult[THR_ZEROMV] += 2000;
  sf->thresh_mult[THR_ZEROG] += 2000;
  sf->thresh_mult[THR_ZEROA] += 2000;
  sf->thresh_mult[THR_COMP_ZEROLA] += 2500;
  sf->thresh_mult[THR_COMP_ZEROGA] += 2500;

  sf->thresh_mult[THR_B_PRED] += 2500;
  sf->thresh_mult[THR_H_PRED] += 2000;
  sf->thresh_mult[THR_V_PRED] += 2000;
  sf->thresh_mult[THR_D45_PRED ] += 2500;
  sf->thresh_mult[THR_D135_PRED] += 2500;
  sf->thresh_mult[THR_D117_PRED] += 2500;
  sf->thresh_mult[THR_D153_PRED] += 2500;
  sf->thresh_mult[THR_D207_PRED] += 2500;
  sf->thresh_mult[THR_D63_PRED] += 2500;
619

620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
  /* disable frame modes if flags not set */
  if (!(cpi->ref_frame_flags & VP9_LAST_FLAG)) {
    sf->thresh_mult[THR_NEWMV    ] = INT_MAX;
    sf->thresh_mult[THR_NEARESTMV] = INT_MAX;
    sf->thresh_mult[THR_ZEROMV   ] = INT_MAX;
    sf->thresh_mult[THR_NEARMV   ] = INT_MAX;
    sf->thresh_mult[THR_SPLITMV  ] = INT_MAX;
  }
  if (!(cpi->ref_frame_flags & VP9_GOLD_FLAG)) {
    sf->thresh_mult[THR_NEARESTG ] = INT_MAX;
    sf->thresh_mult[THR_ZEROG    ] = INT_MAX;
    sf->thresh_mult[THR_NEARG    ] = INT_MAX;
    sf->thresh_mult[THR_NEWG     ] = INT_MAX;
    sf->thresh_mult[THR_SPLITG   ] = INT_MAX;
  }
  if (!(cpi->ref_frame_flags & VP9_ALT_FLAG)) {
    sf->thresh_mult[THR_NEARESTA ] = INT_MAX;
    sf->thresh_mult[THR_ZEROA    ] = INT_MAX;
    sf->thresh_mult[THR_NEARA    ] = INT_MAX;
    sf->thresh_mult[THR_NEWA     ] = INT_MAX;
    sf->thresh_mult[THR_SPLITA   ] = INT_MAX;
  }

  if ((cpi->ref_frame_flags & (VP9_LAST_FLAG | VP9_ALT_FLAG)) !=
      (VP9_LAST_FLAG | VP9_ALT_FLAG)) {
    sf->thresh_mult[THR_COMP_ZEROLA   ] = INT_MAX;
    sf->thresh_mult[THR_COMP_NEARESTLA] = INT_MAX;
    sf->thresh_mult[THR_COMP_NEARLA   ] = INT_MAX;
    sf->thresh_mult[THR_COMP_NEWLA    ] = INT_MAX;
    sf->thresh_mult[THR_COMP_SPLITLA  ] = INT_MAX;
  }
  if ((cpi->ref_frame_flags & (VP9_GOLD_FLAG | VP9_ALT_FLAG)) !=
      (VP9_GOLD_FLAG | VP9_ALT_FLAG)) {
    sf->thresh_mult[THR_COMP_ZEROGA   ] = INT_MAX;
    sf->thresh_mult[THR_COMP_NEARESTGA] = INT_MAX;
    sf->thresh_mult[THR_COMP_NEARGA   ] = INT_MAX;
    sf->thresh_mult[THR_COMP_NEWGA    ] = INT_MAX;
    sf->thresh_mult[THR_COMP_SPLITGA  ] = INT_MAX;
  }
659
660
661
662
663
664
665
666
667

  if (sf->disable_splitmv == 1) {
    sf->thresh_mult[THR_SPLITMV  ] = INT_MAX;
    sf->thresh_mult[THR_SPLITG   ] = INT_MAX;
    sf->thresh_mult[THR_SPLITA   ] = INT_MAX;

    sf->thresh_mult[THR_COMP_SPLITLA  ] = INT_MAX;
    sf->thresh_mult[THR_COMP_SPLITGA  ] = INT_MAX;
  }
668
669
}

670
void vp9_set_speed_features(VP9_COMP *cpi) {
John Koleszar's avatar
John Koleszar committed
671
  SPEED_FEATURES *sf = &cpi->sf;
672
  int mode = cpi->compressor_speed;
673
  int speed = cpi->speed;
John Koleszar's avatar
John Koleszar committed
674
  int i;
675

John Koleszar's avatar
John Koleszar committed
676
  // Only modes 0 and 1 supported for now in experimental code basae
677
678
  if (mode > 1)
    mode = 1;
John Koleszar's avatar
John Koleszar committed
679
680
681
682
683
684
685
686
687
688
689
690
691

  // Initialise default mode frequency sampling variables
  for (i = 0; i < MAX_MODES; i ++) {
    cpi->mode_check_freq[i] = 0;
    cpi->mode_test_hit_counts[i] = 0;
    cpi->mode_chosen_counts[i] = 0;
  }

  // best quality defaults
  sf->RD = 1;
  sf->search_method = NSTEP;
  sf->auto_filter = 1;
  sf->recode_loop = 1;
692
693
  sf->subpel_search_method = SUBPEL_TREE;
  sf->subpel_iters_per_step = 2;
694
  sf->optimize_coefficients = !cpi->oxcf.lossless;
695
  sf->reduce_first_step_size = 0;
Paul Wilkins's avatar
Paul Wilkins committed
696
  sf->auto_mv_step_size = 0;
John Koleszar's avatar
John Koleszar committed
697
  sf->max_step_search_steps = MAX_MVSEARCH_STEPS;
698
  sf->comp_inter_joint_search_thresh = BLOCK_4X4;
699
  sf->adaptive_rd_thresh = 0;
Jim Bankoski's avatar
Jim Bankoski committed
700
  sf->use_lastframe_partitioning = 0;
Deb Mukherjee's avatar
Deb Mukherjee committed
701
  sf->tx_size_search_method = USE_FULL_RD;
702
  sf->use_lp32x32fdct = 0;
Jingning Han's avatar
Jingning Han committed
703
  sf->adaptive_motion_search = 0;
704
  sf->use_avoid_tested_higherror = 0;
Paul Wilkins's avatar
Paul Wilkins committed
705
  sf->reference_masking = 0;
706
  sf->partition_by_variance = 0;
707
  sf->use_one_partition_size_always = 0;
Yaowu Xu's avatar
Yaowu Xu committed
708
  sf->less_rectangular_check = 0;
709
  sf->use_square_partition_only = 0;
710
711
712
713
714
  sf->auto_min_max_partition_size = 0;
  sf->auto_min_max_partition_interval = 0;
  sf->auto_min_max_partition_count = 0;
  sf->max_partition_size = BLOCK_64X64;
  sf->min_partition_size = BLOCK_4X4;
715
716
  sf->adjust_partitioning_from_last_frame = 0;
  sf->last_partitioning_redo_frequency = 4;
717
  sf->disable_splitmv = 0;
718
  sf->mode_search_skip_flags = 0;
719
  sf->disable_split_var_thresh = 0;
720
  sf->disable_filter_search_var_thresh = 0;
721
722
  sf->intra_y_mode_mask = ALL_INTRA_MODES;
  sf->intra_uv_mode_mask = ALL_INTRA_MODES;
723
  sf->use_rd_breakout = 0;
724
  sf->skip_encode_sb = 0;
725
  sf->use_uv_intra_rd_estimate = 0;
726
  sf->use_fast_lpf_pick = 0;
727
  sf->use_fast_coef_updates = 0;
728
  sf->using_small_partition_info = 0;
729
730
  sf->mode_skip_start = MAX_MODES;  // Mode index at which mode skip mask set

731
732
733
734
#if CONFIG_MULTIPLE_ARF
  // Switch segmentation off.
  sf->static_segmentation = 0;
#else
735
  sf->static_segmentation = 0;
736
#endif
John Koleszar's avatar
John Koleszar committed
737

738
  switch (mode) {
John Koleszar's avatar
John Koleszar committed
739
    case 0: // best quality mode
John Koleszar's avatar
John Koleszar committed
740
741
      break;

742
    case 1:
743
744
745
#if CONFIG_MULTIPLE_ARF
      // Switch segmentation off.
      sf->static_segmentation = 0;
746
#else
Paul Wilkins's avatar
Paul Wilkins committed
747
      sf->static_segmentation = 0;
748
#endif
749
      sf->use_avoid_tested_higherror = 1;
750
      sf->adaptive_rd_thresh = MIN((speed + 1), 4);
751

Yaowu Xu's avatar
Yaowu Xu committed
752
      if (speed == 1) {
753
        sf->comp_inter_joint_search_thresh = BLOCK_SIZES;
Yaowu Xu's avatar
Yaowu Xu committed
754
        sf->less_rectangular_check  = 1;
Deb Mukherjee's avatar
Deb Mukherjee committed
755
756
757
758
        sf->tx_size_search_method = ((cpi->common.frame_type == KEY_FRAME ||
                                      cpi->common.intra_only ||
                                      cpi->common.show_frame == 0) ?
                                     USE_FULL_RD :
759
760
761
762
                                     USE_LARGESTALL);
        sf->use_square_partition_only = !(cpi->common.frame_type == KEY_FRAME ||
                                   cpi->common.intra_only ||
                                   cpi->common.show_frame == 0);
763
764
765
766
        sf->disable_splitmv =
            (MIN(cpi->common.width, cpi->common.height) >= 720)? 1 : 0;
        sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH |
                                     FLAG_SKIP_INTRA_BESTINTER |
767
768
                                     FLAG_SKIP_COMP_BESTINTRA |
                                     FLAG_SKIP_INTRA_LOWVAR;
769
        sf->use_uv_intra_rd_estimate = 1;
770
        sf->use_rd_breakout = 1;
771
        sf->skip_encode_sb = 1;
772
        sf->use_lp32x32fdct = 1;
Jingning Han's avatar
Jingning Han committed
773
        sf->adaptive_motion_search = 1;
774
        sf->auto_mv_step_size = 1;
775
776
777

        sf->auto_min_max_partition_size = 1;
        sf->auto_min_max_partition_interval = 1;
778
779
780
781
        // FIXME(jingning): temporarily turn off disable_split_var_thresh
        // during refactoring process. will get this back after finishing
        // the main framework of partition search type.
        sf->disable_split_var_thresh = 0;
782
        sf->disable_filter_search_var_thresh = 16;
783
784
785

        sf->intra_y_mode_mask = INTRA_DC_TM_H_V;
        sf->intra_uv_mode_mask = INTRA_DC_TM_H_V;
786
        sf->use_fast_coef_updates = 1;
Paul Wilkins's avatar
Paul Wilkins committed
787
        sf->mode_skip_start = 11;
Jim Bankoski's avatar
Jim Bankoski committed
788
      }
789
      if (speed == 2) {
Yaowu Xu's avatar
Yaowu Xu committed
790
        sf->less_rectangular_check  = 1;
791
        sf->use_square_partition_only = 1;
792
        sf->comp_inter_joint_search_thresh = BLOCK_SIZES;
Jim Bankoski's avatar
Jim Bankoski committed
793
        sf->use_lastframe_partitioning = 1;
794
795
        sf->adjust_partitioning_from_last_frame = 1;
        sf->last_partitioning_redo_frequency = 3;
796
797
798
799
800
801
802
803
        sf->tx_size_search_method = ((cpi->common.frame_type == KEY_FRAME ||
                                      cpi->common.intra_only ||
                                      cpi->common.show_frame == 0) ?
                                     USE_FULL_RD :
                                     USE_LARGESTALL);
        sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH |
                                     FLAG_SKIP_INTRA_BESTINTER |
                                     FLAG_SKIP_COMP_BESTINTRA |
804
805
806
                                     FLAG_SKIP_COMP_REFMISMATCH |
                                     FLAG_SKIP_INTRA_LOWVAR |
                                     FLAG_EARLY_TERMINATE;
807
808
        sf->intra_y_mode_mask = INTRA_DC_TM;
        sf->intra_uv_mode_mask = INTRA_DC_TM;
809
        sf->use_uv_intra_rd_estimate = 1;
810
        sf->use_rd_breakout = 1;
811
        sf->skip_encode_sb = 1;
812
        sf->use_lp32x32fdct = 1;
Jingning Han's avatar
Jingning Han committed
813
        sf->adaptive_motion_search = 1;
814
        sf->using_small_partition_info = 0;
815
816
        sf->disable_splitmv =
            (MIN(cpi->common.width, cpi->common.height) >= 720)? 1 : 0;
817
        sf->auto_mv_step_size = 1;
818
        sf->search_method = SQUARE;
819
        sf->subpel_iters_per_step = 1;
820
        sf->use_fast_lpf_pick = 1;
821
822
        sf->auto_min_max_partition_size = 1;
        sf->auto_min_max_partition_interval = 2;
823
        sf->disable_split_var_thresh = 32;
824
        sf->disable_filter_search_var_thresh = 32;
825
        sf->use_fast_coef_updates = 2;
Paul Wilkins's avatar
Paul Wilkins committed
826
        sf->mode_skip_start = 6;
827
      }
828
      if (speed == 3) {
829
        sf->comp_inter_joint_search_thresh = BLOCK_SIZES;
830
        sf->partition_by_variance = 1;
Deb Mukherjee's avatar
Deb Mukherjee committed
831
832
833
834
835
        sf->tx_size_search_method = ((cpi->common.frame_type == KEY_FRAME ||
                                      cpi->common.intra_only ||
                                      cpi->common.show_frame == 0) ?
                                     USE_FULL_RD :
                                     USE_LARGESTALL);
836
837
838
        sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH |
                                     FLAG_SKIP_INTRA_BESTINTER |
                                     FLAG_SKIP_COMP_BESTINTRA |
839
840
841
                                     FLAG_SKIP_COMP_REFMISMATCH |
                                     FLAG_SKIP_INTRA_LOWVAR |
                                     FLAG_EARLY_TERMINATE;
842
        sf->use_rd_breakout = 1;
843
        sf->skip_encode_sb = 1;
844
        sf->use_lp32x32fdct = 1;
845
        sf->disable_splitmv = 1;
846
        sf->auto_mv_step_size = 1;
847
        sf->search_method = BIGDIA;
848
        sf->subpel_iters_per_step = 1;
849
        sf->disable_split_var_thresh = 64;
850
        sf->disable_filter_search_var_thresh = 64;
851
852
        sf->intra_y_mode_mask = INTRA_DC_ONLY;
        sf->intra_uv_mode_mask = INTRA_DC_ONLY;
853
        sf->use_fast_coef_updates = 2;
Paul Wilkins's avatar
Paul Wilkins committed
854
        sf->mode_skip_start = 6;
855
      }
856
      if (speed == 4) {
857
        sf->comp_inter_joint_search_thresh = BLOCK_SIZES;
858
        sf->use_one_partition_size_always = 1;
859
        sf->always_this_block_size = BLOCK_16X16;
Deb Mukherjee's avatar
Deb Mukherjee committed
860
861
862
863
864
        sf->tx_size_search_method = ((cpi->common.frame_type == KEY_FRAME ||
                                      cpi->common.intra_only ||
                                      cpi->common.show_frame == 0) ?
                                     USE_FULL_RD :
                                     USE_LARGESTALL);
865
866
867
        sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH |
                                     FLAG_SKIP_INTRA_BESTINTER |
                                     FLAG_SKIP_COMP_BESTINTRA |
868
869
870
                                     FLAG_SKIP_COMP_REFMISMATCH |
                                     FLAG_SKIP_INTRA_LOWVAR |
                                     FLAG_EARLY_TERMINATE;
871
        sf->use_rd_breakout = 1;
872
        sf->use_lp32x32fdct = 1;
Paul Wilkins's avatar
Paul Wilkins committed
873
        sf->optimize_coefficients = 0;
874
        sf->auto_mv_step_size = 1;
Paul Wilkins's avatar
Paul Wilkins committed
875
876
        // sf->reduce_first_step_size = 1;
        // sf->reference_masking = 1;
877
878

        sf->disable_splitmv = 1;
879
        sf->search_method = HEX;
880
        sf->subpel_iters_per_step = 1;
881
        sf->disable_split_var_thresh = 64;
882
        sf->disable_filter_search_var_thresh = 96;
883
884
        sf->intra_y_mode_mask = INTRA_DC_ONLY;
        sf->intra_uv_mode_mask = INTRA_DC_ONLY;
885
        sf->use_fast_coef_updates = 2;
Paul Wilkins's avatar
Paul Wilkins committed
886
        sf->mode_skip_start = 6;
887
      }
Deb Mukherjee's avatar
Deb Mukherjee committed
888
      break;
John Koleszar's avatar
John Koleszar committed
889

John Koleszar's avatar
John Koleszar committed
890
  }; /* switch */
891

892
  // Set rd thresholds based on mode and speed setting
Deb Mukherjee's avatar
Deb Mukherjee committed
893
  set_rd_speed_thresholds(cpi, mode);
John Koleszar's avatar
John Koleszar committed
894
895
896
897
898
899

  // Slow quant, dct and trellis not worthwhile for first pass
  // so make sure they are always turned off.
  if (cpi->pass == 1) {
    sf->optimize_coefficients = 0;
  }
900

Yaowu Xu's avatar
Yaowu Xu committed
901
902
903
904
  cpi->mb.fwd_txm16x16  = vp9_short_fdct16x16;
  cpi->mb.fwd_txm8x8    = vp9_short_fdct8x8;
  cpi->mb.fwd_txm8x4