Merge "Remove memset of every external frame buffer."
This commit is contained in:
commit
ecd7e3d2b7
@ -71,6 +71,7 @@ class ExternalFrameBufferList {
|
|||||||
if (ext_fb_list_[idx].size < min_size) {
|
if (ext_fb_list_[idx].size < min_size) {
|
||||||
delete [] ext_fb_list_[idx].data;
|
delete [] ext_fb_list_[idx].data;
|
||||||
ext_fb_list_[idx].data = new uint8_t[min_size];
|
ext_fb_list_[idx].data = new uint8_t[min_size];
|
||||||
|
memset(ext_fb_list_[idx].data, 0, min_size);
|
||||||
ext_fb_list_[idx].size = min_size;
|
ext_fb_list_[idx].size = min_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +61,10 @@ int vp9_get_frame_buffer(void *cb_priv, size_t min_size,
|
|||||||
if (!int_fb_list->int_fb[i].data)
|
if (!int_fb_list->int_fb[i].data)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
// This memset is needed for fixing valgrind error from C loop filter
|
||||||
|
// due to access uninitialized memory in frame border. It could be
|
||||||
|
// removed if border is totally removed.
|
||||||
|
vpx_memset(int_fb_list->int_fb[i].data, 0, min_size);
|
||||||
int_fb_list->int_fb[i].size = min_size;
|
int_fb_list->int_fb[i].size = min_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,15 +43,15 @@ typedef struct vpx_codec_frame_buffer {
|
|||||||
*
|
*
|
||||||
* This callback is invoked by the decoder to retrieve data for the frame
|
* This callback is invoked by the decoder to retrieve data for the frame
|
||||||
* buffer in order for the decode call to complete. The callback must
|
* buffer in order for the decode call to complete. The callback must
|
||||||
* allocate at least min_size in bytes and assign it to fb->data. Then the
|
* allocate at least min_size in bytes and assign it to fb->data. The callback
|
||||||
* callback must set fb->size to the allocated size. The application does not
|
* must zero out all the data allocated. Then the callback must set fb->size
|
||||||
* need to align the allocated data. The callback is triggered when the
|
* to the allocated size. The application does not need to align the allocated
|
||||||
* decoder needs a frame buffer to decode a compressed image into. This
|
* data. The callback is triggered when the decoder needs a frame buffer to
|
||||||
* function may be called more than once for every call to vpx_codec_decode.
|
* decode a compressed image into. This function may be called more than once
|
||||||
* The application may set fb->priv to some data which will be passed
|
* for every call to vpx_codec_decode. The application may set fb->priv to
|
||||||
* back in the ximage and the release function call. |fb| is guaranteed to
|
* some data which will be passed back in the ximage and the release function
|
||||||
* not be NULL. On success the callback must return 0. Any failure the
|
* call. |fb| is guaranteed to not be NULL. On success the callback must
|
||||||
* callback must return a value less than 0.
|
* return 0. Any failure the callback must return a value less than 0.
|
||||||
*
|
*
|
||||||
* \param[in] priv Callback's private data
|
* \param[in] priv Callback's private data
|
||||||
* \param[in] new_size Size in bytes needed by the buffer
|
* \param[in] new_size Size in bytes needed by the buffer
|
||||||
|
@ -199,11 +199,6 @@ int vp9_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
|
|||||||
if (fb->data == NULL || fb->size < external_frame_size)
|
if (fb->data == NULL || fb->size < external_frame_size)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// This memset is needed for fixing valgrind error from C loop filter
|
|
||||||
// due to access uninitialized memory in frame border. It could be
|
|
||||||
// removed if border is totally removed.
|
|
||||||
vpx_memset(fb->data, 0, fb->size);
|
|
||||||
|
|
||||||
ybf->buffer_alloc = (uint8_t *)yv12_align_addr(fb->data, 32);
|
ybf->buffer_alloc = (uint8_t *)yv12_align_addr(fb->data, 32);
|
||||||
} else if (frame_size > (size_t)ybf->buffer_alloc_sz) {
|
} else if (frame_size > (size_t)ybf->buffer_alloc_sz) {
|
||||||
// Allocation to hold larger frame, or first allocation.
|
// Allocation to hold larger frame, or first allocation.
|
||||||
|
2
vpxdec.c
2
vpxdec.c
@ -384,7 +384,7 @@ int get_vp9_frame_buffer(void *cb_priv, size_t min_size,
|
|||||||
|
|
||||||
if (ext_fb_list->ext_fb[i].size < min_size) {
|
if (ext_fb_list->ext_fb[i].size < min_size) {
|
||||||
free(ext_fb_list->ext_fb[i].data);
|
free(ext_fb_list->ext_fb[i].data);
|
||||||
ext_fb_list->ext_fb[i].data = (uint8_t *)malloc(min_size);
|
ext_fb_list->ext_fb[i].data = (uint8_t *)calloc(min_size, sizeof(uint8_t));
|
||||||
if (!ext_fb_list->ext_fb[i].data)
|
if (!ext_fb_list->ext_fb[i].data)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user