OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include <assert.h> | 11 #include <assert.h> |
12 | 12 |
13 #include "vp9/common/vp9_frame_buffers.h" | 13 #include "vp9/common/vp9_frame_buffers.h" |
14 #include "vpx_mem/vpx_mem.h" | 14 #include "vpx_mem/vpx_mem.h" |
15 | 15 |
16 int vp9_alloc_internal_frame_buffers(InternalFrameBufferList *list) { | 16 int vp9_alloc_internal_frame_buffers(InternalFrameBufferList *list) { |
17 assert(list != NULL); | 17 assert(list != NULL); |
18 vp9_free_internal_frame_buffers(list); | 18 vp9_free_internal_frame_buffers(list); |
19 | 19 |
20 list->num_internal_frame_buffers = | 20 list->num_internal_frame_buffers = |
21 VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS; | 21 VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS; |
22 list->int_fb = vpx_calloc(list->num_internal_frame_buffers, | 22 list->int_fb = |
23 sizeof(*list->int_fb)); | 23 (InternalFrameBuffer *)vpx_calloc(list->num_internal_frame_buffers, |
| 24 sizeof(*list->int_fb)); |
24 return (list->int_fb == NULL); | 25 return (list->int_fb == NULL); |
25 } | 26 } |
26 | 27 |
27 void vp9_free_internal_frame_buffers(InternalFrameBufferList *list) { | 28 void vp9_free_internal_frame_buffers(InternalFrameBufferList *list) { |
28 int i; | 29 int i; |
29 | 30 |
30 assert(list != NULL); | 31 assert(list != NULL); |
31 | 32 |
32 for (i = 0; i < list->num_internal_frame_buffers; ++i) { | 33 for (i = 0; i < list->num_internal_frame_buffers; ++i) { |
33 vpx_free(list->int_fb[i].data); | 34 vpx_free(list->int_fb[i].data); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 fb->priv = &int_fb_list->int_fb[i]; | 72 fb->priv = &int_fb_list->int_fb[i]; |
72 return 0; | 73 return 0; |
73 } | 74 } |
74 | 75 |
75 int vp9_release_frame_buffer(void *cb_priv, vpx_codec_frame_buffer_t *fb) { | 76 int vp9_release_frame_buffer(void *cb_priv, vpx_codec_frame_buffer_t *fb) { |
76 InternalFrameBuffer *const int_fb = (InternalFrameBuffer *)fb->priv; | 77 InternalFrameBuffer *const int_fb = (InternalFrameBuffer *)fb->priv; |
77 (void)cb_priv; | 78 (void)cb_priv; |
78 int_fb->in_use = 0; | 79 int_fb->in_use = 0; |
79 return 0; | 80 return 0; |
80 } | 81 } |
OLD | NEW |