2010-05-18 17:58:33 +02:00
|
|
|
/*
|
2010-09-09 14:16:39 +02:00
|
|
|
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
2010-05-18 17:58:33 +02:00
|
|
|
*
|
2010-06-18 18:39:21 +02:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
2010-06-04 22:19:40 +02:00
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
2010-06-18 18:39:21 +02:00
|
|
|
* in the file PATENTS. All contributing project authors may
|
2010-06-04 22:19:40 +02:00
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2010-05-18 17:58:33 +02:00
|
|
|
*/
|
|
|
|
|
2012-12-23 16:20:10 +01:00
|
|
|
#include "./vpx_config.h"
|
2012-11-09 02:09:30 +01:00
|
|
|
#include "vp9_rtcd.h"
|
2012-11-28 19:41:40 +01:00
|
|
|
#include "vp9/encoder/vp9_quantize.h"
|
2012-11-27 22:59:17 +01:00
|
|
|
#include "vp9/common/vp9_reconintra.h"
|
2012-11-28 19:41:40 +01:00
|
|
|
#include "vp9/encoder/vp9_encodemb.h"
|
2012-11-27 22:59:17 +01:00
|
|
|
#include "vp9/common/vp9_invtrans.h"
|
2012-11-28 19:41:40 +01:00
|
|
|
#include "vp9/encoder/vp9_encodeintra.h"
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2013-04-29 21:43:38 +02:00
|
|
|
static void encode_intra4x4block(MACROBLOCK *x, int ib, BLOCK_SIZE_TYPE bs);
|
2013-04-02 23:50:40 +02:00
|
|
|
|
2012-10-31 01:53:32 +01:00
|
|
|
int vp9_encode_intra(VP9_COMP *cpi, MACROBLOCK *x, int use_16x16_pred) {
|
2012-08-10 15:12:43 +02:00
|
|
|
MB_MODE_INFO * mbmi = &x->e_mbd.mode_info_context->mbmi;
|
2012-07-14 00:21:29 +02:00
|
|
|
(void) cpi;
|
2011-06-14 12:39:06 +02:00
|
|
|
|
2013-05-01 01:13:20 +02:00
|
|
|
#if !CONFIG_SB8X8
|
2012-07-14 00:21:29 +02:00
|
|
|
if (use_16x16_pred) {
|
2013-05-01 01:13:20 +02:00
|
|
|
#endif
|
2012-08-10 15:12:43 +02:00
|
|
|
mbmi->mode = DC_PRED;
|
|
|
|
mbmi->uv_mode = DC_PRED;
|
|
|
|
mbmi->ref_frame = INTRA_FRAME;
|
2012-07-14 00:21:29 +02:00
|
|
|
|
2013-02-20 19:16:24 +01:00
|
|
|
vp9_encode_intra16x16mby(&cpi->common, x);
|
2013-05-01 01:13:20 +02:00
|
|
|
#if !CONFIG_SB8X8
|
2012-07-14 00:21:29 +02:00
|
|
|
} else {
|
2013-02-28 22:18:02 +01:00
|
|
|
int i;
|
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (i = 0; i < 16; i++) {
|
2013-04-26 16:19:43 +02:00
|
|
|
x->e_mbd.mode_info_context->bmi[i].as_mode.first = B_DC_PRED;
|
2013-04-29 21:43:38 +02:00
|
|
|
encode_intra4x4block(x, i, BLOCK_SIZE_MB16X16);
|
2011-06-14 12:39:06 +02:00
|
|
|
}
|
2012-07-14 00:21:29 +02:00
|
|
|
}
|
2013-05-01 01:13:20 +02:00
|
|
|
#endif
|
2011-06-14 12:39:06 +02:00
|
|
|
|
2013-04-23 17:26:10 +02:00
|
|
|
return vp9_get_mb_ss(x->plane[0].src_diff);
|
2011-06-14 12:39:06 +02:00
|
|
|
}
|
2011-05-20 03:37:13 +02:00
|
|
|
|
2013-04-29 21:43:38 +02:00
|
|
|
static void encode_intra4x4block(MACROBLOCK *x, int ib,
|
|
|
|
BLOCK_SIZE_TYPE bsize) {
|
2013-04-02 23:50:40 +02:00
|
|
|
MACROBLOCKD * const xd = &x->e_mbd;
|
2012-10-16 01:41:41 +02:00
|
|
|
TX_TYPE tx_type;
|
2013-04-24 01:22:47 +02:00
|
|
|
uint8_t* const src =
|
2013-04-29 21:43:38 +02:00
|
|
|
raster_block_offset_uint8(xd, bsize, 0, ib,
|
2013-04-24 01:22:47 +02:00
|
|
|
x->plane[0].src.buf, x->plane[0].src.stride);
|
2013-04-25 20:15:38 +02:00
|
|
|
uint8_t* const dst =
|
2013-04-29 21:43:38 +02:00
|
|
|
raster_block_offset_uint8(xd, bsize, 0, ib,
|
2013-04-25 20:15:38 +02:00
|
|
|
xd->plane[0].dst.buf, xd->plane[0].dst.stride);
|
2013-04-23 17:26:10 +02:00
|
|
|
int16_t* const src_diff =
|
2013-04-29 21:43:38 +02:00
|
|
|
raster_block_offset_int16(xd, bsize, 0, ib,
|
2013-04-23 17:26:10 +02:00
|
|
|
x->plane[0].src_diff);
|
2013-04-25 00:01:35 +02:00
|
|
|
int16_t* const diff =
|
2013-04-29 21:43:38 +02:00
|
|
|
raster_block_offset_int16(xd, bsize, 0, ib,
|
2013-04-25 00:01:35 +02:00
|
|
|
xd->plane[0].diff);
|
2013-04-23 23:38:52 +02:00
|
|
|
int16_t* const coeff = BLOCK_OFFSET(x->plane[0].coeff, ib, 16);
|
2011-05-20 03:37:13 +02:00
|
|
|
|
2013-05-01 01:13:20 +02:00
|
|
|
assert(ib < (16 >> (2 * CONFIG_SB8X8)));
|
2013-04-02 23:50:40 +02:00
|
|
|
|
2012-10-09 22:19:15 +02:00
|
|
|
#if CONFIG_NEWBINTRAMODES
|
2013-04-26 16:19:43 +02:00
|
|
|
xd->mode_info_context->bmi[ib].as_mode.context =
|
2013-04-25 20:15:38 +02:00
|
|
|
vp9_find_bpred_context(&x->e_mbd, ib, dst, xd->plane[0].dst.stride);
|
2012-10-09 22:19:15 +02:00
|
|
|
#endif
|
|
|
|
|
2013-04-24 01:22:47 +02:00
|
|
|
vp9_intra4x4_predict(&x->e_mbd, ib,
|
2013-04-26 16:19:43 +02:00
|
|
|
xd->mode_info_context->bmi[ib].as_mode.first,
|
2013-04-25 20:15:38 +02:00
|
|
|
dst, xd->plane[0].dst.stride);
|
2013-05-01 01:13:20 +02:00
|
|
|
vp9_subtract_block(4, 4, src_diff, 16 >> CONFIG_SB8X8,
|
2013-04-24 01:22:47 +02:00
|
|
|
src, x->plane[0].src.stride,
|
2013-04-25 20:15:38 +02:00
|
|
|
dst, xd->plane[0].dst.stride);
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2013-03-06 00:18:06 +01:00
|
|
|
tx_type = get_tx_type_4x4(&x->e_mbd, ib);
|
2012-10-16 01:41:41 +02:00
|
|
|
if (tx_type != DCT_DCT) {
|
2013-05-01 01:13:20 +02:00
|
|
|
vp9_short_fht4x4(src_diff, coeff, 16 >> CONFIG_SB8X8, tx_type);
|
2013-04-25 23:44:44 +02:00
|
|
|
x->quantize_b_4x4(x, ib, tx_type, 16);
|
2013-04-02 23:50:40 +02:00
|
|
|
vp9_short_iht4x4(BLOCK_OFFSET(xd->plane[0].dqcoeff, ib, 16),
|
2013-05-01 01:13:20 +02:00
|
|
|
diff, 16 >> CONFIG_SB8X8, tx_type);
|
2012-10-22 20:55:29 +02:00
|
|
|
} else {
|
2013-05-01 01:13:20 +02:00
|
|
|
x->fwd_txm4x4(src_diff, coeff, 32 >> CONFIG_SB8X8);
|
2013-04-25 23:44:44 +02:00
|
|
|
x->quantize_b_4x4(x, ib, tx_type, 16);
|
2013-04-04 21:03:27 +02:00
|
|
|
vp9_inverse_transform_b_4x4(&x->e_mbd, xd->plane[0].eobs[ib],
|
2013-04-02 23:50:40 +02:00
|
|
|
BLOCK_OFFSET(xd->plane[0].dqcoeff, ib, 16),
|
2013-05-01 01:13:20 +02:00
|
|
|
diff, 32 >> CONFIG_SB8X8);
|
2012-09-10 07:42:35 +02:00
|
|
|
}
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2013-04-25 20:15:38 +02:00
|
|
|
vp9_recon_b(dst, diff, dst, xd->plane[0].dst.stride);
|
2010-05-18 17:58:33 +02:00
|
|
|
}
|
|
|
|
|
2013-04-29 21:43:38 +02:00
|
|
|
void vp9_encode_intra4x4mby(MACROBLOCK *mb, BLOCK_SIZE_TYPE bsize) {
|
2012-07-14 00:21:29 +02:00
|
|
|
int i;
|
2013-04-29 21:43:38 +02:00
|
|
|
int bwl = b_width_log2(bsize), bhl = b_height_log2(bsize);
|
|
|
|
int bc = 1 << (bwl + bhl);
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2013-04-29 21:43:38 +02:00
|
|
|
for (i = 0; i < bc; i++)
|
|
|
|
encode_intra4x4block(mb, i, bsize);
|
2010-05-18 17:58:33 +02:00
|
|
|
}
|
|
|
|
|
2013-02-20 19:16:24 +01:00
|
|
|
void vp9_encode_intra16x16mby(VP9_COMMON *const cm, MACROBLOCK *x) {
|
2012-10-13 18:27:54 +02:00
|
|
|
MACROBLOCKD *xd = &x->e_mbd;
|
|
|
|
TX_SIZE tx_size = xd->mode_info_context->mbmi.txfm_size;
|
2011-11-04 19:29:51 +01:00
|
|
|
|
2013-04-15 18:31:27 +02:00
|
|
|
vp9_build_intra_predictors_sby_s(xd, BLOCK_SIZE_MB16X16);
|
2013-04-23 17:26:10 +02:00
|
|
|
vp9_subtract_sby(x, BLOCK_SIZE_MB16X16);
|
2011-11-04 19:29:51 +01:00
|
|
|
|
2013-02-28 22:18:02 +01:00
|
|
|
switch (tx_size) {
|
|
|
|
case TX_16X16:
|
2013-04-11 19:57:16 +02:00
|
|
|
vp9_transform_sby_16x16(x, BLOCK_SIZE_MB16X16);
|
|
|
|
vp9_quantize_sby_16x16(x, BLOCK_SIZE_MB16X16);
|
2013-02-28 22:18:02 +01:00
|
|
|
if (x->optimize)
|
2013-04-30 18:54:51 +02:00
|
|
|
vp9_optimize_sby(cm, x, BLOCK_SIZE_MB16X16);
|
2013-04-11 19:57:16 +02:00
|
|
|
vp9_inverse_transform_sby_16x16(xd, BLOCK_SIZE_MB16X16);
|
2013-02-28 22:18:02 +01:00
|
|
|
break;
|
|
|
|
case TX_8X8:
|
2013-04-11 19:57:16 +02:00
|
|
|
vp9_transform_sby_8x8(x, BLOCK_SIZE_MB16X16);
|
|
|
|
vp9_quantize_sby_8x8(x, BLOCK_SIZE_MB16X16);
|
2013-02-28 22:18:02 +01:00
|
|
|
if (x->optimize)
|
2013-04-30 18:54:51 +02:00
|
|
|
vp9_optimize_sby(cm, x, BLOCK_SIZE_MB16X16);
|
2013-04-11 19:57:16 +02:00
|
|
|
vp9_inverse_transform_sby_8x8(xd, BLOCK_SIZE_MB16X16);
|
2013-02-28 22:18:02 +01:00
|
|
|
break;
|
|
|
|
default:
|
2013-04-11 19:57:16 +02:00
|
|
|
vp9_transform_sby_4x4(x, BLOCK_SIZE_MB16X16);
|
|
|
|
vp9_quantize_sby_4x4(x, BLOCK_SIZE_MB16X16);
|
2013-02-28 22:18:02 +01:00
|
|
|
if (x->optimize)
|
2013-04-30 18:54:51 +02:00
|
|
|
vp9_optimize_sby(cm, x, BLOCK_SIZE_MB16X16);
|
2013-04-11 19:57:16 +02:00
|
|
|
vp9_inverse_transform_sby_4x4(xd, BLOCK_SIZE_MB16X16);
|
2013-02-28 22:18:02 +01:00
|
|
|
break;
|
2012-07-14 00:21:29 +02:00
|
|
|
}
|
|
|
|
|
2013-04-19 21:12:00 +02:00
|
|
|
vp9_recon_sby(xd, BLOCK_SIZE_MB16X16);
|
2010-05-18 17:58:33 +02:00
|
|
|
}
|
|
|
|
|
2013-02-20 19:16:24 +01:00
|
|
|
void vp9_encode_intra16x16mbuv(VP9_COMMON *const cm, MACROBLOCK *x) {
|
2012-10-13 18:27:54 +02:00
|
|
|
MACROBLOCKD *xd = &x->e_mbd;
|
|
|
|
TX_SIZE tx_size = xd->mode_info_context->mbmi.txfm_size;
|
|
|
|
|
2013-04-15 18:31:27 +02:00
|
|
|
vp9_build_intra_predictors_sbuv_s(xd, BLOCK_SIZE_MB16X16);
|
2013-04-23 17:26:10 +02:00
|
|
|
vp9_subtract_sbuv(x, BLOCK_SIZE_MB16X16);
|
2012-10-28 18:38:23 +01:00
|
|
|
|
2013-02-28 22:18:02 +01:00
|
|
|
switch (tx_size) {
|
|
|
|
case TX_4X4:
|
2013-04-11 19:57:16 +02:00
|
|
|
vp9_transform_sbuv_4x4(x, BLOCK_SIZE_MB16X16);
|
|
|
|
vp9_quantize_sbuv_4x4(x, BLOCK_SIZE_MB16X16);
|
2013-02-28 22:18:02 +01:00
|
|
|
if (x->optimize)
|
2013-04-30 18:54:51 +02:00
|
|
|
vp9_optimize_sbuv(cm, x, BLOCK_SIZE_MB16X16);
|
2013-04-11 19:57:16 +02:00
|
|
|
vp9_inverse_transform_sbuv_4x4(xd, BLOCK_SIZE_MB16X16);
|
2013-02-28 22:18:02 +01:00
|
|
|
break;
|
|
|
|
default: // 16x16 or 8x8
|
2013-04-11 19:57:16 +02:00
|
|
|
vp9_transform_sbuv_8x8(x, BLOCK_SIZE_MB16X16);
|
|
|
|
vp9_quantize_sbuv_8x8(x, BLOCK_SIZE_MB16X16);
|
2013-02-28 22:18:02 +01:00
|
|
|
if (x->optimize)
|
2013-04-30 18:54:51 +02:00
|
|
|
vp9_optimize_sbuv(cm, x, BLOCK_SIZE_MB16X16);
|
2013-04-11 19:57:16 +02:00
|
|
|
vp9_inverse_transform_sbuv_8x8(xd, BLOCK_SIZE_MB16X16);
|
2013-02-28 22:18:02 +01:00
|
|
|
break;
|
|
|
|
}
|
2012-07-14 00:21:29 +02:00
|
|
|
|
2013-04-20 23:17:57 +02:00
|
|
|
vp9_recon_sbuv(xd, BLOCK_SIZE_MB16X16);
|
2010-05-18 17:58:33 +02:00
|
|
|
}
|
2011-08-05 01:30:27 +02:00
|
|
|
|
2013-05-01 01:13:20 +02:00
|
|
|
#if !CONFIG_SB8X8
|
2012-11-25 04:33:58 +01:00
|
|
|
void vp9_encode_intra8x8(MACROBLOCK *x, int ib) {
|
2012-10-11 02:18:22 +02:00
|
|
|
MACROBLOCKD *xd = &x->e_mbd;
|
2013-04-24 01:22:47 +02:00
|
|
|
uint8_t* const src =
|
|
|
|
raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, ib,
|
|
|
|
x->plane[0].src.buf, x->plane[0].src.stride);
|
2013-04-23 17:26:10 +02:00
|
|
|
int16_t* const src_diff =
|
|
|
|
raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, ib,
|
|
|
|
x->plane[0].src_diff);
|
2013-04-25 00:01:35 +02:00
|
|
|
int16_t* const diff =
|
|
|
|
raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, ib,
|
|
|
|
xd->plane[0].diff);
|
2013-04-25 20:15:38 +02:00
|
|
|
uint8_t* const dst =
|
|
|
|
raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, ib,
|
|
|
|
xd->plane[0].dst.buf, xd->plane[0].dst.stride);
|
2012-07-14 00:21:29 +02:00
|
|
|
const int iblock[4] = {0, 1, 4, 5};
|
|
|
|
int i;
|
2012-10-16 01:41:41 +02:00
|
|
|
TX_TYPE tx_type;
|
2011-08-05 01:30:27 +02:00
|
|
|
|
2013-04-25 20:15:38 +02:00
|
|
|
vp9_intra8x8_predict(xd, ib, xd->mode_info_context->bmi[ib].as_mode.first,
|
|
|
|
dst, xd->plane[0].dst.stride);
|
2012-11-16 00:14:38 +01:00
|
|
|
// generate residual blocks
|
2013-04-23 17:26:10 +02:00
|
|
|
vp9_subtract_block(8, 8, src_diff, 16,
|
2013-04-24 01:22:47 +02:00
|
|
|
src, x->plane[0].src.stride,
|
2013-04-25 20:15:38 +02:00
|
|
|
dst, xd->plane[0].dst.stride);
|
2011-08-05 01:30:27 +02:00
|
|
|
|
2012-10-13 18:27:54 +02:00
|
|
|
if (xd->mode_info_context->mbmi.txfm_size == TX_8X8) {
|
2012-08-01 19:18:25 +02:00
|
|
|
int idx = (ib & 0x02) ? (ib + 2) : ib;
|
2013-04-23 23:38:52 +02:00
|
|
|
int16_t* const dqcoeff = BLOCK_OFFSET(xd->plane[0].dqcoeff, idx, 16);
|
|
|
|
int16_t* const coeff = BLOCK_OFFSET(x->plane[0].coeff, idx, 16);
|
2012-08-01 19:18:25 +02:00
|
|
|
|
2013-04-02 23:50:40 +02:00
|
|
|
assert(idx < 16);
|
2013-03-06 00:18:06 +01:00
|
|
|
tx_type = get_tx_type_8x8(xd, ib);
|
2012-10-16 01:41:41 +02:00
|
|
|
if (tx_type != DCT_DCT) {
|
2013-04-23 23:38:52 +02:00
|
|
|
vp9_short_fht8x8(src_diff, coeff, 16, tx_type);
|
2013-04-04 21:03:27 +02:00
|
|
|
x->quantize_b_8x8(x, idx, tx_type, 16);
|
2013-04-25 00:01:35 +02:00
|
|
|
vp9_short_iht8x8(dqcoeff, diff, 16, tx_type);
|
2012-10-16 01:41:41 +02:00
|
|
|
} else {
|
2013-04-23 23:38:52 +02:00
|
|
|
x->fwd_txm8x8(src_diff, coeff, 32);
|
2013-04-04 21:03:27 +02:00
|
|
|
x->quantize_b_8x8(x, idx, DCT_DCT, 16);
|
2013-04-25 00:01:35 +02:00
|
|
|
vp9_short_idct8x8(dqcoeff, diff, 32);
|
2012-10-16 01:41:41 +02:00
|
|
|
}
|
2012-10-11 02:18:22 +02:00
|
|
|
} else {
|
2012-08-01 19:18:25 +02:00
|
|
|
for (i = 0; i < 4; i++) {
|
2013-04-02 23:50:40 +02:00
|
|
|
int idx = ib + iblock[i];
|
2013-04-23 23:38:52 +02:00
|
|
|
int16_t* const dqcoeff = BLOCK_OFFSET(xd->plane[0].dqcoeff, idx, 16);
|
|
|
|
int16_t* const coeff = BLOCK_OFFSET(x->plane[0].coeff, idx, 16);
|
2013-04-23 17:26:10 +02:00
|
|
|
int16_t* const src_diff =
|
|
|
|
raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, idx,
|
|
|
|
x->plane[0].src_diff);
|
2013-04-25 00:01:35 +02:00
|
|
|
int16_t* const diff =
|
|
|
|
raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, idx,
|
|
|
|
xd->plane[0].diff);
|
2013-04-02 23:50:40 +02:00
|
|
|
|
|
|
|
assert(idx < 16);
|
2013-03-06 00:18:06 +01:00
|
|
|
tx_type = get_tx_type_4x4(xd, ib + iblock[i]);
|
2012-11-16 00:14:38 +01:00
|
|
|
if (tx_type != DCT_DCT) {
|
2013-04-23 23:38:52 +02:00
|
|
|
vp9_short_fht4x4(src_diff, coeff, 16, tx_type);
|
2013-04-25 23:44:44 +02:00
|
|
|
x->quantize_b_4x4(x, ib + iblock[i], tx_type, 16);
|
2013-04-25 00:01:35 +02:00
|
|
|
vp9_short_iht4x4(dqcoeff, diff, 16, tx_type);
|
2013-03-06 00:18:06 +01:00
|
|
|
} else if (!(i & 1) &&
|
|
|
|
get_tx_type_4x4(xd, ib + iblock[i] + 1) == DCT_DCT) {
|
2013-04-23 23:38:52 +02:00
|
|
|
x->fwd_txm8x4(src_diff, coeff, 32);
|
2013-04-04 21:03:27 +02:00
|
|
|
x->quantize_b_4x4_pair(x, ib + iblock[i], ib + iblock[i] + 1, 16);
|
|
|
|
vp9_inverse_transform_b_4x4(xd, xd->plane[0].eobs[ib + iblock[i]],
|
2013-04-25 00:01:35 +02:00
|
|
|
dqcoeff, diff, 32);
|
2013-04-04 21:03:27 +02:00
|
|
|
vp9_inverse_transform_b_4x4(xd, xd->plane[0].eobs[ib + iblock[i] + 1],
|
2013-04-25 00:01:35 +02:00
|
|
|
dqcoeff + 16, diff + 4, 32);
|
2013-02-06 23:13:05 +01:00
|
|
|
i++;
|
2012-11-16 00:14:38 +01:00
|
|
|
} else {
|
2013-04-23 23:38:52 +02:00
|
|
|
x->fwd_txm4x4(src_diff, coeff, 32);
|
2013-04-25 23:44:44 +02:00
|
|
|
x->quantize_b_4x4(x, ib + iblock[i], tx_type, 16);
|
2013-04-04 21:03:27 +02:00
|
|
|
vp9_inverse_transform_b_4x4(xd, xd->plane[0].eobs[ib + iblock[i]],
|
2013-04-25 00:01:35 +02:00
|
|
|
dqcoeff, diff, 32);
|
2012-11-16 00:14:38 +01:00
|
|
|
}
|
2012-08-01 19:18:25 +02:00
|
|
|
}
|
|
|
|
}
|
2012-10-11 02:18:22 +02:00
|
|
|
|
|
|
|
// reconstruct submacroblock
|
|
|
|
for (i = 0; i < 4; i++) {
|
2013-04-25 00:01:35 +02:00
|
|
|
int16_t* const diff =
|
|
|
|
raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, 0, ib + iblock[i],
|
|
|
|
xd->plane[0].diff);
|
2013-04-25 20:15:38 +02:00
|
|
|
uint8_t* const dst =
|
|
|
|
raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, 0, ib + iblock[i],
|
|
|
|
xd->plane[0].dst.buf,
|
|
|
|
xd->plane[0].dst.stride);
|
|
|
|
vp9_recon_b_c(dst, diff, dst, xd->plane[0].dst.stride);
|
2012-10-11 02:18:22 +02:00
|
|
|
}
|
2011-08-05 01:30:27 +02:00
|
|
|
}
|
|
|
|
|
2012-11-25 04:33:58 +01:00
|
|
|
void vp9_encode_intra8x8mby(MACROBLOCK *x) {
|
2013-02-28 22:18:02 +01:00
|
|
|
int i;
|
2012-07-14 00:21:29 +02:00
|
|
|
|
2013-02-28 22:18:02 +01:00
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
vp9_encode_intra8x8(x, vp9_i8x8_block[i]);
|
2011-08-05 01:30:27 +02:00
|
|
|
}
|
|
|
|
|
2013-02-28 22:18:02 +01:00
|
|
|
static void encode_intra_uv4x4(MACROBLOCK *x, int ib, int mode) {
|
2013-04-02 23:50:40 +02:00
|
|
|
MACROBLOCKD * const xd = &x->e_mbd;
|
|
|
|
int16_t * const dqcoeff = MB_SUBBLOCK_FIELD(xd, dqcoeff, ib);
|
2013-04-23 23:38:52 +02:00
|
|
|
int16_t* const coeff = MB_SUBBLOCK_FIELD(x, coeff, ib);
|
2013-04-04 21:03:27 +02:00
|
|
|
const int plane = ib < 20 ? 1 : 2;
|
|
|
|
const int block = ib < 20 ? ib - 16 : ib - 20;
|
2013-04-24 01:22:47 +02:00
|
|
|
uint8_t* const src =
|
|
|
|
raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, plane, block,
|
|
|
|
x->plane[plane].src.buf,
|
|
|
|
x->plane[plane].src.stride);
|
2013-04-23 17:26:10 +02:00
|
|
|
int16_t* const src_diff =
|
|
|
|
raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, plane, block,
|
|
|
|
x->plane[plane].src_diff);
|
2013-04-25 00:01:35 +02:00
|
|
|
int16_t* const diff =
|
|
|
|
raster_block_offset_int16(xd, BLOCK_SIZE_MB16X16, plane, block,
|
|
|
|
xd->plane[plane].diff);
|
2013-04-25 20:15:38 +02:00
|
|
|
uint8_t* const dst =
|
|
|
|
raster_block_offset_uint8(xd, BLOCK_SIZE_MB16X16, plane, block,
|
|
|
|
xd->plane[plane].dst.buf,
|
|
|
|
xd->plane[plane].dst.stride);
|
2011-08-05 01:30:27 +02:00
|
|
|
|
2013-04-02 23:50:40 +02:00
|
|
|
assert(ib >= 16 && ib < 24);
|
2013-04-25 20:15:38 +02:00
|
|
|
vp9_intra_uv4x4_predict(&x->e_mbd, ib, mode,
|
|
|
|
dst, xd->plane[plane].dst.stride);
|
2011-08-05 01:30:27 +02:00
|
|
|
|
2013-04-23 17:26:10 +02:00
|
|
|
assert(xd->plane[1].subsampling_x == 1);
|
|
|
|
vp9_subtract_block(4, 4, src_diff, 8,
|
2013-04-24 01:22:47 +02:00
|
|
|
src, x->plane[plane].src.stride,
|
2013-04-25 20:15:38 +02:00
|
|
|
dst, xd->plane[plane].dst.stride);
|
2011-08-05 01:30:27 +02:00
|
|
|
|
2013-04-23 23:38:52 +02:00
|
|
|
x->fwd_txm4x4(src_diff, coeff, 16);
|
2013-04-25 23:44:44 +02:00
|
|
|
x->quantize_b_4x4(x, ib, DCT_DCT, 16);
|
2013-04-04 21:03:27 +02:00
|
|
|
vp9_inverse_transform_b_4x4(&x->e_mbd, xd->plane[plane].eobs[block],
|
2013-04-25 00:01:35 +02:00
|
|
|
dqcoeff, diff, 16);
|
2011-08-05 01:30:27 +02:00
|
|
|
|
2013-04-25 20:15:38 +02:00
|
|
|
vp9_recon_uv_b_c(dst, diff, dst, xd->plane[plane].dst.stride);
|
2011-08-05 01:30:27 +02:00
|
|
|
}
|
|
|
|
|
2012-11-25 04:33:58 +01:00
|
|
|
void vp9_encode_intra8x8mbuv(MACROBLOCK *x) {
|
2013-02-28 22:18:02 +01:00
|
|
|
int i;
|
2012-10-13 18:27:54 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (i = 0; i < 4; i++) {
|
2013-04-26 16:19:43 +02:00
|
|
|
int mode = x->e_mbd.mode_info_context->bmi[vp9_i8x8_block[i]].as_mode.first;
|
2013-02-28 22:18:02 +01:00
|
|
|
|
|
|
|
encode_intra_uv4x4(x, i + 16, mode); // u
|
|
|
|
encode_intra_uv4x4(x, i + 20, mode); // v
|
2012-07-14 00:21:29 +02:00
|
|
|
}
|
2011-08-05 01:30:27 +02:00
|
|
|
}
|
2013-05-01 01:13:20 +02:00
|
|
|
#endif
|