vpx_image: add VPX_ prefix to PLANE_*
The PLANE_{PACKED,Y,U,V,ALPHA} macros should be renamed to be within the
VPX_ namespace.
Fixes #27
diff --git a/ivfdec.c b/ivfdec.c
index 94045f2..8ee60b6 100644
--- a/ivfdec.c
+++ b/ivfdec.c
@@ -534,28 +534,28 @@
out = out_open(out_fn, do_md5);
}
- buf = img->planes[PLANE_Y];
+ buf = img->planes[VPX_PLANE_Y];
for (y = 0; y < img->d_h; y++)
{
out_put(out, buf, img->d_w, do_md5);
- buf += img->stride[PLANE_Y];
+ buf += img->stride[VPX_PLANE_Y];
}
- buf = img->planes[flipuv?PLANE_V:PLANE_U];
+ buf = img->planes[flipuv?VPX_PLANE_V:VPX_PLANE_U];
for (y = 0; y < (1 + img->d_h) / 2; y++)
{
out_put(out, buf, (1 + img->d_w) / 2, do_md5);
- buf += img->stride[PLANE_U];
+ buf += img->stride[VPX_PLANE_U];
}
- buf = img->planes[flipuv?PLANE_U:PLANE_V];
+ buf = img->planes[flipuv?VPX_PLANE_U:VPX_PLANE_V];
for (y = 0; y < (1 + img->d_h) / 2; y++)
{
out_put(out, buf, (1 + img->d_w) / 2, do_md5);
- buf += img->stride[PLANE_V];
+ buf += img->stride[VPX_PLANE_V];
}
if (!fn2)
diff --git a/ivfenc.c b/ivfenc.c
index 1f62199..65d11fa 100644
--- a/ivfenc.c
+++ b/ivfenc.c
@@ -247,10 +247,10 @@
switch (plane)
{
case 1:
- ptr = img->planes[img->fmt==VPX_IMG_FMT_YV12? PLANE_V : PLANE_U];
+ ptr = img->planes[img->fmt==VPX_IMG_FMT_YV12? VPX_PLANE_V : VPX_PLANE_U];
break;
case 2:
- ptr = img->planes[img->fmt==VPX_IMG_FMT_YV12?PLANE_U : PLANE_V];
+ ptr = img->planes[img->fmt==VPX_IMG_FMT_YV12?VPX_PLANE_U : VPX_PLANE_V];
break;
default:
ptr = img->planes[plane];
diff --git a/vp8/vp8_cx_iface.c b/vp8/vp8_cx_iface.c
index b45b212..5883abd 100644
--- a/vp8/vp8_cx_iface.c
+++ b/vp8/vp8_cx_iface.c
@@ -536,19 +536,19 @@
YV12_BUFFER_CONFIG *yv12)
{
vpx_codec_err_t res = VPX_CODEC_OK;
- yv12->y_buffer = img->planes[PLANE_Y];
- yv12->u_buffer = img->planes[PLANE_U];
- yv12->v_buffer = img->planes[PLANE_V];
+ yv12->y_buffer = img->planes[VPX_PLANE_Y];
+ yv12->u_buffer = img->planes[VPX_PLANE_U];
+ yv12->v_buffer = img->planes[VPX_PLANE_V];
yv12->y_width = img->d_w;
yv12->y_height = img->d_h;
yv12->uv_width = (1 + yv12->y_width) / 2;
yv12->uv_height = (1 + yv12->y_height) / 2;
- yv12->y_stride = img->stride[PLANE_Y];
- yv12->uv_stride = img->stride[PLANE_U];
+ yv12->y_stride = img->stride[VPX_PLANE_Y];
+ yv12->uv_stride = img->stride[VPX_PLANE_U];
- yv12->border = (img->stride[PLANE_Y] - img->w) / 2;
+ yv12->border = (img->stride[VPX_PLANE_Y] - img->w) / 2;
yv12->clrtype = (img->fmt == VPX_IMG_FMT_VPXI420 || img->fmt == VPX_IMG_FMT_VPXYV12); //REG_YUV = 0
return res;
}
@@ -857,9 +857,9 @@
*/
ctx->preview_img.bps = 12;
- ctx->preview_img.planes[PLANE_Y] = sd.y_buffer;
- ctx->preview_img.planes[PLANE_U] = sd.u_buffer;
- ctx->preview_img.planes[PLANE_V] = sd.v_buffer;
+ ctx->preview_img.planes[VPX_PLANE_Y] = sd.y_buffer;
+ ctx->preview_img.planes[VPX_PLANE_U] = sd.u_buffer;
+ ctx->preview_img.planes[VPX_PLANE_V] = sd.v_buffer;
if (sd.clrtype == REG_YUV)
ctx->preview_img.fmt = VPX_IMG_FMT_I420;
@@ -871,9 +871,9 @@
ctx->preview_img.d_w = ctx->cfg.g_w;
ctx->preview_img.d_h = ctx->cfg.g_h;
- ctx->preview_img.stride[PLANE_Y] = sd.y_stride;
- ctx->preview_img.stride[PLANE_U] = sd.uv_stride;
- ctx->preview_img.stride[PLANE_V] = sd.uv_stride;
+ ctx->preview_img.stride[VPX_PLANE_Y] = sd.y_stride;
+ ctx->preview_img.stride[VPX_PLANE_U] = sd.uv_stride;
+ ctx->preview_img.stride[VPX_PLANE_V] = sd.uv_stride;
ctx->preview_img.w = sd.y_width;
ctx->preview_img.h = sd.y_height;
diff --git a/vp8/vp8_dx_iface.c b/vp8/vp8_dx_iface.c
index 9108bc2..19c59cd 100644
--- a/vp8/vp8_dx_iface.c
+++ b/vp8/vp8_dx_iface.c
@@ -557,19 +557,19 @@
YV12_BUFFER_CONFIG *yv12)
{
vpx_codec_err_t res = VPX_CODEC_OK;
- yv12->y_buffer = img->planes[PLANE_Y];
- yv12->u_buffer = img->planes[PLANE_U];
- yv12->v_buffer = img->planes[PLANE_V];
+ yv12->y_buffer = img->planes[VPX_PLANE_Y];
+ yv12->u_buffer = img->planes[VPX_PLANE_U];
+ yv12->v_buffer = img->planes[VPX_PLANE_V];
yv12->y_width = img->d_w;
yv12->y_height = img->d_h;
yv12->uv_width = yv12->y_width / 2;
yv12->uv_height = yv12->y_height / 2;
- yv12->y_stride = img->stride[PLANE_Y];
- yv12->uv_stride = img->stride[PLANE_U];
+ yv12->y_stride = img->stride[VPX_PLANE_Y];
+ yv12->uv_stride = img->stride[VPX_PLANE_U];
- yv12->border = (img->stride[PLANE_Y] - img->d_w) / 2;
+ yv12->border = (img->stride[VPX_PLANE_Y] - img->d_w) / 2;
yv12->clrtype = (img->fmt == VPX_IMG_FMT_VPXI420 || img->fmt == VPX_IMG_FMT_VPXYV12);
return res;
diff --git a/vpx/src/vpx_image.c b/vpx/src/vpx_image.c
index 881ab1a..55ee391 100644
--- a/vpx/src/vpx_image.c
+++ b/vpx/src/vpx_image.c
@@ -133,8 +133,8 @@
img->bps = bps;
/* Calculate strides */
- img->stride[PLANE_Y] = img->stride[PLANE_ALPHA] = s;
- img->stride[PLANE_U] = img->stride[PLANE_V] = s >> xcs;
+ img->stride[VPX_PLANE_Y] = img->stride[VPX_PLANE_ALPHA] = s;
+ img->stride[VPX_PLANE_U] = img->stride[VPX_PLANE_V] = s >> xcs;
/* Default viewport to entire image */
if (!vpx_img_set_rect(img, 0, 0, d_w, d_h))
@@ -180,8 +180,8 @@
/* Calculate plane pointers */
if (!(img->fmt & VPX_IMG_FMT_PLANAR))
{
- img->planes[PLANE_PACKED] =
- img->img_data + x * img->bps / 8 + y * img->stride[PLANE_PACKED];
+ img->planes[VPX_PLANE_PACKED] =
+ img->img_data + x * img->bps / 8 + y * img->stride[VPX_PLANE_PACKED];
}
else
{
@@ -189,33 +189,33 @@
if (img->fmt & VPX_IMG_FMT_HAS_ALPHA)
{
- img->planes[PLANE_ALPHA] =
- data + x + y * img->stride[PLANE_ALPHA];
- data += img->h * img->stride[PLANE_ALPHA];
+ img->planes[VPX_PLANE_ALPHA] =
+ data + x + y * img->stride[VPX_PLANE_ALPHA];
+ data += img->h * img->stride[VPX_PLANE_ALPHA];
}
- img->planes[PLANE_Y] = data + x + y * img->stride[PLANE_Y];
- data += img->h * img->stride[PLANE_Y];
+ img->planes[VPX_PLANE_Y] = data + x + y * img->stride[VPX_PLANE_Y];
+ data += img->h * img->stride[VPX_PLANE_Y];
if (!(img->fmt & VPX_IMG_FMT_UV_FLIP))
{
- img->planes[PLANE_U] = data
+ img->planes[VPX_PLANE_U] = data
+ (x >> img->x_chroma_shift)
- + (y >> img->y_chroma_shift) * img->stride[PLANE_U];
- data += (img->h >> img->y_chroma_shift) * img->stride[PLANE_U];
- img->planes[PLANE_V] = data
+ + (y >> img->y_chroma_shift) * img->stride[VPX_PLANE_U];
+ data += (img->h >> img->y_chroma_shift) * img->stride[VPX_PLANE_U];
+ img->planes[VPX_PLANE_V] = data
+ (x >> img->x_chroma_shift)
- + (y >> img->y_chroma_shift) * img->stride[PLANE_V];
+ + (y >> img->y_chroma_shift) * img->stride[VPX_PLANE_V];
}
else
{
- img->planes[PLANE_V] = data
+ img->planes[VPX_PLANE_V] = data
+ (x >> img->x_chroma_shift)
- + (y >> img->y_chroma_shift) * img->stride[PLANE_V];
- data += (img->h >> img->y_chroma_shift) * img->stride[PLANE_V];
- img->planes[PLANE_U] = data
+ + (y >> img->y_chroma_shift) * img->stride[VPX_PLANE_V];
+ data += (img->h >> img->y_chroma_shift) * img->stride[VPX_PLANE_V];
+ img->planes[VPX_PLANE_U] = data
+ (x >> img->x_chroma_shift)
- + (y >> img->y_chroma_shift) * img->stride[PLANE_U];
+ + (y >> img->y_chroma_shift) * img->stride[VPX_PLANE_U];
}
}
@@ -233,19 +233,19 @@
* stride parameter will be promoted to unsigned, causing errors when
* the lhs is a larger type than the rhs.
*/
- img->planes[PLANE_Y] += (signed)(img->d_h - 1) * img->stride[PLANE_Y];
- img->stride[PLANE_Y] = -img->stride[PLANE_Y];
+ img->planes[VPX_PLANE_Y] += (signed)(img->d_h - 1) * img->stride[VPX_PLANE_Y];
+ img->stride[VPX_PLANE_Y] = -img->stride[VPX_PLANE_Y];
- img->planes[PLANE_U] += (signed)((img->d_h >> img->y_chroma_shift) - 1)
- * img->stride[PLANE_U];
- img->stride[PLANE_U] = -img->stride[PLANE_U];
+ img->planes[VPX_PLANE_U] += (signed)((img->d_h >> img->y_chroma_shift) - 1)
+ * img->stride[VPX_PLANE_U];
+ img->stride[VPX_PLANE_U] = -img->stride[VPX_PLANE_U];
- img->planes[PLANE_V] += (signed)((img->d_h >> img->y_chroma_shift) - 1)
- * img->stride[PLANE_V];
- img->stride[PLANE_V] = -img->stride[PLANE_V];
+ img->planes[VPX_PLANE_V] += (signed)((img->d_h >> img->y_chroma_shift) - 1)
+ * img->stride[VPX_PLANE_V];
+ img->stride[VPX_PLANE_V] = -img->stride[VPX_PLANE_V];
- img->planes[PLANE_ALPHA] += (signed)(img->d_h - 1) * img->stride[PLANE_ALPHA];
- img->stride[PLANE_ALPHA] = -img->stride[PLANE_ALPHA];
+ img->planes[VPX_PLANE_ALPHA] += (signed)(img->d_h - 1) * img->stride[VPX_PLANE_ALPHA];
+ img->stride[VPX_PLANE_ALPHA] = -img->stride[VPX_PLANE_ALPHA];
}
void vpx_img_free(vpx_image_t *img)
diff --git a/vpx/vpx_image.h b/vpx/vpx_image.h
index 1d86152..7b235a4 100644
--- a/vpx/vpx_image.h
+++ b/vpx/vpx_image.h
@@ -110,11 +110,18 @@
unsigned int y_chroma_shift; /**< subsampling order, Y */
/* Image data pointers. */
-#define PLANE_PACKED 0 /**< To be used for all packed formats */
-#define PLANE_Y 0 /**< Y (Luminance) plane */
-#define PLANE_U 1 /**< U (Chroma) plane */
-#define PLANE_V 2 /**< V (Chroma) plane */
-#define PLANE_ALPHA 3 /**< A (Transparancy) plane */
+#define VPX_PLANE_PACKED 0 /**< To be used for all packed formats */
+#define VPX_PLANE_Y 0 /**< Y (Luminance) plane */
+#define VPX_PLANE_U 1 /**< U (Chroma) plane */
+#define VPX_PLANE_V 2 /**< V (Chroma) plane */
+#define VPX_PLANE_ALPHA 3 /**< A (Transparancy) plane */
+#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
+#define PLANE_PACKED VPX_PLANE_PACKED
+#define PLANE_Y VPX_PLANE_Y
+#define PLANE_U VPX_PLANE_U
+#define PLANE_V VPX_PLANE_V
+#define PLANE_ALPHA VPX_PLANE_ALPHA
+#endif
unsigned char *planes[4]; /**< pointer to the top left pixel for each plane */
int stride[4]; /**< stride between rows for each plane */