mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-06 16:56:55 +08:00
BUG=none TEST=none Review URL: https://webrtc-codereview.appspot.com/635006 git-svn-id: http://libyuv.googlecode.com/svn/trunk@280 16f28f9a-4ce2-e073-06de-1de4eb20be90
267 lines
9.5 KiB
C++
267 lines
9.5 KiB
C++
/*
|
|
* Copyright (c) 2011 The LibYuv project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#ifndef INCLUDE_LIBYUV_PLANAR_FUNCTIONS_H_
|
|
#define INCLUDE_LIBYUV_PLANAR_FUNCTIONS_H_
|
|
|
|
#include "libyuv/basic_types.h"
|
|
|
|
// TODO(fbarchard): Remove the following headers includes
|
|
#include "libyuv/convert.h"
|
|
#include "libyuv/planar_functions.h"
|
|
|
|
#ifdef __cplusplus
|
|
namespace libyuv {
|
|
extern "C" {
|
|
#endif
|
|
|
|
void SetPlane(uint8* dst_y, int dst_stride_y,
|
|
int width, int height,
|
|
uint32 value);
|
|
|
|
// Copy a plane of data (I420 to I400).
|
|
void CopyPlane(const uint8* src_y, int src_stride_y,
|
|
uint8* dst_y, int dst_stride_y,
|
|
int width, int height);
|
|
|
|
// Convert I420 to I400. (calls CopyPlane ignoring u/v)
|
|
int I420ToI400(const uint8* src_y, int src_stride_y,
|
|
uint8* dst_y, int dst_stride_y,
|
|
uint8* dst_u, int dst_stride_u,
|
|
uint8* dst_v, int dst_stride_v,
|
|
int width, int height);
|
|
|
|
// I420 mirror.
|
|
int I420Mirror(const uint8* src_y, int src_stride_y,
|
|
const uint8* src_u, int src_stride_u,
|
|
const uint8* src_v, int src_stride_v,
|
|
uint8* dst_y, int dst_stride_y,
|
|
uint8* dst_u, int dst_stride_u,
|
|
uint8* dst_v, int dst_stride_v,
|
|
int width, int height);
|
|
|
|
// Convert NV12 to ARGB. Also used for NV21.
|
|
int NV12ToARGB(const uint8* src_y, int src_stride_y,
|
|
const uint8* src_uv, int src_stride_uv,
|
|
uint8* dst_frame, int dst_stride_frame,
|
|
int width, int height);
|
|
|
|
// Convert NV12 to RGB565. Also used for NV21.
|
|
int NV12ToRGB565(const uint8* src_y, int src_stride_y,
|
|
const uint8* src_uv, int src_stride_uv,
|
|
uint8* dst_frame, int dst_stride_frame,
|
|
int width, int height);
|
|
|
|
// Convert YUY2 to ARGB.
|
|
int YUY2ToARGB(const uint8* src_yuy2, int src_stride_yuy2,
|
|
uint8* dst_argb, int dst_stride_argb,
|
|
int width, int height);
|
|
|
|
// Convert UYVY to ARGB.
|
|
int UYVYToARGB(const uint8* src_uyvy, int src_stride_uyvy,
|
|
uint8* dst_argb, int dst_stride_argb,
|
|
int width, int height);
|
|
|
|
// Convert I444 to ARGB.
|
|
int I444ToARGB(const uint8* src_y, int src_stride_y,
|
|
const uint8* src_u, int src_stride_u,
|
|
const uint8* src_v, int src_stride_v,
|
|
uint8* dst_argb, int dst_stride_argb,
|
|
int width, int height);
|
|
|
|
// Convert I422 to ARGB.
|
|
int I422ToARGB(const uint8* src_y, int src_stride_y,
|
|
const uint8* src_u, int src_stride_u,
|
|
const uint8* src_v, int src_stride_v,
|
|
uint8* dst_argb, int dst_stride_argb,
|
|
int width, int height);
|
|
|
|
// Convert I411 to ARGB.
|
|
int I411ToARGB(const uint8* src_y, int src_stride_y,
|
|
const uint8* src_u, int src_stride_u,
|
|
const uint8* src_v, int src_stride_v,
|
|
uint8* dst_argb, int dst_stride_argb,
|
|
int width, int height);
|
|
|
|
// Convert I400 to ARGB.
|
|
int I400ToARGB(const uint8* src_y, int src_stride_y,
|
|
uint8* dst_argb, int dst_stride_argb,
|
|
int width, int height);
|
|
|
|
// Convert I400 to ARGB. Reverse of ARGBToI400.
|
|
int I400ToARGB_Reference(const uint8* src_y, int src_stride_y,
|
|
uint8* dst_argb, int dst_stride_argb,
|
|
int width, int height);
|
|
|
|
// Convert RAW to ARGB.
|
|
int RAWToARGB(const uint8* src_raw, int src_stride_raw,
|
|
uint8* dst_argb, int dst_stride_argb,
|
|
int width, int height);
|
|
|
|
// Deprecated function name.
|
|
#define BG24ToARGB RGB24ToARGB
|
|
|
|
// Convert RGB24 to ARGB.
|
|
int RGB24ToARGB(const uint8* src_bg24, int src_stride_bg24,
|
|
uint8* dst_argb, int dst_stride_argb,
|
|
int width, int height);
|
|
|
|
// Convert ABGR to ARGB. Also used for ARGB to ABGR.
|
|
int ABGRToARGB(const uint8* src_abgr, int src_stride_abgr,
|
|
uint8* dst_argb, int dst_stride_argb,
|
|
int width, int height);
|
|
|
|
// Aliases.
|
|
#define ARGBToBGRA BGRAToARGB
|
|
#define ARGBToABGR ABGRToARGB
|
|
#define ARGBToARGB ARGBCopy
|
|
|
|
// Convert BGRA to ARGB. Also used for ARGB to BGRA.
|
|
int BGRAToARGB(const uint8* src_bgra, int src_stride_bgra,
|
|
uint8* dst_argb, int dst_stride_argb,
|
|
int width, int height);
|
|
|
|
// Convert ARGB To RGB24.
|
|
int ARGBToRGB24(const uint8* src_argb, int src_stride_argb,
|
|
uint8* dst_rgb24, int dst_stride_rgb24,
|
|
int width, int height);
|
|
|
|
// Convert ARGB To RAW.
|
|
int ARGBToRAW(const uint8* src_argb, int src_stride_argb,
|
|
uint8* dst_rgb, int dst_stride_rgb,
|
|
int width, int height);
|
|
|
|
// Convert ARGB To RGB565.
|
|
int ARGBToRGB565(const uint8* src_argb, int src_stride_argb,
|
|
uint8* dst_rgb565, int dst_stride_rgb565,
|
|
int width, int height);
|
|
|
|
// Convert ARGB To ARGB1555.
|
|
int ARGBToARGB1555(const uint8* src_argb, int src_stride_argb,
|
|
uint8* dst_argb1555, int dst_stride_argb1555,
|
|
int width, int height);
|
|
|
|
// Convert ARGB To ARGB4444.
|
|
int ARGBToARGB4444(const uint8* src_argb, int src_stride_argb,
|
|
uint8* dst_argb4444, int dst_stride_argb4444,
|
|
int width, int height);
|
|
|
|
// Convert RGB565 To ARGB.
|
|
int RGB565ToARGB(const uint8* src_rgb565, int src_stride_rgb565,
|
|
uint8* dst_argb, int dst_stride_argb,
|
|
int width, int height);
|
|
|
|
// Convert ARGB1555 To ARGB.
|
|
int ARGB1555ToARGB(const uint8* src_argb1555, int src_stride_argb1555,
|
|
uint8* dst_argb, int dst_stride_argb,
|
|
int width, int height);
|
|
|
|
// Convert ARGB4444 To ARGB.
|
|
int ARGB4444ToARGB(const uint8* src_argb4444, int src_stride_argb4444,
|
|
uint8* dst_argb, int dst_stride_argb,
|
|
int width, int height);
|
|
|
|
// Convert ARGB to I400.
|
|
int ARGBToI400(const uint8* src_argb, int src_stride_argb,
|
|
uint8* dst_y, int dst_stride_y,
|
|
int width, int height);
|
|
|
|
// ARGB little endian (bgra in memory) to I422
|
|
int ARGBToI422(const uint8* src_frame, int src_stride_frame,
|
|
uint8* dst_y, int dst_stride_y,
|
|
uint8* dst_u, int dst_stride_u,
|
|
uint8* dst_v, int dst_stride_v,
|
|
int width, int height);
|
|
|
|
// Draw a rectangle into I420.
|
|
int I420Rect(uint8* dst_y, int dst_stride_y,
|
|
uint8* dst_u, int dst_stride_u,
|
|
uint8* dst_v, int dst_stride_v,
|
|
int x, int y,
|
|
int width, int height,
|
|
int value_y, int value_u, int value_v);
|
|
|
|
// Draw a rectangle into ARGB.
|
|
int ARGBRect(uint8* dst_argb, int dst_stride_argb,
|
|
int x, int y,
|
|
int width, int height,
|
|
uint32 value);
|
|
|
|
// Make a rectangle of ARGB gray scale.
|
|
int ARGBGray(uint8* dst_argb, int dst_stride_argb,
|
|
int x, int y,
|
|
int width, int height);
|
|
|
|
// Make a rectangle of ARGB Sepia tone.
|
|
int ARGBSepia(uint8* dst_argb, int dst_stride_argb,
|
|
int x, int y,
|
|
int width, int height);
|
|
|
|
// Copy ARGB to ARGB.
|
|
int ARGBCopy(const uint8* src_argb, int src_stride_argb,
|
|
uint8* dst_argb, int dst_stride_argb,
|
|
int width, int height);
|
|
|
|
typedef void (*ARGBBlendRow)(const uint8* src_argb0,
|
|
const uint8* src_argb1,
|
|
uint8* dst_argb, int width);
|
|
|
|
// Get function to Alpha Blend ARGB pixels and store to destination.
|
|
ARGBBlendRow GetARGBBlend(uint8* dst_argb, int dst_stride_argb, int width);
|
|
|
|
// Alpha Blend ARGB images and store to destination.
|
|
int ARGBBlend(const uint8* src_argb0, int src_stride_argb0,
|
|
const uint8* src_argb1, int src_stride_argb1,
|
|
uint8* dst_argb, int dst_stride_argb,
|
|
int width, int height);
|
|
|
|
// Convert I422 to YUY2.
|
|
int I422ToYUY2(const uint8* src_y, int src_stride_y,
|
|
const uint8* src_u, int src_stride_u,
|
|
const uint8* src_v, int src_stride_v,
|
|
uint8* dst_frame, int dst_stride_frame,
|
|
int width, int height);
|
|
|
|
// Convert I422 to UYVY.
|
|
int I422ToUYVY(const uint8* src_y, int src_stride_y,
|
|
const uint8* src_u, int src_stride_u,
|
|
const uint8* src_v, int src_stride_v,
|
|
uint8* dst_frame, int dst_stride_frame,
|
|
int width, int height);
|
|
|
|
// Convert unattentuated ARGB to preattenuated ARGB.
|
|
int ARGBAttenuate(const uint8* src_argb, int src_stride_argb,
|
|
uint8* dst_argb, int dst_stride_argb,
|
|
int width, int height);
|
|
|
|
// Convert preattentuated ARGB to unattenuated ARGB.
|
|
int ARGBUnattenuate(const uint8* src_argb, int src_stride_argb,
|
|
uint8* dst_argb, int dst_stride_argb,
|
|
int width, int height);
|
|
|
|
// Get function to add or subtract rows of bytes to a 16 bit buffer. For blur.
|
|
typedef void (*AddRow)(const uint8* src, uint16* dst, int width);
|
|
AddRow GetAddRow(uint16* dst, int width);
|
|
AddRow GetSubRow(uint16* dst, int width);
|
|
|
|
// Convert MJPG to ARGB.
|
|
int MJPGToARGB(const uint8* sample,
|
|
size_t sample_size,
|
|
uint8* argb, int argb_stride,
|
|
int w, int h,
|
|
int dw, int dh);
|
|
|
|
#ifdef __cplusplus
|
|
} // extern "C"
|
|
} // namespace libyuv
|
|
#endif
|
|
|
|
#endif // INCLUDE_LIBYUV_PLANAR_FUNCTIONS_H_
|