The CLI I used is:
-i ../../test/vectors/niklas_640_480_30.yuv -w 640 -h 480 -b output.ivf -o recon.yuv -stat-report 1 -q 15 --use-default-me-hme 0
I run the program in Visual Studio 2019, in Release mode
The program crashed as soon as i run it, the crash was a "Access violation reading"
After i turned on the DEBUG INFO in release mode, I found it crashed at about line 5105 in file EbMotionEstimation.c (interpolation TL position calculation), there, search_region_index was calculated as negative number, and it crashed when calculated distortion_top_left_pos in the next line.
Then, i figured out it is because y_search_index is negative, and it made search_region_index to be negative, and the y_search_index was calculated at the beginning of this function
then I printed out the values of p_best_MV, y_mv and y_search_area_origin trying to find the relationship between them, then, I found y_search_area_origin was position when *p_best_MV and y_mv were 0, it was the reason why y_search_index was negative.
There mush be something wrong with y_search_area_origin or y_mv, i went up 2 levels of call stack to check context_ptr->y_search_area_origin[list_index][ref_pic_index], (I also checked the pos_j_buffer but nothing strange found)
The context_ptr->y_search_area_origin[list_index][ref_pic_index] values were calculated (updated) in function integer_search_sb (EbMotionEstimation.c about line 9500), in this function, y_search_area_origin was calculated as negative number.
I compared the y_search_area_origin values when use-default-me-hme set as 0 and when use-default-me-hme set as 1, there were some y_search_area_origin mismatches.
By debugging step by step, i found the “Update ME search region size based on hme-data part” (about line 9595), search_area_height was calculated as 0 (There is no reason search area size can be 0, right?!)
Search_area_height got the value from context_ptr->search_area_height, and context_ptr->search_area_height is initialized either by predefined value or argument settings from user.
Since “--use-default-me-hme 0” is set in CLI, I found the function where it was initialized, function “set_me_hme_params_from_config” in EbMotionEstimationProcess.c
When use-default-me-hme is set to 0, search_area_height should get value from user by “--search-h”, what if user forgets to set the parameter? It is initialized in EbEncHandle.c about line 2964
Its initial value is 7. so this is the reason why search_area_height is calculated as 0 when user does not set search height in the argument.
The CLI I used is: -i ../../test/vectors/niklas_640_480_30.yuv -w 640 -h 480 -b output.ivf -o recon.yuv -stat-report 1 -q 15 --use-default-me-hme 0
I run the program in Visual Studio 2019, in Release mode
The program crashed as soon as i run it, the crash was a "Access violation reading"
After i turned on the DEBUG INFO in release mode, I found it crashed at about line 5105 in file EbMotionEstimation.c (interpolation TL position calculation), there, search_region_index was calculated as negative number, and it crashed when calculated distortion_top_left_pos in the next line.
Then, i figured out it is because y_search_index is negative, and it made search_region_index to be negative, and the y_search_index was calculated at the beginning of this function
“int32_t y_search_index = (y_mv >> 2) - y_search_area_origin;”
then I printed out the values of p_best_MV, y_mv and y_search_area_origin trying to find the relationship between them, then, I found y_search_area_origin was position when *p_best_MV and y_mv were 0, it was the reason why y_search_index was negative.
There mush be something wrong with y_search_area_origin or y_mv, i went up 2 levels of call stack to check context_ptr->y_search_area_origin[list_index][ref_pic_index], (I also checked the pos_j_buffer but nothing strange found)
The context_ptr->y_search_area_origin[list_index][ref_pic_index] values were calculated (updated) in function integer_search_sb (EbMotionEstimation.c about line 9500), in this function, y_search_area_origin was calculated as negative number.
I compared the y_search_area_origin values when use-default-me-hme set as 0 and when use-default-me-hme set as 1, there were some y_search_area_origin mismatches.
By debugging step by step, i found the “Update ME search region size based on hme-data part” (about line 9595), search_area_height was calculated as 0 (There is no reason search area size can be 0, right?!)
Search_area_height got the value from context_ptr->search_area_height, and context_ptr->search_area_height is initialized either by predefined value or argument settings from user.
Since “--use-default-me-hme 0” is set in CLI, I found the function where it was initialized, function “set_me_hme_params_from_config” in EbMotionEstimationProcess.c
When use-default-me-hme is set to 0, search_area_height should get value from user by “--search-h”, what if user forgets to set the parameter? It is initialized in EbEncHandle.c about line 2964
Its initial value is 7. so this is the reason why search_area_height is calculated as 0 when user does not set search height in the argument.