summaryrefslogtreecommitdiff
path: root/vpx_scale
diff options
context:
space:
mode:
authorFrank Galligan <fgalligan@google.com>2014-01-23 14:59:00 -0800
committerFrank Galligan <fgalligan@google.com>2014-01-24 10:10:20 -0800
commitb1c72b633ef633a1ee6e83c3556393b6fe9068c4 (patch)
treef4e86f32c9715c07f65945b0d5f51f9f4be6acb9 /vpx_scale
parent63fb34c9bc6114c6ab8b4250177ff6197edacf25 (diff)
downloadlibvpx-b1c72b633ef633a1ee6e83c3556393b6fe9068c4.tar
libvpx-b1c72b633ef633a1ee6e83c3556393b6fe9068c4.tar.gz
libvpx-b1c72b633ef633a1ee6e83c3556393b6fe9068c4.tar.bz2
libvpx-b1c72b633ef633a1ee6e83c3556393b6fe9068c4.zip
Revert external frame buffer code.
A future CL will add external frame buffers differently. Squash commit of four revert commits: Revert "Increase required number of external frame buffers" This reverts commit 9e41d569d7c84dd9ca8f0047c15377a883945685. Revert "Add external constants." This reverts commit bbf53047b03106e3c2e24b28cb836cc838db5ee8. Revert "Add frame buffer lru cache." This reverts commit fbada948fa345e67acf9aa41a8f9a78f5dfe8648. Conflicts: vpxdec.c Change-Id: I76fe42419923a6ea6c75d9997cbbf941d73d3005 Revert "Add support to pass in external frame buffers." This reverts commit 10f891696bc4c972c13cc9fde2c53470501a03e2. Conflicts: test/external_frame_buffer_test.cc vp9/common/vp9_alloccommon.c vp9/common/vp9_reconinter.c vp9/decoder/vp9_decodeframe.c vp9/encoder/vp9_onyx_if.c vp9/vp9_dx_iface.c vpx/vpx_decoder.h vpx/vpx_external_frame_buffer.h vpx_scale/generic/yv12config.c vpxdec.c Change-Id: I7434cf590f1c852b38569980e4247fad0d939c2e
Diffstat (limited to 'vpx_scale')
-rw-r--r--vpx_scale/generic/yv12config.c75
-rw-r--r--vpx_scale/yv12config.h14
2 files changed, 20 insertions, 69 deletions
diff --git a/vpx_scale/generic/yv12config.c b/vpx_scale/generic/yv12config.c
index 994e8430c..693125a0f 100644
--- a/vpx_scale/generic/yv12config.c
+++ b/vpx_scale/generic/yv12config.c
@@ -19,18 +19,10 @@
/****************************************************************************
*
****************************************************************************/
-
-#define yv12_align_addr(addr, align) \
- (void*)(((size_t)(addr) + ((align) - 1)) & (size_t)-(align))
-
int
vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
if (ybf) {
- // If libvpx is using external frame buffers then buffer_alloc_sz must
- // not be set.
- if (ybf->buffer_alloc_sz > 0) {
- vpx_free(ybf->buffer_alloc);
- }
+ vpx_free(ybf->buffer_alloc);
/* buffer_alloc isn't accessed by most functions. Rather y_buffer,
u_buffer and v_buffer point to buffer_alloc and are used. Clear out
@@ -116,9 +108,7 @@ int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
int vp9_free_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
if (ybf) {
- if (ybf->buffer_alloc_sz > 0) {
- vpx_free(ybf->buffer_alloc);
- }
+ vpx_free(ybf->buffer_alloc);
/* buffer_alloc isn't accessed by most functions. Rather y_buffer,
u_buffer and v_buffer point to buffer_alloc and are used. Clear out
@@ -133,10 +123,7 @@ int vp9_free_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
int vp9_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
int width, int height,
- int ss_x, int ss_y, int border,
- vpx_codec_frame_buffer_t *ext_fb,
- vpx_realloc_frame_buffer_cb_fn_t cb,
- void *user_priv) {
+ int ss_x, int ss_y, int border) {
if (ybf) {
const int aligned_width = (width + 7) & ~7;
const int aligned_height = (height + 7) & ~7;
@@ -161,48 +148,25 @@ int vp9_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
#else
const int frame_size = yplane_size + 2 * uvplane_size;
#endif
+ if (frame_size > ybf->buffer_alloc_sz) {
+ // Allocation to hold larger frame, or first allocation.
+ if (ybf->buffer_alloc)
+ vpx_free(ybf->buffer_alloc);
+ ybf->buffer_alloc = vpx_memalign(32, frame_size);
+ if (!ybf->buffer_alloc)
+ return -1;
- if (ext_fb != NULL) {
- const int align_addr_extra_size = 31;
- const size_t external_frame_size = frame_size + align_addr_extra_size;
- if (external_frame_size > ext_fb->size) {
- // Allocation to hold larger frame, or first allocation.
- if (cb(user_priv, external_frame_size, ext_fb) < 0) {
- return -1;
- }
-
- if (ext_fb->data == NULL || ext_fb->size < external_frame_size) {
- 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(ext_fb->data, 0, ext_fb->size);
-
- ybf->buffer_alloc = yv12_align_addr(ext_fb->data, 32);
- }
- } else {
- if (frame_size > ybf->buffer_alloc_sz) {
- // Allocation to hold larger frame, or first allocation.
- if (ybf->buffer_alloc)
- vpx_free(ybf->buffer_alloc);
- ybf->buffer_alloc = vpx_memalign(32, frame_size);
- if (!ybf->buffer_alloc)
- return -1;
-
- ybf->buffer_alloc_sz = frame_size;
-
- // This memset is needed for fixing valgrind error from C loop filter
- // due to access uninitialized memory in frame boarder. It could be
- // removed if border is totally removed.
- vpx_memset(ybf->buffer_alloc, 0, ybf->buffer_alloc_sz);
- }
+ ybf->buffer_alloc_sz = frame_size;
- if (ybf->buffer_alloc_sz < frame_size)
- return -1;
+ // This memset is needed for fixing valgrind error from C loop filter
+ // due to access uninitialized memory in frame boarder. It could be
+ // removed if border is totally removed.
+ vpx_memset(ybf->buffer_alloc, 0, ybf->buffer_alloc_sz);
}
+ if (ybf->buffer_alloc_sz < frame_size)
+ return -1;
+
/* Only support allocating buffers that have a border that's a multiple
* of 32. The border restriction is required to get 16-byte alignment of
* the start of the chroma rows without introducing an arbitrary gap
@@ -250,8 +214,7 @@ int vp9_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
int ss_x, int ss_y, int border) {
if (ybf) {
vp9_free_frame_buffer(ybf);
- return vp9_realloc_frame_buffer(ybf, width, height, ss_x, ss_y, border,
- NULL, NULL, NULL);
+ return vp9_realloc_frame_buffer(ybf, width, height, ss_x, ss_y, border);
}
return -2;
}
diff --git a/vpx_scale/yv12config.h b/vpx_scale/yv12config.h
index 610e7d280..8f39eb769 100644
--- a/vpx_scale/yv12config.h
+++ b/vpx_scale/yv12config.h
@@ -15,7 +15,6 @@
extern "C" {
#endif
-#include "vpx/vpx_external_frame_buffer.h"
#include "vpx/vpx_integer.h"
#define VP8BORDERINPIXELS 32
@@ -66,20 +65,9 @@ extern "C" {
int vp9_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
int width, int height, int ss_x, int ss_y,
int border);
-
- // Updates the yv12 buffer config with the frame buffer. If ext_fb is not
- // NULL then libvpx is using external frame buffers. The function will
- // check if the frame buffer is big enough to fit the decoded frame and
- // try to reallocate the frame buffer. If ext_fb is not NULL and the frame
- // buffer is not big enough libvpx will call cb with minimum size in bytes.
- //
- // Returns 0 on success. Returns < 0 on failure.
int vp9_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
int width, int height, int ss_x, int ss_y,
- int border,
- vpx_codec_frame_buffer_t *ext_fb,
- vpx_realloc_frame_buffer_cb_fn_t cb,
- void *user_priv);
+ int border);
int vp9_free_frame_buffer(YV12_BUFFER_CONFIG *ybf);
#ifdef __cplusplus