Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: source/libvpx/vp9/encoder/vp9_encodemb.c

Issue 812033011: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_encodeframe.c ('k') | source/libvpx/vp9/encoder/vp9_encoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 vp9_subtract_block(bh, bw, p->src_diff, bw, p->src.buf, p->src.stride, 86 vp9_subtract_block(bh, bw, p->src_diff, bw, p->src.buf, p->src.stride,
87 pd->dst.buf, pd->dst.stride); 87 pd->dst.buf, pd->dst.stride);
88 } 88 }
89 89
90 #define RDTRUNC(RM, DM, R, D) ((128 + (R) * (RM)) & 0xFF) 90 #define RDTRUNC(RM, DM, R, D) ((128 + (R) * (RM)) & 0xFF)
91 91
92 typedef struct vp9_token_state { 92 typedef struct vp9_token_state {
93 int rate; 93 int rate;
94 int error; 94 int error;
95 int next; 95 int next;
96 signed char token; 96 int16_t token;
97 short qc; 97 short qc;
98 } vp9_token_state; 98 } vp9_token_state;
99 99
100 // TODO(jimbankoski): experiment to find optimal RD numbers. 100 // TODO(jimbankoski): experiment to find optimal RD numbers.
101 static const int plane_rd_mult[PLANE_TYPES] = { 4, 2 }; 101 static const int plane_rd_mult[PLANE_TYPES] = { 4, 2 };
102 102
103 #define UPDATE_RD_COST()\ 103 #define UPDATE_RD_COST()\
104 {\ 104 {\
105 rd_cost0 = RDCOST(rdmult, rddiv, rate0, error0);\ 105 rd_cost0 = RDCOST(rdmult, rddiv, rate0, error0);\
106 rd_cost1 = RDCOST(rdmult, rddiv, rate1, error1);\ 106 rd_cost1 = RDCOST(rdmult, rddiv, rate1, error1);\
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 const int default_eob = 16 << (tx_size << 1); 140 const int default_eob = 16 << (tx_size << 1);
141 const int mul = 1 + (tx_size == TX_32X32); 141 const int mul = 1 + (tx_size == TX_32X32);
142 const int16_t *dequant_ptr = pd->dequant; 142 const int16_t *dequant_ptr = pd->dequant;
143 const uint8_t *const band_translate = get_band_translate(tx_size); 143 const uint8_t *const band_translate = get_band_translate(tx_size);
144 const scan_order *const so = get_scan(xd, tx_size, type, block); 144 const scan_order *const so = get_scan(xd, tx_size, type, block);
145 const int16_t *const scan = so->scan; 145 const int16_t *const scan = so->scan;
146 const int16_t *const nb = so->neighbors; 146 const int16_t *const nb = so->neighbors;
147 int next = eob, sz = 0; 147 int next = eob, sz = 0;
148 int64_t rdmult = mb->rdmult * plane_rd_mult[type], rddiv = mb->rddiv; 148 int64_t rdmult = mb->rdmult * plane_rd_mult[type], rddiv = mb->rddiv;
149 int64_t rd_cost0, rd_cost1; 149 int64_t rd_cost0, rd_cost1;
150 int rate0, rate1, error0, error1, t0, t1; 150 int rate0, rate1, error0, error1;
151 int16_t t0, t1;
152 EXTRABIT e0;
151 int best, band, pt, i, final_eob; 153 int best, band, pt, i, final_eob;
152 const TOKENVALUE *dct_value_tokens; 154 #if CONFIG_VP9_HIGHBITDEPTH
153 const int16_t *dct_value_cost; 155 const int16_t *cat6_high_cost = vp9_get_high_cost_table(xd->bd);
156 #else
157 const int16_t *cat6_high_cost = vp9_get_high_cost_table(8);
158 #endif
154 159
155 assert((!type && !plane) || (type && plane)); 160 assert((!type && !plane) || (type && plane));
156 assert(eob <= default_eob); 161 assert(eob <= default_eob);
157 162
158 /* Now set up a Viterbi trellis to evaluate alternative roundings. */ 163 /* Now set up a Viterbi trellis to evaluate alternative roundings. */
159 if (!ref) 164 if (!ref)
160 rdmult = (rdmult * 9) >> 4; 165 rdmult = (rdmult * 9) >> 4;
161 166
162 /* Initialize the sentinel node of the trellis. */ 167 /* Initialize the sentinel node of the trellis. */
163 tokens[eob][0].rate = 0; 168 tokens[eob][0].rate = 0;
164 tokens[eob][0].error = 0; 169 tokens[eob][0].error = 0;
165 tokens[eob][0].next = default_eob; 170 tokens[eob][0].next = default_eob;
166 tokens[eob][0].token = EOB_TOKEN; 171 tokens[eob][0].token = EOB_TOKEN;
167 tokens[eob][0].qc = 0; 172 tokens[eob][0].qc = 0;
168 tokens[eob][1] = tokens[eob][0]; 173 tokens[eob][1] = tokens[eob][0];
169 174
170 #if CONFIG_VP9_HIGHBITDEPTH
171 if (xd->bd == 12) {
172 dct_value_tokens = vp9_dct_value_tokens_high12_ptr;
173 dct_value_cost = vp9_dct_value_cost_high12_ptr;
174 } else if (xd->bd == 10) {
175 dct_value_tokens = vp9_dct_value_tokens_high10_ptr;
176 dct_value_cost = vp9_dct_value_cost_high10_ptr;
177 } else {
178 dct_value_tokens = vp9_dct_value_tokens_ptr;
179 dct_value_cost = vp9_dct_value_cost_ptr;
180 }
181 #else
182 dct_value_tokens = vp9_dct_value_tokens_ptr;
183 dct_value_cost = vp9_dct_value_cost_ptr;
184 #endif
185 for (i = 0; i < eob; i++) 175 for (i = 0; i < eob; i++)
186 token_cache[scan[i]] = 176 token_cache[scan[i]] =
187 vp9_pt_energy_class[dct_value_tokens[qcoeff[scan[i]]].token]; 177 vp9_pt_energy_class[vp9_get_token(qcoeff[scan[i]])];
188 178
189 for (i = eob; i-- > 0;) { 179 for (i = eob; i-- > 0;) {
190 int base_bits, d2, dx; 180 int base_bits, d2, dx;
191 const int rc = scan[i]; 181 const int rc = scan[i];
192 int x = qcoeff[rc]; 182 int x = qcoeff[rc];
193 /* Only add a trellis state for non-zero coefficients. */ 183 /* Only add a trellis state for non-zero coefficients. */
194 if (x) { 184 if (x) {
195 int shortcut = 0; 185 int shortcut = 0;
196 error0 = tokens[next][0].error; 186 error0 = tokens[next][0].error;
197 error1 = tokens[next][1].error; 187 error1 = tokens[next][1].error;
198 /* Evaluate the first possibility for this state. */ 188 /* Evaluate the first possibility for this state. */
199 rate0 = tokens[next][0].rate; 189 rate0 = tokens[next][0].rate;
200 rate1 = tokens[next][1].rate; 190 rate1 = tokens[next][1].rate;
201 t0 = (dct_value_tokens + x)->token; 191 vp9_get_token_extra(x, &t0, &e0);
202 /* Consider both possible successor states. */ 192 /* Consider both possible successor states. */
203 if (next < default_eob) { 193 if (next < default_eob) {
204 band = band_translate[i + 1]; 194 band = band_translate[i + 1];
205 pt = trellis_get_coeff_context(scan, nb, i, t0, token_cache); 195 pt = trellis_get_coeff_context(scan, nb, i, t0, token_cache);
206 rate0 += mb->token_costs[tx_size][type][ref][band][0][pt] 196 rate0 += mb->token_costs[tx_size][type][ref][band][0][pt]
207 [tokens[next][0].token]; 197 [tokens[next][0].token];
208 rate1 += mb->token_costs[tx_size][type][ref][band][0][pt] 198 rate1 += mb->token_costs[tx_size][type][ref][band][0][pt]
209 [tokens[next][1].token]; 199 [tokens[next][1].token];
210 } 200 }
211 UPDATE_RD_COST(); 201 UPDATE_RD_COST();
212 /* And pick the best. */ 202 /* And pick the best. */
213 best = rd_cost1 < rd_cost0; 203 best = rd_cost1 < rd_cost0;
214 base_bits = dct_value_cost[x]; 204 base_bits = vp9_get_cost(t0, e0, cat6_high_cost);
215 dx = mul * (dqcoeff[rc] - coeff[rc]); 205 dx = mul * (dqcoeff[rc] - coeff[rc]);
216 #if CONFIG_VP9_HIGHBITDEPTH 206 #if CONFIG_VP9_HIGHBITDEPTH
217 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { 207 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
218 dx >>= xd->bd - 8; 208 dx >>= xd->bd - 8;
219 } 209 }
220 #endif // CONFIG_VP9_HIGHBITDEPTH 210 #endif // CONFIG_VP9_HIGHBITDEPTH
221 d2 = dx * dx; 211 d2 = dx * dx;
222 tokens[i][0].rate = base_bits + (best ? rate1 : rate0); 212 tokens[i][0].rate = base_bits + (best ? rate1 : rate0);
223 tokens[i][0].error = d2 + (best ? error1 : error0); 213 tokens[i][0].error = d2 + (best ? error1 : error0);
224 tokens[i][0].next = next; 214 tokens[i][0].next = next;
(...skipping 17 matching lines...) Expand all
242 x -= 2 * sz + 1; 232 x -= 2 * sz + 1;
243 } 233 }
244 234
245 /* Consider both possible successor states. */ 235 /* Consider both possible successor states. */
246 if (!x) { 236 if (!x) {
247 /* If we reduced this coefficient to zero, check to see if 237 /* If we reduced this coefficient to zero, check to see if
248 * we need to move the EOB back here. 238 * we need to move the EOB back here.
249 */ 239 */
250 t0 = tokens[next][0].token == EOB_TOKEN ? EOB_TOKEN : ZERO_TOKEN; 240 t0 = tokens[next][0].token == EOB_TOKEN ? EOB_TOKEN : ZERO_TOKEN;
251 t1 = tokens[next][1].token == EOB_TOKEN ? EOB_TOKEN : ZERO_TOKEN; 241 t1 = tokens[next][1].token == EOB_TOKEN ? EOB_TOKEN : ZERO_TOKEN;
242 e0 = 0;
252 } else { 243 } else {
253 t0 = t1 = (dct_value_tokens + x)->token; 244 vp9_get_token_extra(x, &t0, &e0);
245 t1 = t0;
254 } 246 }
255 if (next < default_eob) { 247 if (next < default_eob) {
256 band = band_translate[i + 1]; 248 band = band_translate[i + 1];
257 if (t0 != EOB_TOKEN) { 249 if (t0 != EOB_TOKEN) {
258 pt = trellis_get_coeff_context(scan, nb, i, t0, token_cache); 250 pt = trellis_get_coeff_context(scan, nb, i, t0, token_cache);
259 rate0 += mb->token_costs[tx_size][type][ref][band][!x][pt] 251 rate0 += mb->token_costs[tx_size][type][ref][band][!x][pt]
260 [tokens[next][0].token]; 252 [tokens[next][0].token];
261 } 253 }
262 if (t1 != EOB_TOKEN) { 254 if (t1 != EOB_TOKEN) {
263 pt = trellis_get_coeff_context(scan, nb, i, t1, token_cache); 255 pt = trellis_get_coeff_context(scan, nb, i, t1, token_cache);
264 rate1 += mb->token_costs[tx_size][type][ref][band][!x][pt] 256 rate1 += mb->token_costs[tx_size][type][ref][band][!x][pt]
265 [tokens[next][1].token]; 257 [tokens[next][1].token];
266 } 258 }
267 } 259 }
268 260
269 UPDATE_RD_COST(); 261 UPDATE_RD_COST();
270 /* And pick the best. */ 262 /* And pick the best. */
271 best = rd_cost1 < rd_cost0; 263 best = rd_cost1 < rd_cost0;
272 base_bits = dct_value_cost[x]; 264 base_bits = vp9_get_cost(t0, e0, cat6_high_cost);
273 265
274 if (shortcut) { 266 if (shortcut) {
275 #if CONFIG_VP9_HIGHBITDEPTH 267 #if CONFIG_VP9_HIGHBITDEPTH
276 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { 268 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
277 dx -= ((dequant_ptr[rc != 0] >> (xd->bd - 8)) + sz) ^ sz; 269 dx -= ((dequant_ptr[rc != 0] >> (xd->bd - 8)) + sz) ^ sz;
278 } else { 270 } else {
279 dx -= (dequant_ptr[rc != 0] + sz) ^ sz; 271 dx -= (dequant_ptr[rc != 0] + sz) ^ sz;
280 } 272 }
281 #else 273 #else
282 dx -= (dequant_ptr[rc != 0] + sz) ^ sz; 274 dx -= (dequant_ptr[rc != 0] + sz) ^ sz;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 src_diff = &p->src_diff[4 * (j * diff_stride + i)]; 376 src_diff = &p->src_diff[4 * (j * diff_stride + i)];
385 377
386 #if CONFIG_VP9_HIGHBITDEPTH 378 #if CONFIG_VP9_HIGHBITDEPTH
387 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { 379 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
388 switch (tx_size) { 380 switch (tx_size) {
389 case TX_32X32: 381 case TX_32X32:
390 highbd_fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride); 382 highbd_fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
391 vp9_highbd_quantize_fp_32x32(coeff, 1024, x->skip_block, p->zbin, 383 vp9_highbd_quantize_fp_32x32(coeff, 1024, x->skip_block, p->zbin,
392 p->round_fp, p->quant_fp, p->quant_shift, 384 p->round_fp, p->quant_fp, p->quant_shift,
393 qcoeff, dqcoeff, pd->dequant, 385 qcoeff, dqcoeff, pd->dequant,
394 p->zbin_extra, eob, scan_order->scan, 386 eob, scan_order->scan,
395 scan_order->iscan); 387 scan_order->iscan);
396 break; 388 break;
397 case TX_16X16: 389 case TX_16X16:
398 vp9_highbd_fdct16x16(src_diff, coeff, diff_stride); 390 vp9_highbd_fdct16x16(src_diff, coeff, diff_stride);
399 vp9_highbd_quantize_fp(coeff, 256, x->skip_block, p->zbin, p->round_fp, 391 vp9_highbd_quantize_fp(coeff, 256, x->skip_block, p->zbin, p->round_fp,
400 p->quant_fp, p->quant_shift, qcoeff, dqcoeff, 392 p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
401 pd->dequant, p->zbin_extra, eob, 393 pd->dequant, eob,
402 scan_order->scan, scan_order->iscan); 394 scan_order->scan, scan_order->iscan);
403 break; 395 break;
404 case TX_8X8: 396 case TX_8X8:
405 vp9_highbd_fdct8x8(src_diff, coeff, diff_stride); 397 vp9_highbd_fdct8x8(src_diff, coeff, diff_stride);
406 vp9_highbd_quantize_fp(coeff, 64, x->skip_block, p->zbin, p->round_fp, 398 vp9_highbd_quantize_fp(coeff, 64, x->skip_block, p->zbin, p->round_fp,
407 p->quant_fp, p->quant_shift, qcoeff, dqcoeff, 399 p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
408 pd->dequant, p->zbin_extra, eob, 400 pd->dequant, eob,
409 scan_order->scan, scan_order->iscan); 401 scan_order->scan, scan_order->iscan);
410 break; 402 break;
411 case TX_4X4: 403 case TX_4X4:
412 x->fwd_txm4x4(src_diff, coeff, diff_stride); 404 x->fwd_txm4x4(src_diff, coeff, diff_stride);
413 vp9_highbd_quantize_fp(coeff, 16, x->skip_block, p->zbin, p->round_fp, 405 vp9_highbd_quantize_fp(coeff, 16, x->skip_block, p->zbin, p->round_fp,
414 p->quant_fp, p->quant_shift, qcoeff, dqcoeff, 406 p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
415 pd->dequant, p->zbin_extra, eob, 407 pd->dequant, eob,
416 scan_order->scan, scan_order->iscan); 408 scan_order->scan, scan_order->iscan);
417 break; 409 break;
418 default: 410 default:
419 assert(0); 411 assert(0);
420 } 412 }
421 return; 413 return;
422 } 414 }
423 #endif // CONFIG_VP9_HIGHBITDEPTH 415 #endif // CONFIG_VP9_HIGHBITDEPTH
424 416
425 switch (tx_size) { 417 switch (tx_size) {
426 case TX_32X32: 418 case TX_32X32:
427 fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride); 419 fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
428 vp9_quantize_fp_32x32(coeff, 1024, x->skip_block, p->zbin, p->round_fp, 420 vp9_quantize_fp_32x32(coeff, 1024, x->skip_block, p->zbin, p->round_fp,
429 p->quant_fp, p->quant_shift, qcoeff, dqcoeff, 421 p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
430 pd->dequant, p->zbin_extra, eob, scan_order->scan, 422 pd->dequant, eob, scan_order->scan,
431 scan_order->iscan); 423 scan_order->iscan);
432 break; 424 break;
433 case TX_16X16: 425 case TX_16X16:
434 vp9_fdct16x16(src_diff, coeff, diff_stride); 426 vp9_fdct16x16(src_diff, coeff, diff_stride);
435 vp9_quantize_fp(coeff, 256, x->skip_block, p->zbin, p->round_fp, 427 vp9_quantize_fp(coeff, 256, x->skip_block, p->zbin, p->round_fp,
436 p->quant_fp, p->quant_shift, qcoeff, dqcoeff, 428 p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
437 pd->dequant, p->zbin_extra, eob, 429 pd->dequant, eob,
438 scan_order->scan, scan_order->iscan); 430 scan_order->scan, scan_order->iscan);
439 break; 431 break;
440 case TX_8X8: 432 case TX_8X8:
441 vp9_fdct8x8_quant(src_diff, diff_stride, coeff, 64, 433 vp9_fdct8x8_quant(src_diff, diff_stride, coeff, 64,
442 x->skip_block, p->zbin, p->round_fp, 434 x->skip_block, p->zbin, p->round_fp,
443 p->quant_fp, p->quant_shift, qcoeff, dqcoeff, 435 p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
444 pd->dequant, p->zbin_extra, eob, 436 pd->dequant, eob,
445 scan_order->scan, scan_order->iscan); 437 scan_order->scan, scan_order->iscan);
446 break; 438 break;
447 case TX_4X4: 439 case TX_4X4:
448 x->fwd_txm4x4(src_diff, coeff, diff_stride); 440 x->fwd_txm4x4(src_diff, coeff, diff_stride);
449 vp9_quantize_fp(coeff, 16, x->skip_block, p->zbin, p->round_fp, 441 vp9_quantize_fp(coeff, 16, x->skip_block, p->zbin, p->round_fp,
450 p->quant_fp, p->quant_shift, qcoeff, dqcoeff, 442 p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
451 pd->dequant, p->zbin_extra, eob, 443 pd->dequant, eob,
452 scan_order->scan, scan_order->iscan); 444 scan_order->scan, scan_order->iscan);
453 break; 445 break;
454 default: 446 default:
455 assert(0); 447 assert(0);
456 break; 448 break;
457 } 449 }
458 } 450 }
459 451
460 void vp9_xform_quant_dc(MACROBLOCK *x, int plane, int block, 452 void vp9_xform_quant_dc(MACROBLOCK *x, int plane, int block,
461 BLOCK_SIZE plane_bsize, TX_SIZE tx_size) { 453 BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j); 546 txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
555 src_diff = &p->src_diff[4 * (j * diff_stride + i)]; 547 src_diff = &p->src_diff[4 * (j * diff_stride + i)];
556 548
557 #if CONFIG_VP9_HIGHBITDEPTH 549 #if CONFIG_VP9_HIGHBITDEPTH
558 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { 550 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
559 switch (tx_size) { 551 switch (tx_size) {
560 case TX_32X32: 552 case TX_32X32:
561 highbd_fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride); 553 highbd_fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
562 vp9_highbd_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, 554 vp9_highbd_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin,
563 p->round, p->quant, p->quant_shift, qcoeff, 555 p->round, p->quant, p->quant_shift, qcoeff,
564 dqcoeff, pd->dequant, p->zbin_extra, eob, 556 dqcoeff, pd->dequant, eob,
565 scan_order->scan, scan_order->iscan); 557 scan_order->scan, scan_order->iscan);
566 break; 558 break;
567 case TX_16X16: 559 case TX_16X16:
568 vp9_highbd_fdct16x16(src_diff, coeff, diff_stride); 560 vp9_highbd_fdct16x16(src_diff, coeff, diff_stride);
569 vp9_highbd_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, 561 vp9_highbd_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round,
570 p->quant, p->quant_shift, qcoeff, dqcoeff, 562 p->quant, p->quant_shift, qcoeff, dqcoeff,
571 pd->dequant, p->zbin_extra, eob, 563 pd->dequant, eob,
572 scan_order->scan, scan_order->iscan); 564 scan_order->scan, scan_order->iscan);
573 break; 565 break;
574 case TX_8X8: 566 case TX_8X8:
575 vp9_highbd_fdct8x8(src_diff, coeff, diff_stride); 567 vp9_highbd_fdct8x8(src_diff, coeff, diff_stride);
576 vp9_highbd_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, 568 vp9_highbd_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round,
577 p->quant, p->quant_shift, qcoeff, dqcoeff, 569 p->quant, p->quant_shift, qcoeff, dqcoeff,
578 pd->dequant, p->zbin_extra, eob, 570 pd->dequant, eob,
579 scan_order->scan, scan_order->iscan); 571 scan_order->scan, scan_order->iscan);
580 break; 572 break;
581 case TX_4X4: 573 case TX_4X4:
582 x->fwd_txm4x4(src_diff, coeff, diff_stride); 574 x->fwd_txm4x4(src_diff, coeff, diff_stride);
583 vp9_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, 575 vp9_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round,
584 p->quant, p->quant_shift, qcoeff, dqcoeff, 576 p->quant, p->quant_shift, qcoeff, dqcoeff,
585 pd->dequant, p->zbin_extra, eob, 577 pd->dequant, eob,
586 scan_order->scan, scan_order->iscan); 578 scan_order->scan, scan_order->iscan);
587 break; 579 break;
588 default: 580 default:
589 assert(0); 581 assert(0);
590 } 582 }
591 return; 583 return;
592 } 584 }
593 #endif // CONFIG_VP9_HIGHBITDEPTH 585 #endif // CONFIG_VP9_HIGHBITDEPTH
594 586
595 switch (tx_size) { 587 switch (tx_size) {
596 case TX_32X32: 588 case TX_32X32:
597 fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride); 589 fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
598 vp9_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round, 590 vp9_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round,
599 p->quant, p->quant_shift, qcoeff, dqcoeff, 591 p->quant, p->quant_shift, qcoeff, dqcoeff,
600 pd->dequant, p->zbin_extra, eob, scan_order->scan, 592 pd->dequant, eob, scan_order->scan,
601 scan_order->iscan); 593 scan_order->iscan);
602 break; 594 break;
603 case TX_16X16: 595 case TX_16X16:
604 vp9_fdct16x16(src_diff, coeff, diff_stride); 596 vp9_fdct16x16(src_diff, coeff, diff_stride);
605 vp9_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, 597 vp9_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round,
606 p->quant, p->quant_shift, qcoeff, dqcoeff, 598 p->quant, p->quant_shift, qcoeff, dqcoeff,
607 pd->dequant, p->zbin_extra, eob, 599 pd->dequant, eob,
608 scan_order->scan, scan_order->iscan); 600 scan_order->scan, scan_order->iscan);
609 break; 601 break;
610 case TX_8X8: 602 case TX_8X8:
611 vp9_fdct8x8(src_diff, coeff, diff_stride); 603 vp9_fdct8x8(src_diff, coeff, diff_stride);
612 vp9_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, 604 vp9_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round,
613 p->quant, p->quant_shift, qcoeff, dqcoeff, 605 p->quant, p->quant_shift, qcoeff, dqcoeff,
614 pd->dequant, p->zbin_extra, eob, 606 pd->dequant, eob,
615 scan_order->scan, scan_order->iscan); 607 scan_order->scan, scan_order->iscan);
616 break; 608 break;
617 case TX_4X4: 609 case TX_4X4:
618 x->fwd_txm4x4(src_diff, coeff, diff_stride); 610 x->fwd_txm4x4(src_diff, coeff, diff_stride);
619 vp9_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, 611 vp9_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round,
620 p->quant, p->quant_shift, qcoeff, dqcoeff, 612 p->quant, p->quant_shift, qcoeff, dqcoeff,
621 pd->dequant, p->zbin_extra, eob, 613 pd->dequant, eob,
622 scan_order->scan, scan_order->iscan); 614 scan_order->scan, scan_order->iscan);
623 break; 615 break;
624 default: 616 default:
625 assert(0); 617 assert(0);
626 break; 618 break;
627 } 619 }
628 } 620 }
629 621
630 static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize, 622 static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize,
631 TX_SIZE tx_size, void *arg) { 623 TX_SIZE tx_size, void *arg) {
(...skipping 13 matching lines...) Expand all
645 l = &ctx->tl[plane][j]; 637 l = &ctx->tl[plane][j];
646 638
647 // TODO(jingning): per transformed block zero forcing only enabled for 639 // TODO(jingning): per transformed block zero forcing only enabled for
648 // luma component. will integrate chroma components as well. 640 // luma component. will integrate chroma components as well.
649 if (x->zcoeff_blk[tx_size][block] && plane == 0) { 641 if (x->zcoeff_blk[tx_size][block] && plane == 0) {
650 p->eobs[block] = 0; 642 p->eobs[block] = 0;
651 *a = *l = 0; 643 *a = *l = 0;
652 return; 644 return;
653 } 645 }
654 646
655 #if CONFIG_VP9_HIGHBITDEPTH
656 if (!x->skip_recode)
657 vp9_xform_quant(x, plane, block, plane_bsize, tx_size);
658 #else
659 if (!x->skip_recode) { 647 if (!x->skip_recode) {
660 if (x->quant_fp) { 648 if (x->quant_fp) {
661 // Encoding process for rtc mode 649 // Encoding process for rtc mode
662 if (x->skip_txfm[0] == 1 && plane == 0) { 650 if (x->skip_txfm[0] == 1 && plane == 0) {
663 // skip forward transform 651 // skip forward transform
664 p->eobs[block] = 0; 652 p->eobs[block] = 0;
665 *a = *l = 0; 653 *a = *l = 0;
666 return; 654 return;
667 } else { 655 } else {
668 vp9_xform_quant_fp(x, plane, block, plane_bsize, tx_size); 656 vp9_xform_quant_fp(x, plane, block, plane_bsize, tx_size);
(...skipping 11 matching lines...) Expand all
680 // skip forward transform 668 // skip forward transform
681 p->eobs[block] = 0; 669 p->eobs[block] = 0;
682 *a = *l = 0; 670 *a = *l = 0;
683 return; 671 return;
684 } 672 }
685 } else { 673 } else {
686 vp9_xform_quant(x, plane, block, plane_bsize, tx_size); 674 vp9_xform_quant(x, plane, block, plane_bsize, tx_size);
687 } 675 }
688 } 676 }
689 } 677 }
690 #endif
691 678
692 if (x->optimize && (!x->skip_recode || !x->skip_optimize)) { 679 if (x->optimize && (!x->skip_recode || !x->skip_optimize)) {
693 const int ctx = combine_entropy_contexts(*a, *l); 680 const int ctx = combine_entropy_contexts(*a, *l);
694 *a = *l = optimize_b(x, plane, block, tx_size, ctx) > 0; 681 *a = *l = optimize_b(x, plane, block, tx_size, ctx) > 0;
695 } else { 682 } else {
696 *a = *l = p->eobs[block] > 0; 683 *a = *l = p->eobs[block] > 0;
697 } 684 }
698 685
699 if (p->eobs[block]) 686 if (p->eobs[block])
700 *(args->skip) = 0; 687 *(args->skip) = 0;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 vp9_predict_intra_block(xd, block >> 6, bwl, TX_32X32, mode, 834 vp9_predict_intra_block(xd, block >> 6, bwl, TX_32X32, mode,
848 x->skip_encode ? src : dst, 835 x->skip_encode ? src : dst,
849 x->skip_encode ? src_stride : dst_stride, 836 x->skip_encode ? src_stride : dst_stride,
850 dst, dst_stride, i, j, plane); 837 dst, dst_stride, i, j, plane);
851 if (!x->skip_recode) { 838 if (!x->skip_recode) {
852 vp9_highbd_subtract_block(32, 32, src_diff, diff_stride, 839 vp9_highbd_subtract_block(32, 32, src_diff, diff_stride,
853 src, src_stride, dst, dst_stride, xd->bd); 840 src, src_stride, dst, dst_stride, xd->bd);
854 highbd_fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride); 841 highbd_fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
855 vp9_highbd_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, 842 vp9_highbd_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin,
856 p->round, p->quant, p->quant_shift, 843 p->round, p->quant, p->quant_shift,
857 qcoeff, dqcoeff, pd->dequant, 844 qcoeff, dqcoeff, pd->dequant, eob,
858 p->zbin_extra, eob,
859 scan_order->scan, scan_order->iscan); 845 scan_order->scan, scan_order->iscan);
860 } 846 }
861 if (!x->skip_encode && *eob) { 847 if (!x->skip_encode && *eob) {
862 vp9_highbd_idct32x32_add(dqcoeff, dst, dst_stride, *eob, xd->bd); 848 vp9_highbd_idct32x32_add(dqcoeff, dst, dst_stride, *eob, xd->bd);
863 } 849 }
864 break; 850 break;
865 case TX_16X16: 851 case TX_16X16:
866 tx_type = get_tx_type(pd->plane_type, xd); 852 tx_type = get_tx_type(pd->plane_type, xd);
867 scan_order = &vp9_scan_orders[TX_16X16][tx_type]; 853 scan_order = &vp9_scan_orders[TX_16X16][tx_type];
868 mode = plane == 0 ? mbmi->mode : mbmi->uv_mode; 854 mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
869 vp9_predict_intra_block(xd, block >> 4, bwl, TX_16X16, mode, 855 vp9_predict_intra_block(xd, block >> 4, bwl, TX_16X16, mode,
870 x->skip_encode ? src : dst, 856 x->skip_encode ? src : dst,
871 x->skip_encode ? src_stride : dst_stride, 857 x->skip_encode ? src_stride : dst_stride,
872 dst, dst_stride, i, j, plane); 858 dst, dst_stride, i, j, plane);
873 if (!x->skip_recode) { 859 if (!x->skip_recode) {
874 vp9_highbd_subtract_block(16, 16, src_diff, diff_stride, 860 vp9_highbd_subtract_block(16, 16, src_diff, diff_stride,
875 src, src_stride, dst, dst_stride, xd->bd); 861 src, src_stride, dst, dst_stride, xd->bd);
876 vp9_highbd_fht16x16(src_diff, coeff, diff_stride, tx_type); 862 vp9_highbd_fht16x16(src_diff, coeff, diff_stride, tx_type);
877 vp9_highbd_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, 863 vp9_highbd_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round,
878 p->quant, p->quant_shift, qcoeff, dqcoeff, 864 p->quant, p->quant_shift, qcoeff, dqcoeff,
879 pd->dequant, p->zbin_extra, eob, 865 pd->dequant, eob,
880 scan_order->scan, scan_order->iscan); 866 scan_order->scan, scan_order->iscan);
881 } 867 }
882 if (!x->skip_encode && *eob) { 868 if (!x->skip_encode && *eob) {
883 vp9_highbd_iht16x16_add(tx_type, dqcoeff, dst, dst_stride, 869 vp9_highbd_iht16x16_add(tx_type, dqcoeff, dst, dst_stride,
884 *eob, xd->bd); 870 *eob, xd->bd);
885 } 871 }
886 break; 872 break;
887 case TX_8X8: 873 case TX_8X8:
888 tx_type = get_tx_type(pd->plane_type, xd); 874 tx_type = get_tx_type(pd->plane_type, xd);
889 scan_order = &vp9_scan_orders[TX_8X8][tx_type]; 875 scan_order = &vp9_scan_orders[TX_8X8][tx_type];
890 mode = plane == 0 ? mbmi->mode : mbmi->uv_mode; 876 mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
891 vp9_predict_intra_block(xd, block >> 2, bwl, TX_8X8, mode, 877 vp9_predict_intra_block(xd, block >> 2, bwl, TX_8X8, mode,
892 x->skip_encode ? src : dst, 878 x->skip_encode ? src : dst,
893 x->skip_encode ? src_stride : dst_stride, 879 x->skip_encode ? src_stride : dst_stride,
894 dst, dst_stride, i, j, plane); 880 dst, dst_stride, i, j, plane);
895 if (!x->skip_recode) { 881 if (!x->skip_recode) {
896 vp9_highbd_subtract_block(8, 8, src_diff, diff_stride, 882 vp9_highbd_subtract_block(8, 8, src_diff, diff_stride,
897 src, src_stride, dst, dst_stride, xd->bd); 883 src, src_stride, dst, dst_stride, xd->bd);
898 vp9_highbd_fht8x8(src_diff, coeff, diff_stride, tx_type); 884 vp9_highbd_fht8x8(src_diff, coeff, diff_stride, tx_type);
899 vp9_highbd_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, 885 vp9_highbd_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round,
900 p->quant, p->quant_shift, qcoeff, dqcoeff, 886 p->quant, p->quant_shift, qcoeff, dqcoeff,
901 pd->dequant, p->zbin_extra, eob, 887 pd->dequant, eob,
902 scan_order->scan, scan_order->iscan); 888 scan_order->scan, scan_order->iscan);
903 } 889 }
904 if (!x->skip_encode && *eob) { 890 if (!x->skip_encode && *eob) {
905 vp9_highbd_iht8x8_add(tx_type, dqcoeff, dst, dst_stride, *eob, 891 vp9_highbd_iht8x8_add(tx_type, dqcoeff, dst, dst_stride, *eob,
906 xd->bd); 892 xd->bd);
907 } 893 }
908 break; 894 break;
909 case TX_4X4: 895 case TX_4X4:
910 tx_type = get_tx_type_4x4(pd->plane_type, xd, block); 896 tx_type = get_tx_type_4x4(pd->plane_type, xd, block);
911 scan_order = &vp9_scan_orders[TX_4X4][tx_type]; 897 scan_order = &vp9_scan_orders[TX_4X4][tx_type];
912 mode = plane == 0 ? get_y_mode(xd->mi[0].src_mi, block) : mbmi->uv_mode; 898 mode = plane == 0 ? get_y_mode(xd->mi[0].src_mi, block) : mbmi->uv_mode;
913 vp9_predict_intra_block(xd, block, bwl, TX_4X4, mode, 899 vp9_predict_intra_block(xd, block, bwl, TX_4X4, mode,
914 x->skip_encode ? src : dst, 900 x->skip_encode ? src : dst,
915 x->skip_encode ? src_stride : dst_stride, 901 x->skip_encode ? src_stride : dst_stride,
916 dst, dst_stride, i, j, plane); 902 dst, dst_stride, i, j, plane);
917 903
918 if (!x->skip_recode) { 904 if (!x->skip_recode) {
919 vp9_highbd_subtract_block(4, 4, src_diff, diff_stride, 905 vp9_highbd_subtract_block(4, 4, src_diff, diff_stride,
920 src, src_stride, dst, dst_stride, xd->bd); 906 src, src_stride, dst, dst_stride, xd->bd);
921 if (tx_type != DCT_DCT) 907 if (tx_type != DCT_DCT)
922 vp9_highbd_fht4x4(src_diff, coeff, diff_stride, tx_type); 908 vp9_highbd_fht4x4(src_diff, coeff, diff_stride, tx_type);
923 else 909 else
924 x->fwd_txm4x4(src_diff, coeff, diff_stride); 910 x->fwd_txm4x4(src_diff, coeff, diff_stride);
925 vp9_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, 911 vp9_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round,
926 p->quant, p->quant_shift, qcoeff, dqcoeff, 912 p->quant, p->quant_shift, qcoeff, dqcoeff,
927 pd->dequant, p->zbin_extra, eob, 913 pd->dequant, eob,
928 scan_order->scan, scan_order->iscan); 914 scan_order->scan, scan_order->iscan);
929 } 915 }
930 916
931 if (!x->skip_encode && *eob) { 917 if (!x->skip_encode && *eob) {
932 if (tx_type == DCT_DCT) { 918 if (tx_type == DCT_DCT) {
933 // this is like vp9_short_idct4x4 but has a special case around 919 // this is like vp9_short_idct4x4 but has a special case around
934 // eob<=1 which is significant (not just an optimization) for the 920 // eob<=1 which is significant (not just an optimization) for the
935 // lossless case. 921 // lossless case.
936 x->highbd_itxm_add(dqcoeff, dst, dst_stride, *eob, xd->bd); 922 x->highbd_itxm_add(dqcoeff, dst, dst_stride, *eob, xd->bd);
937 } else { 923 } else {
(...skipping 18 matching lines...) Expand all
956 vp9_predict_intra_block(xd, block >> 6, bwl, TX_32X32, mode, 942 vp9_predict_intra_block(xd, block >> 6, bwl, TX_32X32, mode,
957 x->skip_encode ? src : dst, 943 x->skip_encode ? src : dst,
958 x->skip_encode ? src_stride : dst_stride, 944 x->skip_encode ? src_stride : dst_stride,
959 dst, dst_stride, i, j, plane); 945 dst, dst_stride, i, j, plane);
960 if (!x->skip_recode) { 946 if (!x->skip_recode) {
961 vp9_subtract_block(32, 32, src_diff, diff_stride, 947 vp9_subtract_block(32, 32, src_diff, diff_stride,
962 src, src_stride, dst, dst_stride); 948 src, src_stride, dst, dst_stride);
963 fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride); 949 fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
964 vp9_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round, 950 vp9_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round,
965 p->quant, p->quant_shift, qcoeff, dqcoeff, 951 p->quant, p->quant_shift, qcoeff, dqcoeff,
966 pd->dequant, p->zbin_extra, eob, scan_order->scan, 952 pd->dequant, eob, scan_order->scan,
967 scan_order->iscan); 953 scan_order->iscan);
968 } 954 }
969 if (!x->skip_encode && *eob) 955 if (!x->skip_encode && *eob)
970 vp9_idct32x32_add(dqcoeff, dst, dst_stride, *eob); 956 vp9_idct32x32_add(dqcoeff, dst, dst_stride, *eob);
971 break; 957 break;
972 case TX_16X16: 958 case TX_16X16:
973 tx_type = get_tx_type(pd->plane_type, xd); 959 tx_type = get_tx_type(pd->plane_type, xd);
974 scan_order = &vp9_scan_orders[TX_16X16][tx_type]; 960 scan_order = &vp9_scan_orders[TX_16X16][tx_type];
975 mode = plane == 0 ? mbmi->mode : mbmi->uv_mode; 961 mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
976 vp9_predict_intra_block(xd, block >> 4, bwl, TX_16X16, mode, 962 vp9_predict_intra_block(xd, block >> 4, bwl, TX_16X16, mode,
977 x->skip_encode ? src : dst, 963 x->skip_encode ? src : dst,
978 x->skip_encode ? src_stride : dst_stride, 964 x->skip_encode ? src_stride : dst_stride,
979 dst, dst_stride, i, j, plane); 965 dst, dst_stride, i, j, plane);
980 if (!x->skip_recode) { 966 if (!x->skip_recode) {
981 vp9_subtract_block(16, 16, src_diff, diff_stride, 967 vp9_subtract_block(16, 16, src_diff, diff_stride,
982 src, src_stride, dst, dst_stride); 968 src, src_stride, dst, dst_stride);
983 vp9_fht16x16(src_diff, coeff, diff_stride, tx_type); 969 vp9_fht16x16(src_diff, coeff, diff_stride, tx_type);
984 vp9_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, 970 vp9_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round,
985 p->quant, p->quant_shift, qcoeff, dqcoeff, 971 p->quant, p->quant_shift, qcoeff, dqcoeff,
986 pd->dequant, p->zbin_extra, eob, scan_order->scan, 972 pd->dequant, eob, scan_order->scan,
987 scan_order->iscan); 973 scan_order->iscan);
988 } 974 }
989 if (!x->skip_encode && *eob) 975 if (!x->skip_encode && *eob)
990 vp9_iht16x16_add(tx_type, dqcoeff, dst, dst_stride, *eob); 976 vp9_iht16x16_add(tx_type, dqcoeff, dst, dst_stride, *eob);
991 break; 977 break;
992 case TX_8X8: 978 case TX_8X8:
993 tx_type = get_tx_type(pd->plane_type, xd); 979 tx_type = get_tx_type(pd->plane_type, xd);
994 scan_order = &vp9_scan_orders[TX_8X8][tx_type]; 980 scan_order = &vp9_scan_orders[TX_8X8][tx_type];
995 mode = plane == 0 ? mbmi->mode : mbmi->uv_mode; 981 mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
996 vp9_predict_intra_block(xd, block >> 2, bwl, TX_8X8, mode, 982 vp9_predict_intra_block(xd, block >> 2, bwl, TX_8X8, mode,
997 x->skip_encode ? src : dst, 983 x->skip_encode ? src : dst,
998 x->skip_encode ? src_stride : dst_stride, 984 x->skip_encode ? src_stride : dst_stride,
999 dst, dst_stride, i, j, plane); 985 dst, dst_stride, i, j, plane);
1000 if (!x->skip_recode) { 986 if (!x->skip_recode) {
1001 vp9_subtract_block(8, 8, src_diff, diff_stride, 987 vp9_subtract_block(8, 8, src_diff, diff_stride,
1002 src, src_stride, dst, dst_stride); 988 src, src_stride, dst, dst_stride);
1003 vp9_fht8x8(src_diff, coeff, diff_stride, tx_type); 989 vp9_fht8x8(src_diff, coeff, diff_stride, tx_type);
1004 vp9_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, p->quant, 990 vp9_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, p->quant,
1005 p->quant_shift, qcoeff, dqcoeff, 991 p->quant_shift, qcoeff, dqcoeff,
1006 pd->dequant, p->zbin_extra, eob, scan_order->scan, 992 pd->dequant, eob, scan_order->scan,
1007 scan_order->iscan); 993 scan_order->iscan);
1008 } 994 }
1009 if (!x->skip_encode && *eob) 995 if (!x->skip_encode && *eob)
1010 vp9_iht8x8_add(tx_type, dqcoeff, dst, dst_stride, *eob); 996 vp9_iht8x8_add(tx_type, dqcoeff, dst, dst_stride, *eob);
1011 break; 997 break;
1012 case TX_4X4: 998 case TX_4X4:
1013 tx_type = get_tx_type_4x4(pd->plane_type, xd, block); 999 tx_type = get_tx_type_4x4(pd->plane_type, xd, block);
1014 scan_order = &vp9_scan_orders[TX_4X4][tx_type]; 1000 scan_order = &vp9_scan_orders[TX_4X4][tx_type];
1015 mode = plane == 0 ? get_y_mode(xd->mi[0].src_mi, block) : mbmi->uv_mode; 1001 mode = plane == 0 ? get_y_mode(xd->mi[0].src_mi, block) : mbmi->uv_mode;
1016 vp9_predict_intra_block(xd, block, bwl, TX_4X4, mode, 1002 vp9_predict_intra_block(xd, block, bwl, TX_4X4, mode,
1017 x->skip_encode ? src : dst, 1003 x->skip_encode ? src : dst,
1018 x->skip_encode ? src_stride : dst_stride, 1004 x->skip_encode ? src_stride : dst_stride,
1019 dst, dst_stride, i, j, plane); 1005 dst, dst_stride, i, j, plane);
1020 1006
1021 if (!x->skip_recode) { 1007 if (!x->skip_recode) {
1022 vp9_subtract_block(4, 4, src_diff, diff_stride, 1008 vp9_subtract_block(4, 4, src_diff, diff_stride,
1023 src, src_stride, dst, dst_stride); 1009 src, src_stride, dst, dst_stride);
1024 if (tx_type != DCT_DCT) 1010 if (tx_type != DCT_DCT)
1025 vp9_fht4x4(src_diff, coeff, diff_stride, tx_type); 1011 vp9_fht4x4(src_diff, coeff, diff_stride, tx_type);
1026 else 1012 else
1027 x->fwd_txm4x4(src_diff, coeff, diff_stride); 1013 x->fwd_txm4x4(src_diff, coeff, diff_stride);
1028 vp9_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, p->quant, 1014 vp9_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, p->quant,
1029 p->quant_shift, qcoeff, dqcoeff, 1015 p->quant_shift, qcoeff, dqcoeff,
1030 pd->dequant, p->zbin_extra, eob, scan_order->scan, 1016 pd->dequant, eob, scan_order->scan,
1031 scan_order->iscan); 1017 scan_order->iscan);
1032 } 1018 }
1033 1019
1034 if (!x->skip_encode && *eob) { 1020 if (!x->skip_encode && *eob) {
1035 if (tx_type == DCT_DCT) 1021 if (tx_type == DCT_DCT)
1036 // this is like vp9_short_idct4x4 but has a special case around eob<=1 1022 // this is like vp9_short_idct4x4 but has a special case around eob<=1
1037 // which is significant (not just an optimization) for the lossless 1023 // which is significant (not just an optimization) for the lossless
1038 // case. 1024 // case.
1039 x->itxm_add(dqcoeff, dst, dst_stride, *eob); 1025 x->itxm_add(dqcoeff, dst, dst_stride, *eob);
1040 else 1026 else
1041 vp9_iht4x4_16_add(dqcoeff, dst, dst_stride, tx_type); 1027 vp9_iht4x4_16_add(dqcoeff, dst, dst_stride, tx_type);
1042 } 1028 }
1043 break; 1029 break;
1044 default: 1030 default:
1045 assert(0); 1031 assert(0);
1046 break; 1032 break;
1047 } 1033 }
1048 if (*eob) 1034 if (*eob)
1049 *(args->skip) = 0; 1035 *(args->skip) = 0;
1050 } 1036 }
1051 1037
1052 void vp9_encode_intra_block_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) { 1038 void vp9_encode_intra_block_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {
1053 const MACROBLOCKD *const xd = &x->e_mbd; 1039 const MACROBLOCKD *const xd = &x->e_mbd;
1054 struct encode_b_args arg = {x, NULL, &xd->mi[0].src_mi->mbmi.skip}; 1040 struct encode_b_args arg = {x, NULL, &xd->mi[0].src_mi->mbmi.skip};
1055 1041
1056 vp9_foreach_transformed_block_in_plane(xd, bsize, plane, 1042 vp9_foreach_transformed_block_in_plane(xd, bsize, plane,
1057 vp9_encode_block_intra, &arg); 1043 vp9_encode_block_intra, &arg);
1058 } 1044 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_encodeframe.c ('k') | source/libvpx/vp9/encoder/vp9_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698