2014-04-28 12:20:49 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
* This file is part of Kvazaar HEVC encoder.
|
|
|
|
*
|
2015-02-23 11:18:48 +00:00
|
|
|
* Copyright (C) 2013-2015 Tampere University of Technology and others (see
|
2014-04-28 12:20:49 +00:00
|
|
|
* COPYING file).
|
|
|
|
*
|
2015-02-23 11:18:48 +00:00
|
|
|
* Kvazaar is free software: you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU Lesser General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2.1 of the License, or (at your
|
|
|
|
* option) any later version.
|
2014-04-28 12:20:49 +00:00
|
|
|
*
|
2015-02-23 11:18:48 +00:00
|
|
|
* Kvazaar is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
|
|
|
|
* more details.
|
2014-04-28 12:20:49 +00:00
|
|
|
*
|
2015-02-23 11:18:48 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with Kvazaar. If not, see <http://www.gnu.org/licenses/>.
|
2014-04-28 12:20:49 +00:00
|
|
|
****************************************************************************/
|
|
|
|
|
2016-03-31 10:34:32 +00:00
|
|
|
#include "strategies/sse41/picture-sse41.h"
|
2019-01-15 17:37:53 +00:00
|
|
|
#include "strategies/sse41/reg_sad_pow2_widths-sse41.h"
|
2014-07-11 14:16:32 +00:00
|
|
|
|
|
|
|
#if COMPILE_INTEL_SSE41
|
2016-04-01 14:14:23 +00:00
|
|
|
#include <immintrin.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "kvazaar.h"
|
|
|
|
#include "strategyselector.h"
|
2014-07-11 14:16:32 +00:00
|
|
|
|
2019-01-15 17:32:25 +00:00
|
|
|
uint32_t kvz_reg_sad_sse41(const kvz_pixel * const data1, const kvz_pixel * const data2,
|
|
|
|
const int32_t width, const int32_t height, const uint32_t stride1,
|
|
|
|
const uint32_t stride2)
|
|
|
|
{
|
2019-01-15 19:09:18 +00:00
|
|
|
if (width == 0)
|
|
|
|
return 0;
|
|
|
|
if (width == 4)
|
|
|
|
return reg_sad_w4(data1, data2, height, stride1, stride2);
|
2019-01-15 17:32:25 +00:00
|
|
|
if (width == 8)
|
2019-01-15 19:09:18 +00:00
|
|
|
return reg_sad_w8(data1, data2, height, stride1, stride2);
|
|
|
|
if (width == 12)
|
|
|
|
return reg_sad_w12(data1, data2, height, stride1, stride2);
|
2019-01-15 17:32:25 +00:00
|
|
|
if (width == 16)
|
2019-01-15 19:09:18 +00:00
|
|
|
return reg_sad_w16(data1, data2, height, stride1, stride2);
|
2019-01-15 20:08:50 +00:00
|
|
|
if (width == 24)
|
|
|
|
return reg_sad_w24(data1, data2, height, stride1, stride2);
|
2019-01-15 17:32:25 +00:00
|
|
|
else
|
2019-01-15 19:09:18 +00:00
|
|
|
return reg_sad_arbitrary(data1, data2, width, height, stride1, stride2);
|
2019-01-15 17:32:25 +00:00
|
|
|
}
|
|
|
|
|
2019-01-22 17:55:40 +00:00
|
|
|
static optimized_sad_func_ptr_t get_optimized_sad_sse41(int32_t width)
|
|
|
|
{
|
|
|
|
if (width == 0)
|
|
|
|
return reg_sad_w0;
|
|
|
|
if (width == 4)
|
|
|
|
return reg_sad_w4;
|
|
|
|
if (width == 8)
|
|
|
|
return reg_sad_w8;
|
|
|
|
if (width == 12)
|
|
|
|
return reg_sad_w12;
|
|
|
|
if (width == 16)
|
|
|
|
return reg_sad_w16;
|
|
|
|
if (width == 24)
|
|
|
|
return reg_sad_w24;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-07-11 14:16:32 +00:00
|
|
|
#endif //COMPILE_INTEL_SSE41
|
|
|
|
|
|
|
|
|
2015-08-26 08:50:27 +00:00
|
|
|
int kvz_strategy_register_picture_sse41(void* opaque, uint8_t bitdepth) {
|
2014-07-11 14:16:32 +00:00
|
|
|
bool success = true;
|
|
|
|
#if COMPILE_INTEL_SSE41
|
2015-08-12 09:28:55 +00:00
|
|
|
if (bitdepth == 8){
|
2016-09-01 15:33:51 +00:00
|
|
|
success &= kvz_strategyselector_register(opaque, "reg_sad", "sse41", 20, &kvz_reg_sad_sse41);
|
2019-01-22 17:55:40 +00:00
|
|
|
success &= kvz_strategyselector_register(opaque, "get_optimized_sad", "sse41", 20, &get_optimized_sad_sse41);
|
2015-08-12 09:28:55 +00:00
|
|
|
}
|
2014-07-11 14:16:32 +00:00
|
|
|
#endif
|
|
|
|
return success;
|
2014-04-29 08:14:42 +00:00
|
|
|
}
|