From: Dmitry Kovalev Date: Sat, 26 Oct 2013 00:55:07 +0000 (-0700) Subject: Adding fht{4x4, 8x8, 16x16} functions. X-Git-Tag: v1.3.0~136^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ae2f732e8c0983df290c344a2c28bd013f392ead;p=libvpx Adding fht{4x4, 8x8, 16x16} functions. Adding these functions to encapsulate tx_type check. Changing TX_TYPE to int to match the declaration in vo9_rtch.h. Change-Id: I6f3a2df6e35595ca73b6aaa9e3909ee7bc3fd16f --- diff --git a/vp9/encoder/vp9_dct.c b/vp9/encoder/vp9_dct.c index 0a0afedfd..065992a25 100644 --- a/vp9/encoder/vp9_dct.c +++ b/vp9/encoder/vp9_dct.c @@ -8,14 +8,17 @@ * be found in the AUTHORS file in the root of the source tree. */ - #include #include + #include "./vpx_config.h" -#include "vp9/common/vp9_systemdependent.h" +#include "./vp9_rtcd.h" #include "vp9/common/vp9_blockd.h" #include "vp9/common/vp9_idct.h" +#include "vp9/common/vp9_systemdependent.h" + +#include "vp9/encoder/vp9_dct.h" static void fdct4(const int16_t *input, int16_t *output) { int16_t step[4]; @@ -149,7 +152,7 @@ static const transform_2d FHT_4[] = { }; void vp9_short_fht4x4_c(const int16_t *input, int16_t *output, - int stride, TX_TYPE tx_type) { + int stride, int tx_type) { int16_t out[4 * 4]; int16_t *outptr = &out[0]; int i, j; @@ -557,7 +560,7 @@ static const transform_2d FHT_8[] = { }; void vp9_short_fht8x8_c(const int16_t *input, int16_t *output, - int stride, TX_TYPE tx_type) { + int stride, int tx_type) { int16_t out[64]; int16_t *outptr = &out[0]; int i, j; @@ -950,7 +953,7 @@ static const transform_2d FHT_16[] = { }; void vp9_short_fht16x16_c(const int16_t *input, int16_t *output, - int stride, TX_TYPE tx_type) { + int stride, int tx_type) { int16_t out[256]; int16_t *outptr = &out[0]; int i, j; @@ -1366,3 +1369,27 @@ void vp9_fdct32x32_rd_c(const int16_t *input, int16_t *out, int stride) { out[j + i * 32] = temp_out[j]; } } + +void vp9_fht4x4(TX_TYPE tx_type, const int16_t *input, int16_t *output, + int stride) { + if (tx_type == DCT_DCT) + vp9_fdct4x4(input, output, stride); + else + vp9_short_fht4x4(input, output, stride, tx_type); +} + +void vp9_fht8x8(TX_TYPE tx_type, const int16_t *input, int16_t *output, + int stride) { + if (tx_type == DCT_DCT) + vp9_fdct8x8(input, output, stride); + else + vp9_short_fht8x8(input, output, stride, tx_type); +} + +void vp9_fht16x16(TX_TYPE tx_type, const int16_t *input, int16_t *output, + int stride) { + if (tx_type == DCT_DCT) + vp9_fdct16x16(input, output, stride); + else + vp9_short_fht16x16(input, output, stride, tx_type); +} diff --git a/vp9/encoder/vp9_dct.h b/vp9/encoder/vp9_dct.h new file mode 100644 index 000000000..aaf976d93 --- /dev/null +++ b/vp9/encoder/vp9_dct.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2013 The WebM project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + + +#ifndef VP9_ENCODER_VP9_DCT_H_ +#define VP9_ENCODER_VP9_DCT_H_ + +void vp9_fht4x4(TX_TYPE tx_type, const int16_t *input, int16_t *output, + int stride); + +void vp9_fht8x8(TX_TYPE tx_type, const int16_t *input, int16_t *output, + int stride); + +void vp9_fht16x16(TX_TYPE tx_type, const int16_t *input, int16_t *output, + int stride); + +#endif // VP9_ENCODER_VP9_DCT_H_ diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c index f335df566..91546e8cf 100644 --- a/vp9/encoder/vp9_encodemb.c +++ b/vp9/encoder/vp9_encodemb.c @@ -19,6 +19,7 @@ #include "vp9/common/vp9_reconintra.h" #include "vp9/common/vp9_systemdependent.h" +#include "vp9/encoder/vp9_dct.h" #include "vp9/encoder/vp9_encodemb.h" #include "vp9/encoder/vp9_quantize.h" #include "vp9/encoder/vp9_rdopt.h" @@ -577,10 +578,7 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, dst, pd->dst.stride, dst, pd->dst.stride); vp9_subtract_block(16, 16, src_diff, bw * 4, src, p->src.stride, dst, pd->dst.stride); - if (tx_type != DCT_DCT) - vp9_short_fht16x16(src_diff, coeff, bw * 4, tx_type); - else - vp9_fdct16x16(src_diff, coeff, bw * 4); + vp9_fht16x16(tx_type, src_diff, coeff, bw * 4); vp9_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round, p->quant, p->quant_shift, qcoeff, dqcoeff, pd->dequant, p->zbin_extra, eob, scan, iscan); @@ -602,10 +600,7 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, dst, pd->dst.stride, dst, pd->dst.stride); vp9_subtract_block(8, 8, src_diff, bw * 4, src, p->src.stride, dst, pd->dst.stride); - if (tx_type != DCT_DCT) - vp9_short_fht8x8(src_diff, coeff, bw * 4, tx_type); - else - vp9_fdct8x8(src_diff, coeff, bw * 4); + vp9_fht8x8(tx_type, src_diff, coeff, bw * 4); vp9_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, p->quant, p->quant_shift, qcoeff, dqcoeff, pd->dequant, p->zbin_extra, eob, scan, iscan); diff --git a/vp9/vp9cx.mk b/vp9/vp9cx.mk index b454eee02..0993c6ce6 100644 --- a/vp9/vp9cx.mk +++ b/vp9/vp9cx.mk @@ -20,6 +20,7 @@ VP9_CX_SRCS-yes += vp9_cx_iface.c VP9_CX_SRCS-yes += encoder/vp9_bitstream.c VP9_CX_SRCS-yes += encoder/vp9_boolhuff.c VP9_CX_SRCS-yes += encoder/vp9_dct.c +VP9_CX_SRCS-yes += encoder/vp9_dct.h VP9_CX_SRCS-yes += encoder/vp9_encodeframe.c VP9_CX_SRCS-yes += encoder/vp9_encodeframe.h VP9_CX_SRCS-yes += encoder/vp9_encodeintra.c