Conversation
* For --input-csp 2, -w should be a multiple of 2
app/oapv_app_enc.c
Outdated
| // ensure frame width multiple of 2 in case of 422 format | ||
| if ((param->csp == 2) && (param->w & 0x1)) { | ||
| logerr("width should be a multiple of 2 for '--input-csp 2'\n"); | ||
| return -1; | ||
| } |
There was a problem hiding this comment.
can we move this code to 'check_conf()' function?
There was a problem hiding this comment.
@kpchoi
I have moved the changes to the check_conf() function.
* invalid configuration check of --input-csp 2 and -w non-multiple of 2 moved to the check_conf() function
* updated imhex screenshot compatible with version 4 Signed-off-by: kp5.choi@samsung.com <kp5.choi@samsung.com> * updated README Signed-off-by: kp5.choi@samsung.com <kp5.choi@samsung.com> * fixed invalid operation incase of y4m input Signed-off-by: kp5.choi@samsung.com <kp5.choi@samsung.com> --------- Signed-off-by: kp5.choi@samsung.com <kp5.choi@samsung.com> Signed-off-by: subhrajitm20 <2003subhrajit@gmail.com>
* For --input-csp 2, -w should be a multiple of 2 Signed-off-by: subhrajitm20 <2003subhrajit@gmail.com>
* invalid configuration check of --input-csp 2 and -w non-multiple of 2 moved to the check_conf() function Signed-off-by: subhrajitm20 <2003subhrajit@gmail.com>
…ySoftwareFoundation/openapv into handle_error_width_option
app/oapv_app_enc.c
Outdated
| // ensure frame width multiple of 2 in case of 422 format | ||
| if ((vars->input_csp == 2) && (cdesc->param[FRM_IDX].w & 0x1)) { | ||
| logerr("width should be a multiple of 2 for '--input-csp 2'\n"); | ||
| return -1; | ||
| } |
There was a problem hiding this comment.
This patch is correct, but I'd like to recommend to use for loop with cdesc.max_num_frms.
Even though the cdesc.max_num_frms value is alwasy 1, the loop with cdesc.max_num_frms value would be much more flexible when we start to support multiple frames encoding in near future.
like this;
for (i < cdesc.max_num_frms) {
if ((vars->input_csp == 2) && (cdesc->param[i].w & 0x1)) {
logerr("%d-th frame's width should be a multiple of 2 for '--input-csp 2'\n", i);
return -1;
}
}
There was a problem hiding this comment.
Added the changes inside for loop to support multiple frames encoding
* This will allow flexible implementation of multiple frames encoding in near future Signed-off-by: subhrajitm20 <2003subhrajit@gmail.com>
Signed-off-by: subhrajitm20 <2003subhrajit@gmail.com>
app/oapv_app_enc.c
Outdated
| int i; | ||
| for(i = 0; i < cdesc->max_num_frms; i++) { | ||
| // ensure frame width multiple of 2 in case of 422 format | ||
| if ((vars->input_csp == 2) && (cdesc->param[FRM_IDX].w & 0x1)) { |
There was a problem hiding this comment.
I think FRM_IDX should be replaced with 'i'
There was a problem hiding this comment.
Made the changes
Signed-off-by: Subhrajit Mishra <84323996+subhrajitm20@users.noreply.github.com>
|
@subhrajitm20 |
…n#69) * Error handling in encoder for width setting * For --input-csp 2, -w should be a multiple of 2 * move width check in encoder to check_conf() function * invalid configuration check of --input-csp 2 and -w non-multiple of 2 moved to the check_conf() function * Update readme (AcademySoftwareFoundation#67) * updated imhex screenshot compatible with version 4 Signed-off-by: kp5.choi@samsung.com <kp5.choi@samsung.com> * updated README Signed-off-by: kp5.choi@samsung.com <kp5.choi@samsung.com> * fixed invalid operation incase of y4m input Signed-off-by: kp5.choi@samsung.com <kp5.choi@samsung.com> --------- Signed-off-by: kp5.choi@samsung.com <kp5.choi@samsung.com> Signed-off-by: subhrajitm20 <2003subhrajit@gmail.com> * Error handling in encoder for width setting * For --input-csp 2, -w should be a multiple of 2 Signed-off-by: subhrajitm20 <2003subhrajit@gmail.com> * move width check in encoder to check_conf() function * invalid configuration check of --input-csp 2 and -w non-multiple of 2 moved to the check_conf() function Signed-off-by: subhrajitm20 <2003subhrajit@gmail.com> * Enclosing check code in for loop of max_num_frms * This will allow flexible implementation of multiple frames encoding in near future Signed-off-by: subhrajitm20 <2003subhrajit@gmail.com> * Using existing for loop for handling invalid width Signed-off-by: subhrajitm20 <2003subhrajit@gmail.com> * Bug fix: updating FRM_IDX to loop parameter Signed-off-by: Subhrajit Mishra <84323996+subhrajitm20@users.noreply.github.com> --------- Signed-off-by: kp5.choi@samsung.com <kp5.choi@samsung.com> Signed-off-by: subhrajitm20 <2003subhrajit@gmail.com> Signed-off-by: Subhrajit Mishra <84323996+subhrajitm20@users.noreply.github.com> Co-authored-by: kpchoi <kp5.choi@samsung.com>
This PR fixes the error handling in APV encoder for the case of --input-csp 2 (422 subsampling) and width not multiple of 2.
In the existing code, the encoder proceeds with encoding the given file to generate an incorrect bitstream. Example command:
./build/bin/oapv_app_enc -i ./video.yuv -o encoded.oapv -w 1919 -h 1080 -z 60 --input-csp 2The encoder produces .oapv file. When it is fed to the decoder with command:
./build/bin/oapv_app_dec -i encoded.oapv -o decoded.yuvthe decoder declares error and exits since the decoder already has the correct error handling code on line 702 in
oapv_vlc.c.