| 1 | /***************************************************************************** |
| 2 | * Copyright (C) 2013 x265 project |
| 3 | * |
| 4 | * Authors: Steve Borho <steve@borho.org> |
| 5 | * Min Chen <min.chen@multicorewareinc.com> |
| 6 | * Praveen Kumar Tiwari <praveen@multicorewareinc.com> |
| 7 | * Nabajit Deka <nabajit@multicorewareinc.com> |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. |
| 22 | * |
| 23 | * This program is also available under a commercial proprietary license. |
| 24 | * For more information, contact us at license @ x265.com. |
| 25 | *****************************************************************************/ |
| 26 | |
| 27 | #ifndef _MBDSTHARNESS_H_1 |
| 28 | #define _MBDSTHARNESS_H_1 1 |
| 29 | |
| 30 | #include "testharness.h" |
| 31 | #include "primitives.h" |
| 32 | |
| 33 | class MBDstHarness : public TestHarness |
| 34 | { |
| 35 | protected: |
| 36 | |
| 37 | enum { ITERS = 128 }; |
| 38 | enum { INCR = 16 }; |
| 39 | enum { MAX_TU_SIZE = 32 * 32 }; |
| 40 | enum { TEST_BUF_SIZE = MAX_TU_SIZE + ITERS * INCR }; |
| 41 | enum { TEST_CASES = 3 }; |
| 42 | |
| 43 | ALIGN_VAR_32(int16_t, mbuf1[TEST_BUF_SIZE]); |
| 44 | int16_t mbufdct[TEST_BUF_SIZE]; |
| 45 | int mbufidct[TEST_BUF_SIZE]; |
| 46 | |
| 47 | int16_t mshortbuf2[MAX_TU_SIZE]; |
| 48 | int16_t mshortbuf3[MAX_TU_SIZE]; |
| 49 | |
| 50 | int mintbuf1[MAX_TU_SIZE]; |
| 51 | int mintbuf2[MAX_TU_SIZE]; |
| 52 | int mintbuf3[MAX_TU_SIZE]; |
| 53 | int mintbuf4[MAX_TU_SIZE]; |
| 54 | |
| 55 | int16_t short_test_buff[TEST_CASES][TEST_BUF_SIZE]; |
| 56 | int int_test_buff[TEST_CASES][TEST_BUF_SIZE]; |
| 57 | int int_idct_test_buff[TEST_CASES][TEST_BUF_SIZE]; |
| 58 | |
| 59 | uint32_t mubuf1[MAX_TU_SIZE]; |
| 60 | uint32_t mubuf2[MAX_TU_SIZE]; |
| 61 | uint16_t mushortbuf1[MAX_TU_SIZE]; |
| 62 | |
| 63 | int int_denoise_test_buff1[TEST_CASES][TEST_BUF_SIZE]; |
| 64 | int int_denoise_test_buff2[TEST_CASES][TEST_BUF_SIZE]; |
| 65 | |
| 66 | bool check_dequant_primitive(dequant_scaling_t ref, dequant_scaling_t opt); |
| 67 | bool check_dequant_primitive(dequant_normal_t ref, dequant_normal_t opt); |
| 68 | bool check_quant_primitive(quant_t ref, quant_t opt); |
| 69 | bool check_nquant_primitive(nquant_t ref, nquant_t opt); |
| 70 | bool check_dct_primitive(dct_t ref, dct_t opt, intptr_t width); |
| 71 | bool check_idct_primitive(idct_t ref, idct_t opt, intptr_t width); |
| 72 | bool check_count_nonzero_primitive(count_nonzero_t ref, count_nonzero_t opt); |
| 73 | bool check_denoise_dct_primitive(denoiseDct_t ref, denoiseDct_t opt); |
| 74 | |
| 75 | public: |
| 76 | |
| 77 | MBDstHarness(); |
| 78 | |
| 79 | const char *getName() const { return "transforms"; } |
| 80 | |
| 81 | bool testCorrectness(const EncoderPrimitives& ref, const EncoderPrimitives& opt); |
| 82 | |
| 83 | void measureSpeed(const EncoderPrimitives& ref, const EncoderPrimitives& opt); |
| 84 | }; |
| 85 | |
| 86 | #endif // ifndef _MBDSTHARNESS_H_1 |