Skip to content

Commit 1b270e7

Browse files
authored
Support 400 10 profile (#87)
* intermediate code Signed-off-by: kp5.choi@samsung.com <kp5.choi@samsung.com> * fixed code for 400-10 profile Signed-off-by: kp5.choi@samsung.com <kp5.choi@samsung.com> --------- Signed-off-by: kp5.choi@samsung.com <kp5.choi@samsung.com>
1 parent a430b13 commit 1b270e7

File tree

4 files changed

+27
-24
lines changed

4 files changed

+27
-24
lines changed

app/oapv_app_enc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static const args_opt_t enc_args_opts[] = {
113113
},
114114
{
115115
ARGS_NO_KEY, "profile", ARGS_VAL_TYPE_STRING, 0, NULL,
116-
"profile setting flag (422-10)"
116+
"profile string (422-10, 400-10)"
117117
},
118118
{
119119
ARGS_NO_KEY, "level", ARGS_VAL_TYPE_STRING, 0, NULL,

app/oapv_app_y4m.h

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,19 @@ static int y4m_parse_tags(y4m_params_t *y4m, char *tags)
6666

6767
char *p;
6868
char *q;
69-
char t_buff[20];
69+
char colorspace[20];
7070
int found_w = 0, found_h = 0, found_cf = 0;
7171
int fps_n, fps_d, pix_ratio_n, pix_ratio_d;
7272

7373
for(p = tags;; p = q) {
74-
7574
/*Skip any leading spaces.*/
76-
while(*p == ' ')
77-
p++;
75+
while(*p == ' ') p++;
7876

7977
/*If that's all we have, stop.*/
80-
if(p[0] == '\0')
81-
break;
78+
if(p[0] == '\0') break;
8279

8380
/*Find the end of this tag.*/
84-
for(q = p + 1; *q != '\0' && *q != ' '; q++) {
85-
}
81+
for(q = p + 1; *q != '\0' && *q != ' '; q++) { }
8682

8783
/*Process the tag.*/
8884
switch(p[0]) {
@@ -117,8 +113,8 @@ static int y4m_parse_tags(y4m_params_t *y4m, char *tags)
117113
case 'C': {
118114
if(q - p > 16)
119115
return OAPV_ERR;
120-
memcpy(t_buff, p + 1, q - p - 1);
121-
t_buff[q - p - 1] = '\0';
116+
memcpy(colorspace, p + 1, q - p - 1);
117+
colorspace[q - p - 1] = '\0';
122118
found_cf = 1;
123119
break;
124120
}
@@ -130,41 +126,45 @@ static int y4m_parse_tags(y4m_params_t *y4m, char *tags)
130126
logerr("Mandatory arugments are not found in y4m header");
131127
return OAPV_ERR;
132128
}
133-
/* Setting default colorspace to yuv420 and input_bd to 8 if header info. is NA */
129+
134130
if(!found_cf) {
135131
y4m->color_format = OAPV_CF_YCBCR420;
136132
y4m->bit_depth = 8;
137133
}
138134

139-
if(strcmp(t_buff, "420jpeg") == 0 || strcmp(t_buff, "420") == 0 ||
140-
strcmp(t_buff, "420mpeg2") == 0 || strcmp(t_buff, "420paidv") == 0) {
135+
if(strcmp(colorspace, "420jpeg") == 0 || strcmp(colorspace, "420") == 0 ||
136+
strcmp(colorspace, "420mpeg2") == 0 || strcmp(colorspace, "420paidv") == 0) {
141137
y4m->color_format = OAPV_CF_YCBCR420;
142138
y4m->bit_depth = 8;
143139
}
144-
else if(strcmp(t_buff, "422") == 0) {
140+
else if(strcmp(colorspace, "422") == 0) {
145141
y4m->color_format = OAPV_CF_YCBCR422;
146142
y4m->bit_depth = 8;
147143
}
148-
else if(strcmp(t_buff, "444") == 0) {
144+
else if(strcmp(colorspace, "444") == 0) {
149145
y4m->color_format = OAPV_CF_YCBCR444;
150146
y4m->bit_depth = 8;
151147
}
152-
else if(strcmp(t_buff, "420p10") == 0) {
148+
else if(strcmp(colorspace, "420p10") == 0) {
153149
y4m->color_format = OAPV_CF_YCBCR420;
154150
y4m->bit_depth = 10;
155151
}
156-
else if(strcmp(t_buff, "422p10") == 0) {
152+
else if(strcmp(colorspace, "422p10") == 0) {
157153
y4m->color_format = OAPV_CF_YCBCR422;
158154
y4m->bit_depth = 10;
159155
}
160-
else if(strcmp(t_buff, "444p10") == 0) {
156+
else if(strcmp(colorspace, "444p10") == 0) {
161157
y4m->color_format = OAPV_CF_YCBCR444;
162158
y4m->bit_depth = 10;
163159
}
164-
else if(strcmp(t_buff, "mono") == 0) {
160+
else if(strcmp(colorspace, "mono") == 0) {
165161
y4m->color_format = OAPV_CF_YCBCR400;
166162
y4m->bit_depth = 8;
167163
}
164+
else if(strcmp(colorspace, "mono10") == 0) {
165+
y4m->color_format = OAPV_CF_YCBCR400;
166+
y4m->bit_depth = 10;
167+
}
168168
else {
169169
y4m->color_format = OAPV_CF_UNKNOWN;
170170
y4m->bit_depth = -1;
@@ -255,10 +255,12 @@ static int write_y4m_header(char *fname, oapv_imgb_t *imgb)
255255
else if(color_format == OAPV_CF_YCBCR400) {
256256
if(bit_depth == 8)
257257
strcpy(c_buf, "mono");
258+
else if(bit_depth == 10)
259+
strcpy(c_buf, "mono10");
258260
}
259261

260262
if(strlen(c_buf) == 0) {
261-
logerr("Color format is not suuported by y4m");
263+
logerr("Color format is not suuported by y4m\n");
262264
return -1;
263265
}
264266

inc/oapv.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ extern "C" {
197197
* profiles
198198
*****************************************************************************/
199199
#define OAPV_PROFILE_422_10 (33)
200+
#define OAPV_PROFILE_400_10 (99)
200201

201202
/*****************************************************************************
202203
* optimization level control
@@ -393,7 +394,8 @@ struct oapv_dict_str_int {
393394
};
394395

395396
static const oapv_dict_str_int_t oapv_param_opts_profile[] = {
396-
{"422-10", OAPV_PROFILE_422_10},
397+
{"422-10", OAPV_PROFILE_422_10},
398+
{"400-10", OAPV_PROFILE_400_10},
397399
{"", 0} // termination
398400
};
399401

@@ -532,7 +534,6 @@ struct oapve_param {
532534
int full_range_flag;
533535
};
534536

535-
#define OAPV_CDESC_THREADS_AUTO 0
536537
/*****************************************************************************
537538
* automatic assignment of number of threads in creation of encoder & decoder
538539
*****************************************************************************/

src/oapv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1318,7 +1318,7 @@ int oapve_encode(oapve_t eid, oapv_frms_t *ifrms, oapvm_t mid, oapv_bitb_t *bitb
13181318
ret = enc_read_param(ctx, ctx->param);
13191319
oapv_assert_rv(ret == OAPV_OK, ret);
13201320

1321-
oapv_assert_rv(ctx->param->profile_idc == OAPV_PROFILE_422_10, OAPV_ERR_UNSUPPORTED);
1321+
oapv_assert_rv(ctx->param->profile_idc == OAPV_PROFILE_422_10 || ctx->param->profile_idc == OAPV_PROFILE_400_10, OAPV_ERR_UNSUPPORTED);
13221322

13231323
// prepare for encoding a frame
13241324
ret = enc_frm_prepare(ctx, frm->imgb, (rfrms != NULL) ? rfrms->frm[i].imgb : NULL);

0 commit comments

Comments
 (0)