Skip to content

Commit 321b9e8

Browse files
authored
initial code to support 444-12 and 4444-12 (#127)
* initial code to support 444-12 and 4444-12 Signed-off-by: kp5.choi@samsung.com <kp5.choi@samsung.com> * fixed missing profile spec Signed-off-by: kp5.choi@samsung.com <kp5.choi@samsung.com> --------- Signed-off-by: kp5.choi@samsung.com <kp5.choi@samsung.com>
1 parent 114280b commit 321b9e8

File tree

5 files changed

+28
-3
lines changed

5 files changed

+28
-3
lines changed

app/oapv_app_dec.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,9 @@ static void print_stat_frm(oapvd_stat_t *stat, oapv_frms_t *frms, oapvm_t mid, a
319319
: finfo[i].cs == OAPV_CS_YCBCR422_10LE ? "4:2:2-10"
320320
: finfo[i].cs == OAPV_CS_YCBCR422_12LE ? "4:2:2-12"
321321
: finfo[i].cs == OAPV_CS_YCBCR444_10LE ? "4:4:4-10"
322+
: finfo[i].cs == OAPV_CS_YCBCR444_12LE ? "4:4:4-12"
322323
: finfo[i].cs == OAPV_CS_YCBCR4444_10LE ? "4:4:4:4-10"
324+
: finfo[i].cs == OAPV_CS_YCBCR4444_12LE ? "4:4:4:4-12"
323325
: "unknown-cs";
324326

325327
// clang-format on

app/oapv_app_enc.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ static const args_opt_t enc_args_opts[] = {
127127
"profile string\n"
128128
" - 422-10: YCbCr422 10bit (default)\n"
129129
" - 422-12; YCbCr422 12bit\n"
130+
" - 444-10: YCbCr444 10bit\n"
131+
" - 444-12; YCbCr444 12bit\n"
132+
" - 4444-10: YCbCr4444 10bit\n"
133+
" - 4444-12; YCbCr4444 12bit\n"
130134
" - 400-10: YCbCr400 (monochrome) 10bit\n"
131135
" Note: Color space and bit depth of input video will be converted\n"
132136
" automatically to support the given profile, if needs\n"
@@ -890,8 +894,10 @@ int main(int argc, const char **argv)
890894
int codec_depth = (param->profile_idc == OAPV_PROFILE_422_10 ||
891895
param->profile_idc == OAPV_PROFILE_400_10 ||
892896
param->profile_idc == OAPV_PROFILE_444_10 ||
893-
param->profile_idc == OAPV_PROFILE_4444_10) ? 10 :
894-
(param->profile_idc == OAPV_PROFILE_422_12) ? 12 : 0;
897+
param->profile_idc == OAPV_PROFILE_4444_10) ? 10 : (
898+
param->profile_idc == OAPV_PROFILE_422_12 ||
899+
param->profile_idc == OAPV_PROFILE_444_12 ||
900+
param->profile_idc == OAPV_PROFILE_4444_12) ? 12 : 0;
895901

896902
if (codec_depth == 0) {
897903
logerr("ERR: invalid profile\n");
@@ -964,6 +970,11 @@ int main(int argc, const char **argv)
964970
clk_end = oapv_clk_from(clk_beg);
965971
clk_tot += clk_end;
966972

973+
if(OAPV_FAILED(ret)) {
974+
logerr("ERR: failed to encode (return: %d)\n", ret);
975+
goto ERR;
976+
}
977+
967978
bitrate_tot += stat.frm_size[FRM_IDX];
968979

969980
print_stat_au(&stat, au_cnt, param, args_var->max_au, bitrate_tot, clk_end, clk_tot);
@@ -1053,7 +1064,7 @@ int main(int argc, const char **argv)
10531064
bitrate_tot /= au_cnt;
10541065
bitrate_tot /= 1000;
10551066

1056-
1067+
10571068
if (cfmt == OAPV_CF_YCBCR400) { // 1-channel
10581069
logv3(" -----------------: bitrate(kbps)\tPSNR-Y\n");
10591070
logv3(" Summary : %-4.4f\t%-5.4f\n",

app/oapv_app_y4m.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ static int y4m_parse_tags(y4m_params_t *y4m, char *tags)
161161
y4m->color_format = OAPV_CF_YCBCR444;
162162
y4m->bit_depth = 10;
163163
}
164+
else if(strcmp(colorspace, "444p12") == 0) {
165+
y4m->color_format = OAPV_CF_YCBCR444;
166+
y4m->bit_depth = 12;
167+
}
164168
else if(strcmp(colorspace, "mono") == 0) {
165169
y4m->color_format = OAPV_CF_YCBCR400;
166170
y4m->bit_depth = 8;
@@ -257,6 +261,8 @@ static int write_y4m_header(char *fname, oapv_imgb_t *imgb)
257261
strcpy(c_buf, "444");
258262
else if(bit_depth == 10)
259263
strcpy(c_buf, "444p10");
264+
else if(bit_depth == 12)
265+
strcpy(c_buf, "444p12");
260266
}
261267
else if(color_format == OAPV_CF_YCBCR400) {
262268
if(bit_depth == 8)

inc/oapv.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,9 @@ extern "C" {
236236
#define OAPV_PROFILE_422_10 (33)
237237
#define OAPV_PROFILE_422_12 (44)
238238
#define OAPV_PROFILE_444_10 (55)
239+
#define OAPV_PROFILE_444_12 (66)
239240
#define OAPV_PROFILE_4444_10 (77)
241+
#define OAPV_PROFILE_4444_12 (88)
240242
#define OAPV_PROFILE_400_10 (99)
241243

242244
/*****************************************************************************
@@ -445,7 +447,9 @@ static const oapv_dict_str_int_t oapv_param_opts_profile[] = {
445447
{"422-10", OAPV_PROFILE_422_10},
446448
{"422-12", OAPV_PROFILE_422_12},
447449
{"444-10", OAPV_PROFILE_444_10},
450+
{"444-12", OAPV_PROFILE_444_12},
448451
{"4444-10", OAPV_PROFILE_4444_10},
452+
{"4444-12", OAPV_PROFILE_4444_12},
449453
{"400-10", OAPV_PROFILE_400_10},
450454
{"", 0} // termination
451455
};

src/oapv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,9 @@ static int enc_profile_spec[][5] = {
963963
{OAPV_PROFILE_422_10, 2, 2, 10, 10},
964964
{OAPV_PROFILE_422_12, 2, 2, 10, 12},
965965
{OAPV_PROFILE_444_10, 2, 3, 10, 10},
966+
{OAPV_PROFILE_444_12, 2, 3, 10, 12},
966967
{OAPV_PROFILE_4444_10, 2, 4, 10, 10},
968+
{OAPV_PROFILE_4444_12, 2, 4, 10, 12},
967969
{OAPV_PROFILE_400_10, 0, 0, 10, 10},
968970
{0, 0, 0, 0, 0} // termination
969971
};

0 commit comments

Comments
 (0)