summaryrefslogtreecommitdiff
path: root/vpx_scale/generic/yv12config.c
diff options
context:
space:
mode:
authorclang-format <noreply@google.com>2016-07-25 14:32:36 -0700
committerJames Zern <jzern@google.com>2016-07-26 15:57:41 -0700
commitf4be8844665bc85178fac245ca5ae3ce53927c59 (patch)
tree55f4a63f27c59daf03adf5c27f571f68db0b9c48 /vpx_scale/generic/yv12config.c
parentfbf256da41db9624e6a3392da0ba6e8778335ad3 (diff)
downloadlibvpx-f4be8844665bc85178fac245ca5ae3ce53927c59.tar
libvpx-f4be8844665bc85178fac245ca5ae3ce53927c59.tar.gz
libvpx-f4be8844665bc85178fac245ca5ae3ce53927c59.tar.bz2
libvpx-f4be8844665bc85178fac245ca5ae3ce53927c59.zip
vpx_scale: apply clang-format
Change-Id: Ia07ba57756f75911d3d06318e1f9b1982e1ca8c5
Diffstat (limited to 'vpx_scale/generic/yv12config.c')
-rw-r--r--vpx_scale/generic/yv12config.c77
1 files changed, 33 insertions, 44 deletions
diff --git a/vpx_scale/generic/yv12config.c b/vpx_scale/generic/yv12config.c
index 6bbb6d8d4..a674eac84 100644
--- a/vpx_scale/generic/yv12config.c
+++ b/vpx_scale/generic/yv12config.c
@@ -22,10 +22,9 @@
*
****************************************************************************/
#define yv12_align_addr(addr, align) \
- (void*)(((size_t)(addr) + ((align) - 1)) & (size_t)-(align))
+ (void *)(((size_t)(addr) + ((align)-1)) & (size_t) - (align))
-int
-vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
+int vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
if (ybf) {
// If libvpx is using frame buffer callbacks then buffer_alloc_sz must
// not be set.
@@ -44,8 +43,8 @@ vp8_yv12_de_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
return 0;
}
-int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
- int width, int height, int border) {
+int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width,
+ int height, int border) {
if (ybf) {
int aligned_width = (width + 15) & ~15;
int aligned_height = (height + 15) & ~15;
@@ -64,20 +63,18 @@ int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
ybf->buffer_alloc_sz = frame_size;
}
- if (!ybf->buffer_alloc || ybf->buffer_alloc_sz < frame_size)
- return -1;
+ if (!ybf->buffer_alloc || 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
* between planes, which would break the semantics of things like
* vpx_img_set_rect(). */
- if (border & 0x1f)
- return -3;
+ if (border & 0x1f) return -3;
ybf->y_crop_width = width;
ybf->y_crop_height = height;
- ybf->y_width = aligned_width;
+ ybf->y_width = aligned_width;
ybf->y_height = aligned_height;
ybf->y_stride = y_stride;
@@ -95,8 +92,10 @@ int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
ybf->frame_size = frame_size;
ybf->y_buffer = ybf->buffer_alloc + (border * y_stride) + border;
- ybf->u_buffer = ybf->buffer_alloc + yplane_size + (border / 2 * uv_stride) + border / 2;
- ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size + (border / 2 * uv_stride) + border / 2;
+ ybf->u_buffer =
+ ybf->buffer_alloc + yplane_size + (border / 2 * uv_stride) + border / 2;
+ ybf->v_buffer = ybf->buffer_alloc + yplane_size + uvplane_size +
+ (border / 2 * uv_stride) + border / 2;
ybf->alpha_buffer = NULL;
ybf->corrupted = 0; /* assume not currupted by errors */
@@ -105,8 +104,8 @@ int vp8_yv12_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
return -2;
}
-int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
- int width, int height, int border) {
+int vp8_yv12_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
+ int border) {
if (ybf) {
vp8_yv12_de_alloc_frame_buffer(ybf);
return vp8_yv12_realloc_frame_buffer(ybf, width, height, border);
@@ -134,31 +133,28 @@ int vpx_free_frame_buffer(YV12_BUFFER_CONFIG *ybf) {
return 0;
}
-int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
- int width, int height,
+int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
int ss_x, int ss_y,
#if CONFIG_VP9_HIGHBITDEPTH
int use_highbitdepth,
#endif
- int border,
- int byte_alignment,
+ int border, int byte_alignment,
vpx_codec_frame_buffer_t *fb,
- vpx_get_frame_buffer_cb_fn_t cb,
- void *cb_priv) {
+ vpx_get_frame_buffer_cb_fn_t cb, void *cb_priv) {
if (ybf) {
const int vp9_byte_align = (byte_alignment == 0) ? 1 : byte_alignment;
const int aligned_width = (width + 7) & ~7;
const int aligned_height = (height + 7) & ~7;
const int y_stride = ((aligned_width + 2 * border) + 31) & ~31;
- const uint64_t yplane_size = (aligned_height + 2 * border) *
- (uint64_t)y_stride + byte_alignment;
+ const uint64_t yplane_size =
+ (aligned_height + 2 * border) * (uint64_t)y_stride + byte_alignment;
const int uv_width = aligned_width >> ss_x;
const int uv_height = aligned_height >> ss_y;
const int uv_stride = y_stride >> ss_x;
const int uv_border_w = border >> ss_x;
const int uv_border_h = border >> ss_y;
- const uint64_t uvplane_size = (uv_height + 2 * uv_border_h) *
- (uint64_t)uv_stride + byte_alignment;
+ const uint64_t uvplane_size =
+ (uv_height + 2 * uv_border_h) * (uint64_t)uv_stride + byte_alignment;
#if CONFIG_VP9_HIGHBITDEPTH
const uint64_t frame_size =
@@ -175,15 +171,12 @@ int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
assert(fb != NULL);
- if (external_frame_size != (size_t)external_frame_size)
- return -1;
+ if (external_frame_size != (size_t)external_frame_size) return -1;
// Allocation to hold larger frame, or first allocation.
- if (cb(cb_priv, (size_t)external_frame_size, fb) < 0)
- return -1;
+ if (cb(cb_priv, (size_t)external_frame_size, fb) < 0) return -1;
- if (fb->data == NULL || fb->size < external_frame_size)
- return -1;
+ if (fb->data == NULL || fb->size < external_frame_size) return -1;
ybf->buffer_alloc = (uint8_t *)yv12_align_addr(fb->data, 32);
@@ -200,12 +193,10 @@ int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
vpx_free(ybf->buffer_alloc);
ybf->buffer_alloc = NULL;
- if (frame_size != (size_t)frame_size)
- return -1;
+ if (frame_size != (size_t)frame_size) return -1;
ybf->buffer_alloc = (uint8_t *)vpx_memalign(32, (size_t)frame_size);
- if (!ybf->buffer_alloc)
- return -1;
+ if (!ybf->buffer_alloc) return -1;
ybf->buffer_alloc_sz = (int)frame_size;
@@ -220,12 +211,11 @@ int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
* the start of the chroma rows without introducing an arbitrary gap
* between planes, which would break the semantics of things like
* vpx_img_set_rect(). */
- if (border & 0x1f)
- return -3;
+ if (border & 0x1f) return -3;
ybf->y_crop_width = width;
ybf->y_crop_height = height;
- ybf->y_width = aligned_width;
+ ybf->y_width = aligned_width;
ybf->y_height = aligned_height;
ybf->y_stride = y_stride;
@@ -256,9 +246,10 @@ int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
ybf->u_buffer = (uint8_t *)yv12_align_addr(
buf + yplane_size + (uv_border_h * uv_stride) + uv_border_w,
vp9_byte_align);
- ybf->v_buffer = (uint8_t *)yv12_align_addr(
- buf + yplane_size + uvplane_size + (uv_border_h * uv_stride) +
- uv_border_w, vp9_byte_align);
+ ybf->v_buffer =
+ (uint8_t *)yv12_align_addr(buf + yplane_size + uvplane_size +
+ (uv_border_h * uv_stride) + uv_border_w,
+ vp9_byte_align);
ybf->corrupted = 0; /* assume not corrupted by errors */
return 0;
@@ -266,14 +257,12 @@ int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
return -2;
}
-int vpx_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
- int width, int height,
+int vpx_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
int ss_x, int ss_y,
#if CONFIG_VP9_HIGHBITDEPTH
int use_highbitdepth,
#endif
- int border,
- int byte_alignment) {
+ int border, int byte_alignment) {
if (ybf) {
vpx_free_frame_buffer(ybf);
return vpx_realloc_frame_buffer(ybf, width, height, ss_x, ss_y,