Commit 06b47089 authored by Luc Trudeau's avatar Luc Trudeau Committed by Nathan Egge
Browse files

[CFL] 4:4:0 Support

Change-Id: Ic5cf4c8393a00810700e42a162fbb36a62d9b56f
parent 2b9ec2ea
...@@ -14,12 +14,11 @@ ...@@ -14,12 +14,11 @@
#include "av1/common/onyxc_int.h" #include "av1/common/onyxc_int.h"
void cfl_init(CFL_CTX *cfl, AV1_COMMON *cm) { void cfl_init(CFL_CTX *cfl, AV1_COMMON *cm) {
if (!((cm->subsampling_x == 0 && cm->subsampling_y == 0) || if ((cm->subsampling_x != 0 && cm->subsampling_x != 1) ||
(cm->subsampling_x == 1 && cm->subsampling_y == 1) || (cm->subsampling_y != 0 && cm->subsampling_y != 1)) {
(cm->subsampling_x == 1 && cm->subsampling_y == 0))) { aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
aom_internal_error( "Only 4:4:4, 4:4:0, 4:2:2 and 4:2:0 are currently "
&cm->error, AOM_CODEC_UNSUP_BITSTREAM, "supported by CfL, %d %d "
"Only 4:4:4, 4:2:2 and 4:2:0 are currently supported by CfL, %d %d "
"subsampling is not supported.\n", "subsampling is not supported.\n",
cm->subsampling_x, cm->subsampling_y); cm->subsampling_x, cm->subsampling_y);
} }
...@@ -341,6 +340,18 @@ static void cfl_luma_subsampling_422_lbd(const uint8_t *input, int input_stride, ...@@ -341,6 +340,18 @@ static void cfl_luma_subsampling_422_lbd(const uint8_t *input, int input_stride,
} }
} }
static void cfl_luma_subsampling_440_lbd(const uint8_t *input, int input_stride,
int16_t *output_q3, int width,
int height) {
for (int j = 0; j < height; j++) {
for (int i = 0; i < width; i++) {
output_q3[i] = (input[i] + input[i + input_stride]) << 2;
}
input += input_stride << 1;
output_q3 += MAX_SB_SIZE;
}
}
static void cfl_luma_subsampling_444_lbd(const uint8_t *input, int input_stride, static void cfl_luma_subsampling_444_lbd(const uint8_t *input, int input_stride,
int16_t *output_q3, int width, int16_t *output_q3, int width,
int height) { int height) {
...@@ -382,6 +393,19 @@ static void cfl_luma_subsampling_422_hbd(const uint16_t *input, ...@@ -382,6 +393,19 @@ static void cfl_luma_subsampling_422_hbd(const uint16_t *input,
} }
} }
static void cfl_luma_subsampling_440_hbd(const uint16_t *input,
int input_stride, int16_t *output_q3,
int width, int height) {
for (int j = 0; j < height; j++) {
for (int i = 0; i < width; i++) {
int top = i << 1;
output_q3[i] = (input[top] + input[top + input_stride]) << 2;
}
input += input_stride << 1;
output_q3 += MAX_SB_SIZE;
}
}
static void cfl_luma_subsampling_444_hbd(const uint16_t *input, static void cfl_luma_subsampling_444_hbd(const uint16_t *input,
int input_stride, int16_t *output_q3, int input_stride, int16_t *output_q3,
int width, int height) { int width, int height) {
...@@ -425,6 +449,21 @@ static void cfl_luma_subsampling_422(const uint8_t *input, int input_stride, ...@@ -425,6 +449,21 @@ static void cfl_luma_subsampling_422(const uint8_t *input, int input_stride,
cfl_luma_subsampling_422_lbd(input, input_stride, output_q3, width, height); cfl_luma_subsampling_422_lbd(input, input_stride, output_q3, width, height);
} }
static void cfl_luma_subsampling_440(const uint8_t *input, int input_stride,
int16_t *output_q3, int width, int height,
int use_hbd) {
#if CONFIG_HIGHBITDEPTH
if (use_hbd) {
const uint16_t *input_16 = CONVERT_TO_SHORTPTR(input);
cfl_luma_subsampling_440_hbd(input_16, input_stride, output_q3, width,
height);
return;
}
#endif // CONFIG_HIGHBITDEPTH
(void)use_hbd;
cfl_luma_subsampling_440_lbd(input, input_stride, output_q3, width, height);
}
static void cfl_luma_subsampling_444(const uint8_t *input, int input_stride, static void cfl_luma_subsampling_444(const uint8_t *input, int input_stride,
int16_t *output_q3, int width, int height, int16_t *output_q3, int width, int height,
int use_hbd) { int use_hbd) {
...@@ -482,10 +521,13 @@ static INLINE void cfl_store(CFL_CTX *cfl, const uint8_t *input, ...@@ -482,10 +521,13 @@ static INLINE void cfl_store(CFL_CTX *cfl, const uint8_t *input,
} else if (sub_y == 0 && sub_x == 1) { } else if (sub_y == 0 && sub_x == 1) {
cfl_luma_subsampling_422(input, input_stride, pred_buf_q3, store_width, cfl_luma_subsampling_422(input, input_stride, pred_buf_q3, store_width,
store_height, use_hbd); store_height, use_hbd);
} else if (sub_y == 1 && sub_x == 0) {
cfl_luma_subsampling_440(input, input_stride, pred_buf_q3, store_width,
store_height, use_hbd);
} else { } else {
fprintf(stderr, fprintf(stderr,
"Only 4:4:4, 4:2:2 and 4:2:0 are currently supported by CfL, %d %d " "Only 4:4:4, 4:4:0, 4:2:2 and 4:2:0 are currently supported by "
"subsampling is not supported.\n", "CfL, %d %d subsampling is not supported.\n",
sub_x, sub_y); sub_x, sub_y);
abort(); abort();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment