The reason for blurring is RESIZE. Therefore, you can increase the video size (only applicable to MJPEG) to reduce the replay Effect of RESIZE.
[Note] increasing the video size may cause a series of problems, such as decreasing the frame rate, making file system too late to write data, and making memory unavailable.
Modify the video size in "vid_preview_req_hdlr,
Width must be a multiple of 16,
The application and release of the corresponding memory must also be modified (intermal memory is not enough to use external memory), and the memory for YUV must be 16 bytes aligned.
1) Add the memory size of the MED according to the situation and add the macro "MAX_VID_ENC_EXT_MEM_SIZE". I will change it to 115*1024.
2) To facilitate modification, you can add two macro definitions in the file "vid_msg_handler_mjpg.c ".
# Define AVI_RECORD_WIDTH (288)
# Define AVI_RECORD_HEIGHT (236)
----------- The following procedure is not described as modifying the function "vid_preview_req_hdlr ()"------------------
3) Add the following sentence after req_p = (media_vid_preview_req_struct *) ilm_ptr-> local_para_ptr;
Req_p-> image_width = AVI_RECORD_WIDTH;
Req_p-> image_height = AVI_RECORD_HEIGHT;
Of course, the width and height here are taken from the upper layer. You can modify them with the code.
4) Change vid_context_p-> m1__y_buf_p = (kal_uint32) med_alloc_int_mem (vid_context_p-> m1__y_buf_size)
Vid_context_p-> m1__y_buf_p = (kal_uint32) med_alloc_ext_mem (vid_context_p-> m1__y_buf_size );
That is, ext mem is used. Because int mem cannot be increased at will, ext mem is used instead.
Similarly, vid_context_p-> m1__u_buf_p and vid_context_p-> m1__v_buf_p both use ext mem
5) the calculation of these buffer sizes is
If (AVI_RECORD_WIDTH % 16)
{
ASSERT (0); // width must be 16X
}
Else
{
If (AVI_RECORD_HEIGHT % 16)
{
Vid_context_p-> m1__y_buf_size = AVI_RECORD_WIDTH * (AVI_RECORD_HEIGHT> 4) + 1) <4 );
}
Else
{
Vid_context_p-> m1__y_buf_size = AVI_RECORD_WIDTH * AVI_RECORD_HEIGHT;
}
}
Vid_context_p-> m1__u_buf_size and vid_context_p-> m1__v_buf_size are (vid_context_p-> m1__y_buf_size)/4
6) change the other 176 numbers in this function to AVI_RECORD_WIDTH.
7) modify the function "vid_release_recorder_memory ()"
Change med_free_int_mem (void **) & vid_context_p-> m1__y_buf_p) to med_free_ext_mem (void **) & vid_context_p-> m1__y_buf_p );
Similarly, vid_context_p-> m1__u_buf_p and vid_context_p-> m1__v_buf_p must be modified.