mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-23 18:14:06 +00:00
Merge branch '10bit_coding'
This commit is contained in:
commit
0c1a830dc1
|
@ -504,7 +504,7 @@ unsigned uvg_image_calc_satd(const uvg_picture *pic,
|
||||||
pic_data,
|
pic_data,
|
||||||
pic->stride,
|
pic->stride,
|
||||||
ref_data,
|
ref_data,
|
||||||
ref->stride) >> (UVG_BIT_DEPTH - 8);
|
ref->stride);
|
||||||
} else {
|
} else {
|
||||||
// Extrapolate pixels from outside the frame.
|
// Extrapolate pixels from outside the frame.
|
||||||
|
|
||||||
|
@ -550,7 +550,7 @@ unsigned uvg_image_calc_satd(const uvg_picture *pic,
|
||||||
pic_data,
|
pic_data,
|
||||||
pic->stride,
|
pic->stride,
|
||||||
ext_origin,
|
ext_origin,
|
||||||
ext_s) >> (UVG_BIT_DEPTH - 8);
|
ext_s);
|
||||||
|
|
||||||
return satd;
|
return satd;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,6 @@ extern const int16_t uvg_g_dct_32_t[32][32];
|
||||||
|
|
||||||
#if COMPILE_INTEL_AVX2
|
#if COMPILE_INTEL_AVX2
|
||||||
#include "uvg266.h"
|
#include "uvg266.h"
|
||||||
#if UVG_BIT_DEPTH == 8
|
|
||||||
#include <immintrin.h>
|
#include <immintrin.h>
|
||||||
#include "strategies/avx2/dct_avx2_tables.h"
|
#include "strategies/avx2/dct_avx2_tables.h"
|
||||||
#define MAX_LOG2_TR_DYNAMIC_RANGE 15
|
#define MAX_LOG2_TR_DYNAMIC_RANGE 15
|
||||||
|
@ -8039,34 +8038,28 @@ static void mts_idct_avx2(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // UVG_BIT_DEPTH == 8
|
|
||||||
#endif //COMPILE_INTEL_AVX2
|
#endif //COMPILE_INTEL_AVX2
|
||||||
|
|
||||||
int uvg_strategy_register_dct_avx2(void* opaque, uint8_t bitdepth)
|
int uvg_strategy_register_dct_avx2(void* opaque, uint8_t bitdepth)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
#if COMPILE_INTEL_AVX2
|
#if COMPILE_INTEL_AVX2
|
||||||
#if UVG_BIT_DEPTH == 8
|
|
||||||
if (bitdepth == 8){
|
|
||||||
//success &= uvg_strategyselector_register(opaque, "fast_forward_dst_4x4", "avx2", 40, &matrix_dst_4x4_avx2);
|
|
||||||
|
|
||||||
success &= uvg_strategyselector_register(opaque, "dct_4x4", "avx2", 40, &matrix_dct_4x4_avx2);
|
success &= uvg_strategyselector_register(opaque, "dct_4x4", "avx2", 40, &matrix_dct_4x4_avx2);
|
||||||
success &= uvg_strategyselector_register(opaque, "dct_8x8", "avx2", 40, &matrix_dct_8x8_avx2);
|
success &= uvg_strategyselector_register(opaque, "dct_8x8", "avx2", 40, &matrix_dct_8x8_avx2);
|
||||||
success &= uvg_strategyselector_register(opaque, "dct_16x16", "avx2", 40, &matrix_dct_16x16_avx2);
|
success &= uvg_strategyselector_register(opaque, "dct_16x16", "avx2", 40, &matrix_dct_16x16_avx2);
|
||||||
success &= uvg_strategyselector_register(opaque, "dct_32x32", "avx2", 40, &matrix_dct_32x32_avx2);
|
success &= uvg_strategyselector_register(opaque, "dct_32x32", "avx2", 40, &matrix_dct_32x32_avx2);
|
||||||
|
|
||||||
// success &= uvg_strategyselector_register(opaque, "fast_inverse_dst_4x4", "avx2", 40, &matrix_idst_4x4_avx2);
|
|
||||||
|
|
||||||
success &= uvg_strategyselector_register(opaque, "idct_4x4", "avx2", 40, &matrix_idct_4x4_avx2);
|
success &= uvg_strategyselector_register(opaque, "idct_4x4", "avx2", 40, &matrix_idct_4x4_avx2);
|
||||||
success &= uvg_strategyselector_register(opaque, "idct_8x8", "avx2", 40, &matrix_idct_8x8_avx2);
|
success &= uvg_strategyselector_register(opaque, "idct_8x8", "avx2", 40, &matrix_idct_8x8_avx2);
|
||||||
success &= uvg_strategyselector_register(opaque, "idct_16x16", "avx2", 40, &matrix_idct_16x16_avx2);
|
success &= uvg_strategyselector_register(opaque, "idct_16x16", "avx2", 40, &matrix_idct_16x16_avx2);
|
||||||
success &= uvg_strategyselector_register(opaque, "idct_32x32", "avx2", 40, &matrix_idct_32x32_avx2);
|
success &= uvg_strategyselector_register(opaque, "idct_32x32", "avx2", 40, &matrix_idct_32x32_avx2);
|
||||||
|
|
||||||
|
success &= uvg_strategyselector_register(opaque, "mts_dct", "avx2", 40, &mts_dct_avx2);
|
||||||
|
success &= uvg_strategyselector_register(opaque, "mts_idct", "avx2", 40, &mts_idct_avx2);
|
||||||
|
|
||||||
success &= uvg_strategyselector_register(opaque, "mts_dct", "avx2", 40, &mts_dct_avx2);
|
|
||||||
success &= uvg_strategyselector_register(opaque, "mts_idct", "avx2", 40, &mts_idct_avx2);
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif // UVG_BIT_DEPTH == 8
|
|
||||||
#endif //COMPILE_INTEL_AVX2
|
#endif //COMPILE_INTEL_AVX2
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,10 +67,10 @@ static int sao_edge_ddistortion_generic(const uvg_pixel *orig_data,
|
||||||
uint32_t a_pos = (y + a_ofs.y) * block_width + x + a_ofs.x;
|
uint32_t a_pos = (y + a_ofs.y) * block_width + x + a_ofs.x;
|
||||||
uint32_t b_pos = (y + b_ofs.y) * block_width + x + b_ofs.x;
|
uint32_t b_pos = (y + b_ofs.y) * block_width + x + b_ofs.x;
|
||||||
|
|
||||||
uint8_t a = rec_data[a_pos];
|
uvg_pixel a = rec_data[a_pos];
|
||||||
uint8_t b = rec_data[b_pos];
|
uvg_pixel b = rec_data[b_pos];
|
||||||
uint8_t c = rec_data[c_pos];
|
uvg_pixel c = rec_data[c_pos];
|
||||||
uint8_t orig = orig_data[c_pos];
|
uvg_pixel orig = orig_data[c_pos];
|
||||||
|
|
||||||
int32_t eo_cat = sao_calc_eo_cat(a, b, c);
|
int32_t eo_cat = sao_calc_eo_cat(a, b, c);
|
||||||
int32_t offset = offsets[eo_cat];
|
int32_t offset = offsets[eo_cat];
|
||||||
|
|
54
src/yuv_io.c
54
src/yuv_io.c
|
@ -53,28 +53,48 @@ static void fill_after_frame(unsigned height, unsigned array_width,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int read_and_fill_frame_data(FILE *file,
|
static int read_and_fill_frame_data(FILE* file,
|
||||||
unsigned width, unsigned height, unsigned bytes_per_sample,
|
unsigned width,
|
||||||
unsigned array_width, uvg_pixel *data)
|
unsigned height,
|
||||||
|
unsigned bytes_per_sample,
|
||||||
|
unsigned array_width,
|
||||||
|
uvg_pixel* data)
|
||||||
{
|
{
|
||||||
uvg_pixel* p = data;
|
|
||||||
uvg_pixel* end = data + array_width * height;
|
|
||||||
uvg_pixel fill_char;
|
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
while (p < end) {
|
unsigned i;
|
||||||
// Read the beginning of the line from input.
|
// Handle separately the case where we use UVG_BIT_DEPTH 10+ but the input is 8-bit.
|
||||||
if (width != fread(p, bytes_per_sample, width, file))
|
if (bytes_per_sample != sizeof(uvg_pixel)) {
|
||||||
return 0;
|
uint8_t* p = (uint8_t*)data;
|
||||||
|
uint8_t* end = (uint8_t*)data + array_width * height;
|
||||||
|
uint8_t fill_char;
|
||||||
|
while (p < end) {
|
||||||
|
// Read the beginning of the line from input.
|
||||||
|
if (width != fread(p, bytes_per_sample, width, file)) return 0;
|
||||||
|
// Fill the rest with the last pixel value.
|
||||||
|
fill_char = p[width - 1];
|
||||||
|
|
||||||
// Fill the rest with the last pixel value.
|
for (i = width; i < array_width; ++i) {
|
||||||
fill_char = p[width - 1];
|
p[i] = fill_char;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = width; i < array_width; ++i) {
|
p += array_width;
|
||||||
p[i] = fill_char;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
uvg_pixel* p = data;
|
||||||
|
uvg_pixel* end = data + array_width * height;
|
||||||
|
uvg_pixel fill_char;
|
||||||
|
while (p < end) {
|
||||||
|
// Read the beginning of the line from input.
|
||||||
|
if (width != fread(p, bytes_per_sample, width, file)) return 0;
|
||||||
|
// Fill the rest with the last pixel value.
|
||||||
|
fill_char = p[width - 1];
|
||||||
|
|
||||||
p += array_width;
|
for (i = width; i < array_width; ++i) {
|
||||||
|
p[i] = fill_char;
|
||||||
|
}
|
||||||
|
|
||||||
|
p += array_width;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -313,7 +333,7 @@ int yuv_io_seek(FILE* file, unsigned frames,
|
||||||
|
|
||||||
// Seek failed. Skip data by reading.
|
// Seek failed. Skip data by reading.
|
||||||
error = 0;
|
error = 0;
|
||||||
unsigned char* tmp[4096];
|
unsigned char tmp[4096];
|
||||||
size_t bytes_left = skip_bytes;
|
size_t bytes_left = skip_bytes;
|
||||||
while (bytes_left > 0 && !error) {
|
while (bytes_left > 0 && !error) {
|
||||||
const size_t skip = MIN(4096, bytes_left);
|
const size_t skip = MIN(4096, bytes_left);
|
||||||
|
|
Loading…
Reference in a new issue