-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
Android tox client (Antox) is suffering from low FPS. Investigating this issue, i came to the native implementation of tox, which could faster up much the FPS.
toxav_video_send_frame
method in toxav.c has quite heavy and unnecessary memory allocation for each frame to encode.
vpx_img_alloc(&img, VPX_IMG_FMT_I420, width, height, 0);
- this one could be allocated only once, when the video capture is started.
memcpy(img.planes[VPX_PLANE_Y], y, width * height);
memcpy(img.planes[VPX_PLANE_U], u, (width / 2) * (height / 2));
memcpy(img.planes[VPX_PLANE_V], v, (width / 2) * (height / 2));
- these could use the links to y,u,v arrays, instead of copying the data each frame. Or am i wrong, and vpx codec needs the y,u,v data to be side-by-side organized in memory, and we cannot avoid copying the data?
So:
- We can create the static field for the
img
each time the video capture begins, and free it when video capture stops. This could lead to the proplems when several threads will want to access this object, so i want a discussion to decide the best way to solve the issue. - We can pass the link to y,u,v arrays instead of copying the data - or no?
Mikhael-Danilov, vassad, SkyzohKey and im-grey
Metadata
Metadata
Assignees
Labels
No labels