2013-02-27 01:27:41 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2012 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.
|
|
|
|
*/
|
|
|
|
|
2016-05-05 00:07:27 +02:00
|
|
|
#include "./vp9_rtcd.h"
|
2015-07-31 03:53:18 +02:00
|
|
|
#include "vpx_dsp/x86/inv_txfm_sse2.h"
|
2015-07-24 01:35:44 +02:00
|
|
|
#include "vpx_dsp/x86/txfm_common_sse2.h"
|
|
|
|
#include "vpx_ports/mem.h"
|
2013-02-27 01:27:41 +01:00
|
|
|
|
2015-09-28 17:50:39 +02:00
|
|
|
void vp9_iht4x4_16_add_sse2(const tran_low_t *input, uint8_t *dest, int stride,
|
2013-10-12 03:27:12 +02:00
|
|
|
int tx_type) {
|
2013-11-19 02:51:20 +01:00
|
|
|
__m128i in[2];
|
2013-07-10 21:11:09 +02:00
|
|
|
const __m128i eight = _mm_set1_epi16(8);
|
|
|
|
|
2015-09-28 17:50:39 +02:00
|
|
|
in[0] = load_input_data(input);
|
|
|
|
in[1] = load_input_data(input + 8);
|
2013-07-10 21:11:09 +02:00
|
|
|
|
|
|
|
switch (tx_type) {
|
|
|
|
case 0: // DCT_DCT
|
2014-01-28 01:15:36 +01:00
|
|
|
idct4_sse2(in);
|
|
|
|
idct4_sse2(in);
|
2013-07-10 21:11:09 +02:00
|
|
|
break;
|
|
|
|
case 1: // ADST_DCT
|
2014-01-28 01:15:36 +01:00
|
|
|
idct4_sse2(in);
|
|
|
|
iadst4_sse2(in);
|
2013-07-10 21:11:09 +02:00
|
|
|
break;
|
|
|
|
case 2: // DCT_ADST
|
2014-01-28 01:15:36 +01:00
|
|
|
iadst4_sse2(in);
|
|
|
|
idct4_sse2(in);
|
2013-07-10 21:11:09 +02:00
|
|
|
break;
|
|
|
|
case 3: // ADST_ADST
|
2014-01-28 01:15:36 +01:00
|
|
|
iadst4_sse2(in);
|
|
|
|
iadst4_sse2(in);
|
2013-07-10 21:11:09 +02:00
|
|
|
break;
|
2016-07-27 01:52:55 +02:00
|
|
|
default: assert(0); break;
|
2013-07-10 21:11:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Final round and shift
|
|
|
|
in[0] = _mm_add_epi16(in[0], eight);
|
|
|
|
in[1] = _mm_add_epi16(in[1], eight);
|
|
|
|
|
|
|
|
in[0] = _mm_srai_epi16(in[0], 4);
|
|
|
|
in[1] = _mm_srai_epi16(in[1], 4);
|
|
|
|
|
2017-05-09 00:41:24 +02:00
|
|
|
recon_and_store4x4_sse2(in, dest, stride);
|
2013-07-10 21:11:09 +02:00
|
|
|
}
|
|
|
|
|
2015-09-28 17:50:39 +02:00
|
|
|
void vp9_iht8x8_64_add_sse2(const tran_low_t *input, uint8_t *dest, int stride,
|
2013-10-12 03:27:12 +02:00
|
|
|
int tx_type) {
|
2013-07-13 05:54:14 +02:00
|
|
|
__m128i in[8];
|
|
|
|
const __m128i zero = _mm_setzero_si128();
|
2015-05-02 00:52:23 +02:00
|
|
|
const __m128i final_rounding = _mm_set1_epi16(1 << 4);
|
2013-07-13 05:54:14 +02:00
|
|
|
|
|
|
|
// load input data
|
2015-09-28 17:50:39 +02:00
|
|
|
in[0] = load_input_data(input);
|
|
|
|
in[1] = load_input_data(input + 8 * 1);
|
|
|
|
in[2] = load_input_data(input + 8 * 2);
|
|
|
|
in[3] = load_input_data(input + 8 * 3);
|
|
|
|
in[4] = load_input_data(input + 8 * 4);
|
|
|
|
in[5] = load_input_data(input + 8 * 5);
|
|
|
|
in[6] = load_input_data(input + 8 * 6);
|
|
|
|
in[7] = load_input_data(input + 8 * 7);
|
2013-07-13 05:54:14 +02:00
|
|
|
|
|
|
|
switch (tx_type) {
|
|
|
|
case 0: // DCT_DCT
|
2014-01-28 01:15:36 +01:00
|
|
|
idct8_sse2(in);
|
|
|
|
idct8_sse2(in);
|
2013-07-13 05:54:14 +02:00
|
|
|
break;
|
|
|
|
case 1: // ADST_DCT
|
2014-01-28 01:15:36 +01:00
|
|
|
idct8_sse2(in);
|
|
|
|
iadst8_sse2(in);
|
2013-07-13 05:54:14 +02:00
|
|
|
break;
|
|
|
|
case 2: // DCT_ADST
|
2014-01-28 01:15:36 +01:00
|
|
|
iadst8_sse2(in);
|
|
|
|
idct8_sse2(in);
|
2013-07-13 05:54:14 +02:00
|
|
|
break;
|
|
|
|
case 3: // ADST_ADST
|
2014-01-28 01:15:36 +01:00
|
|
|
iadst8_sse2(in);
|
|
|
|
iadst8_sse2(in);
|
2013-07-13 05:54:14 +02:00
|
|
|
break;
|
2016-07-27 01:52:55 +02:00
|
|
|
default: assert(0); break;
|
2013-07-13 05:54:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Final rounding and shift
|
|
|
|
in[0] = _mm_adds_epi16(in[0], final_rounding);
|
|
|
|
in[1] = _mm_adds_epi16(in[1], final_rounding);
|
|
|
|
in[2] = _mm_adds_epi16(in[2], final_rounding);
|
|
|
|
in[3] = _mm_adds_epi16(in[3], final_rounding);
|
|
|
|
in[4] = _mm_adds_epi16(in[4], final_rounding);
|
|
|
|
in[5] = _mm_adds_epi16(in[5], final_rounding);
|
|
|
|
in[6] = _mm_adds_epi16(in[6], final_rounding);
|
|
|
|
in[7] = _mm_adds_epi16(in[7], final_rounding);
|
|
|
|
|
|
|
|
in[0] = _mm_srai_epi16(in[0], 5);
|
|
|
|
in[1] = _mm_srai_epi16(in[1], 5);
|
|
|
|
in[2] = _mm_srai_epi16(in[2], 5);
|
|
|
|
in[3] = _mm_srai_epi16(in[3], 5);
|
|
|
|
in[4] = _mm_srai_epi16(in[4], 5);
|
|
|
|
in[5] = _mm_srai_epi16(in[5], 5);
|
|
|
|
in[6] = _mm_srai_epi16(in[6], 5);
|
|
|
|
in[7] = _mm_srai_epi16(in[7], 5);
|
|
|
|
|
2015-04-25 07:33:17 +02:00
|
|
|
RECON_AND_STORE(dest + 0 * stride, in[0]);
|
|
|
|
RECON_AND_STORE(dest + 1 * stride, in[1]);
|
|
|
|
RECON_AND_STORE(dest + 2 * stride, in[2]);
|
|
|
|
RECON_AND_STORE(dest + 3 * stride, in[3]);
|
|
|
|
RECON_AND_STORE(dest + 4 * stride, in[4]);
|
|
|
|
RECON_AND_STORE(dest + 5 * stride, in[5]);
|
|
|
|
RECON_AND_STORE(dest + 6 * stride, in[6]);
|
|
|
|
RECON_AND_STORE(dest + 7 * stride, in[7]);
|
2013-07-13 05:54:14 +02:00
|
|
|
}
|
|
|
|
|
2015-09-28 17:50:39 +02:00
|
|
|
void vp9_iht16x16_256_add_sse2(const tran_low_t *input, uint8_t *dest,
|
|
|
|
int stride, int tx_type) {
|
2013-07-15 20:05:31 +02:00
|
|
|
__m128i in0[16], in1[16];
|
|
|
|
|
|
|
|
load_buffer_8x16(input, in0);
|
|
|
|
input += 8;
|
|
|
|
load_buffer_8x16(input, in1);
|
|
|
|
|
|
|
|
switch (tx_type) {
|
|
|
|
case 0: // DCT_DCT
|
2014-01-28 01:15:36 +01:00
|
|
|
idct16_sse2(in0, in1);
|
|
|
|
idct16_sse2(in0, in1);
|
2013-07-15 20:05:31 +02:00
|
|
|
break;
|
|
|
|
case 1: // ADST_DCT
|
2014-01-28 01:15:36 +01:00
|
|
|
idct16_sse2(in0, in1);
|
|
|
|
iadst16_sse2(in0, in1);
|
2013-07-15 20:05:31 +02:00
|
|
|
break;
|
|
|
|
case 2: // DCT_ADST
|
2014-01-28 01:15:36 +01:00
|
|
|
iadst16_sse2(in0, in1);
|
|
|
|
idct16_sse2(in0, in1);
|
2013-07-15 20:05:31 +02:00
|
|
|
break;
|
|
|
|
case 3: // ADST_ADST
|
2014-01-28 01:15:36 +01:00
|
|
|
iadst16_sse2(in0, in1);
|
|
|
|
iadst16_sse2(in0, in1);
|
2013-07-15 20:05:31 +02:00
|
|
|
break;
|
2016-07-27 01:52:55 +02:00
|
|
|
default: assert(0); break;
|
2013-07-15 20:05:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
write_buffer_8x16(dest, in0, stride);
|
|
|
|
dest += 8;
|
|
|
|
write_buffer_8x16(dest, in1, stride);
|
|
|
|
}
|