Avoid an potential name clashes and match other external types.
s/IMG_FMT/VPX_$&/g
s/img_fmt/vpx_$&/g
Change-Id: Ia7ad5bbb6424416b37e71e5f5eb1eca31c3c707f
height = strtol(argv[2], NULL, 0);
if(width < 16 || width%2 || height <16 || height%2)
die("Invalid resolution: %ldx%ld", width, height);
- if(!vpx_img_alloc(&raw, IMG_FMT_YV12, width, height, 1))
+ if(!vpx_img_alloc(&raw, VPX_IMG_FMT_YV12, width, height, 1))
die("Faile to allocate image", width, height);
if(!(outfile = fopen(argv[4], "wb")))
die("Failed to open %s for writing", argv[4]);
switch (plane)
{
case 1:
- ptr = img->planes[img->fmt==IMG_FMT_YV12? PLANE_V : PLANE_U];
+ ptr = img->planes[img->fmt==VPX_IMG_FMT_YV12? PLANE_V : PLANE_U];
break;
case 2:
- ptr = img->planes[img->fmt==IMG_FMT_YV12?PLANE_U : PLANE_V];
+ ptr = img->planes[img->fmt==VPX_IMG_FMT_YV12?PLANE_U : PLANE_V];
break;
default:
ptr = img->planes[plane];
SHOW(kf_max_dist);
}
- vpx_img_alloc(&raw, arg_use_i420 ? IMG_FMT_I420 : IMG_FMT_YV12,
+ vpx_img_alloc(&raw, arg_use_i420 ? VPX_IMG_FMT_I420 : VPX_IMG_FMT_YV12,
cfg.g_w, cfg.g_h, 1);
// This was added so that ivfenc will create monotically increasing
{
switch (img->fmt)
{
- case IMG_FMT_YV12:
- case IMG_FMT_I420:
- case IMG_FMT_VPXI420:
- case IMG_FMT_VPXYV12:
+ case VPX_IMG_FMT_YV12:
+ case VPX_IMG_FMT_I420:
+ case VPX_IMG_FMT_VPXI420:
+ case VPX_IMG_FMT_VPXYV12:
break;
default:
ERROR("Invalid image format. Only YV12 and I420 images are supported");
yv12->uv_stride = img->stride[PLANE_U];
yv12->border = (img->stride[PLANE_Y] - img->w) / 2;
- yv12->clrtype = (img->fmt == IMG_FMT_VPXI420 || img->fmt == IMG_FMT_VPXYV12); //REG_YUV = 0
+ yv12->clrtype = (img->fmt == VPX_IMG_FMT_VPXI420 || img->fmt == VPX_IMG_FMT_VPXYV12); //REG_YUV = 0
return res;
}
{
/*
- vpx_img_wrap(&ctx->preview_img, IMG_FMT_YV12,
+ vpx_img_wrap(&ctx->preview_img, VPX_IMG_FMT_YV12,
sd.y_width + 2*VP8BORDERINPIXELS,
sd.y_height + 2*VP8BORDERINPIXELS,
1,
ctx->preview_img.planes[PLANE_V] = sd.v_buffer;
if (sd.clrtype == REG_YUV)
- ctx->preview_img.fmt = IMG_FMT_I420;
+ ctx->preview_img.fmt = VPX_IMG_FMT_I420;
else
- ctx->preview_img.fmt = IMG_FMT_VPXI420;
+ ctx->preview_img.fmt = VPX_IMG_FMT_VPXI420;
ctx->preview_img.x_chroma_shift = 1;
ctx->preview_img.y_chroma_shift = 1;
unsigned int a_w = (sd.y_width + 15) & ~15;
unsigned int a_h = (sd.y_height + 15) & ~15;
- vpx_img_wrap(&ctx->img, IMG_FMT_I420,
+ vpx_img_wrap(&ctx->img, VPX_IMG_FMT_I420,
a_w + 2 * VP8BORDERINPIXELS,
a_h + 2 * VP8BORDERINPIXELS,
1,
yv12->uv_stride = img->stride[PLANE_U];
yv12->border = (img->stride[PLANE_Y] - img->d_w) / 2;
- yv12->clrtype = (img->fmt == IMG_FMT_VPXI420 || img->fmt == IMG_FMT_VPXYV12);
+ yv12->clrtype = (img->fmt == VPX_IMG_FMT_VPXI420 || img->fmt == VPX_IMG_FMT_VPXYV12);
return res;
}
#include "vpx_codec/vpx_image.h"
static vpx_image_t *img_alloc_helper(vpx_image_t *img,
- img_fmt_t fmt,
+ vpx_img_fmt_t fmt,
unsigned int d_w,
unsigned int d_h,
unsigned int stride_align,
/* Get sample size for this format */
switch (fmt)
{
- case IMG_FMT_RGB32:
- case IMG_FMT_RGB32_LE:
- case IMG_FMT_ARGB:
- case IMG_FMT_ARGB_LE:
+ case VPX_IMG_FMT_RGB32:
+ case VPX_IMG_FMT_RGB32_LE:
+ case VPX_IMG_FMT_ARGB:
+ case VPX_IMG_FMT_ARGB_LE:
bps = 32;
break;
- case IMG_FMT_RGB24:
- case IMG_FMT_BGR24:
+ case VPX_IMG_FMT_RGB24:
+ case VPX_IMG_FMT_BGR24:
bps = 24;
break;
- case IMG_FMT_RGB565:
- case IMG_FMT_RGB565_LE:
- case IMG_FMT_RGB555:
- case IMG_FMT_RGB555_LE:
- case IMG_FMT_UYVY:
- case IMG_FMT_YUY2:
- case IMG_FMT_YVYU:
+ case VPX_IMG_FMT_RGB565:
+ case VPX_IMG_FMT_RGB565_LE:
+ case VPX_IMG_FMT_RGB555:
+ case VPX_IMG_FMT_RGB555_LE:
+ case VPX_IMG_FMT_UYVY:
+ case VPX_IMG_FMT_YUY2:
+ case VPX_IMG_FMT_YVYU:
bps = 16;
break;
- case IMG_FMT_I420:
- case IMG_FMT_YV12:
- case IMG_FMT_VPXI420:
- case IMG_FMT_VPXYV12:
+ case VPX_IMG_FMT_I420:
+ case VPX_IMG_FMT_YV12:
+ case VPX_IMG_FMT_VPXI420:
+ case VPX_IMG_FMT_VPXYV12:
bps = 12;
break;
default:
/* Get chroma shift values for this format */
switch (fmt)
{
- case IMG_FMT_I420:
- case IMG_FMT_YV12:
- case IMG_FMT_VPXI420:
- case IMG_FMT_VPXYV12:
+ case VPX_IMG_FMT_I420:
+ case VPX_IMG_FMT_YV12:
+ case VPX_IMG_FMT_VPXI420:
+ case VPX_IMG_FMT_VPXYV12:
xcs = 1;
break;
default:
switch (fmt)
{
- case IMG_FMT_I420:
- case IMG_FMT_YV12:
- case IMG_FMT_VPXI420:
- case IMG_FMT_VPXYV12:
+ case VPX_IMG_FMT_I420:
+ case VPX_IMG_FMT_YV12:
+ case VPX_IMG_FMT_VPXI420:
+ case VPX_IMG_FMT_VPXYV12:
ycs = 1;
break;
default:
w = (d_w + align) & ~align;
align = (1 << ycs) - 1;
h = (d_h + align) & ~align;
- s = (fmt & IMG_FMT_PLANAR) ? w : bps * w / 8;
+ s = (fmt & VPX_IMG_FMT_PLANAR) ? w : bps * w / 8;
s = (s + stride_align - 1) & ~(stride_align - 1);
/* Allocate the new image */
if (!img_data)
{
- img->img_data = malloc((fmt & IMG_FMT_PLANAR) ? h * w * bps / 8 : h * s);
+ img->img_data = malloc((fmt & VPX_IMG_FMT_PLANAR) ? h * w * bps / 8 : h * s);
img->img_data_owner = 1;
}
}
vpx_image_t *vpx_img_alloc(vpx_image_t *img,
- img_fmt_t fmt,
+ vpx_img_fmt_t fmt,
unsigned int d_w,
unsigned int d_h,
unsigned int stride_align)
}
vpx_image_t *vpx_img_wrap(vpx_image_t *img,
- img_fmt_t fmt,
+ vpx_img_fmt_t fmt,
unsigned int d_w,
unsigned int d_h,
unsigned int stride_align,
img->d_h = h;
/* Calculate plane pointers */
- if (!(img->fmt & IMG_FMT_PLANAR))
+ if (!(img->fmt & VPX_IMG_FMT_PLANAR))
{
img->planes[PLANE_PACKED] =
img->img_data + x * img->bps / 8 + y * img->stride[PLANE_PACKED];
{
data = img->img_data;
- if (img->fmt & IMG_FMT_HAS_ALPHA)
+ if (img->fmt & VPX_IMG_FMT_HAS_ALPHA)
{
img->planes[PLANE_ALPHA] =
data + x + y * img->stride[PLANE_ALPHA];
img->planes[PLANE_Y] = data + x + y * img->stride[PLANE_Y];
data += img->h * img->stride[PLANE_Y];
- if (!(img->fmt & IMG_FMT_UV_FLIP))
+ if (!(img->fmt & VPX_IMG_FMT_UV_FLIP))
{
img->planes[PLANE_U] = data
+ (x >> img->x_chroma_shift)
#define VPX_IMAGE_ABI_VERSION (1) /**<\hideinitializer*/
-#define IMG_FMT_PLANAR 0x100 /**< Image is a planar format */
-#define IMG_FMT_UV_FLIP 0x200 /**< V plane precedes U plane in memory */
-#define IMG_FMT_HAS_ALPHA 0x400 /**< Image has an alpha channel componnent */
+#define VPX_IMG_FMT_PLANAR 0x100 /**< Image is a planar format */
+#define VPX_IMG_FMT_UV_FLIP 0x200 /**< V plane precedes U plane in memory */
+#define VPX_IMG_FMT_HAS_ALPHA 0x400 /**< Image has an alpha channel componnent */
/*!\brief List of supported image formats */
- typedef enum img_fmt {
- IMG_FMT_NONE,
- IMG_FMT_RGB24, /**< 24 bit per pixel packed RGB */
- IMG_FMT_RGB32, /**< 32 bit per pixel packed 0RGB */
- IMG_FMT_RGB565, /**< 16 bit per pixel, 565 */
- IMG_FMT_RGB555, /**< 16 bit per pixel, 555 */
- IMG_FMT_UYVY, /**< UYVY packed YUV */
- IMG_FMT_YUY2, /**< YUYV packed YUV */
- IMG_FMT_YVYU, /**< YVYU packed YUV */
- IMG_FMT_BGR24, /**< 24 bit per pixel packed BGR */
- IMG_FMT_RGB32_LE, /**< 32 bit packed BGR0 */
- IMG_FMT_ARGB, /**< 32 bit packed ARGB, alpha=255 */
- IMG_FMT_ARGB_LE, /**< 32 bit packed BGRA, alpha=255 */
- IMG_FMT_RGB565_LE, /**< 16 bit per pixel, gggbbbbb rrrrrggg */
- IMG_FMT_RGB555_LE, /**< 16 bit per pixel, gggbbbbb 0rrrrrgg */
- IMG_FMT_YV12 = IMG_FMT_PLANAR | IMG_FMT_UV_FLIP | 1, /**< planar YVU */
- IMG_FMT_I420 = IMG_FMT_PLANAR | 2,
- IMG_FMT_VPXYV12 = IMG_FMT_PLANAR | IMG_FMT_UV_FLIP | 3, /** < planar 4:2:0 format with vpx color space */
- IMG_FMT_VPXI420 = IMG_FMT_PLANAR | 4, /** < planar 4:2:0 format with vpx color space */
+ typedef enum vpx_img_fmt {
+ VPX_IMG_FMT_NONE,
+ VPX_IMG_FMT_RGB24, /**< 24 bit per pixel packed RGB */
+ VPX_IMG_FMT_RGB32, /**< 32 bit per pixel packed 0RGB */
+ VPX_IMG_FMT_RGB565, /**< 16 bit per pixel, 565 */
+ VPX_IMG_FMT_RGB555, /**< 16 bit per pixel, 555 */
+ VPX_IMG_FMT_UYVY, /**< UYVY packed YUV */
+ VPX_IMG_FMT_YUY2, /**< YUYV packed YUV */
+ VPX_IMG_FMT_YVYU, /**< YVYU packed YUV */
+ VPX_IMG_FMT_BGR24, /**< 24 bit per pixel packed BGR */
+ VPX_IMG_FMT_RGB32_LE, /**< 32 bit packed BGR0 */
+ VPX_IMG_FMT_ARGB, /**< 32 bit packed ARGB, alpha=255 */
+ VPX_IMG_FMT_ARGB_LE, /**< 32 bit packed BGRA, alpha=255 */
+ VPX_IMG_FMT_RGB565_LE, /**< 16 bit per pixel, gggbbbbb rrrrrggg */
+ VPX_IMG_FMT_RGB555_LE, /**< 16 bit per pixel, gggbbbbb 0rrrrrgg */
+ VPX_IMG_FMT_YV12 = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_UV_FLIP | 1, /**< planar YVU */
+ VPX_IMG_FMT_I420 = VPX_IMG_FMT_PLANAR | 2,
+ VPX_IMG_FMT_VPXYV12 = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_UV_FLIP | 3, /** < planar 4:2:0 format with vpx color space */
+ VPX_IMG_FMT_VPXI420 = VPX_IMG_FMT_PLANAR | 4, /** < planar 4:2:0 format with vpx color space */
}
- img_fmt_t; /**< alias for enum img_fmt */
+ vpx_img_fmt_t; /**< alias for enum vpx_img_fmt */
/**\brief Image Descriptor */
typedef struct vpx_image
{
- img_fmt_t fmt; /**< Image Format */
+ vpx_img_fmt_t fmt; /**< Image Format */
/* Image storage dimensions */
unsigned int w; /**< Stored image width */
* returned.
*/
vpx_image_t *vpx_img_alloc(vpx_image_t *img,
- img_fmt_t fmt,
+ vpx_img_fmt_t fmt,
unsigned int d_w,
unsigned int d_h,
unsigned int align);
* returned.
*/
vpx_image_t *vpx_img_wrap(vpx_image_t *img,
- img_fmt_t fmt,
+ vpx_img_fmt_t fmt,
unsigned int d_w,
unsigned int d_h,
unsigned int align,