mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-06 16:56:55 +08:00
shuffle functions so convert.h is all formats to I420 and convert_from.h is from I420 to all formats
BUG=none TEST=none Review URL: https://webrtc-codereview.appspot.com/395006 git-svn-id: http://libyuv.googlecode.com/svn/trunk@174 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
032b5f990f
commit
2d11d43a6e
@ -1,6 +1,6 @@
|
|||||||
Name: libyuv
|
Name: libyuv
|
||||||
URL: http://code.google.com/p/libyuv/
|
URL: http://code.google.com/p/libyuv/
|
||||||
Version: 173
|
Version: 174
|
||||||
License: BSD
|
License: BSD
|
||||||
License File: LICENSE
|
License File: LICENSE
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
#include "libyuv/basic_types.h"
|
#include "libyuv/basic_types.h"
|
||||||
#include "libyuv/compare.h"
|
#include "libyuv/compare.h"
|
||||||
#include "libyuv/convert.h"
|
#include "libyuv/convert.h"
|
||||||
|
#include "libyuv/convert_from.h"
|
||||||
#include "libyuv/cpu_id.h"
|
#include "libyuv/cpu_id.h"
|
||||||
#include "libyuv/format_conversion.h"
|
#include "libyuv/format_conversion.h"
|
||||||
#include "libyuv/planar_functions.h"
|
#include "libyuv/planar_functions.h"
|
||||||
|
|||||||
@ -12,6 +12,7 @@
|
|||||||
#define INCLUDE_LIBYUV_CONVERT_H_
|
#define INCLUDE_LIBYUV_CONVERT_H_
|
||||||
|
|
||||||
#include "libyuv/basic_types.h"
|
#include "libyuv/basic_types.h"
|
||||||
|
#include "libyuv/planar_functions.h"
|
||||||
#include "libyuv/rotate.h"
|
#include "libyuv/rotate.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -19,117 +20,142 @@ namespace libyuv {
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// RGB24 is also known as 24BG and BGR3
|
// Copy I420 to I420.
|
||||||
int I420ToRGB24(const uint8* src_y, int src_stride_y,
|
int I420Copy(const uint8* src_y, int src_stride_y,
|
||||||
const uint8* src_u, int src_stride_u,
|
const uint8* src_u, int src_stride_u,
|
||||||
const uint8* src_v, int src_stride_v,
|
const uint8* src_v, int src_stride_v,
|
||||||
uint8* dst_frame, int dst_stride_frame,
|
uint8* dst_y, int dst_stride_y,
|
||||||
int width, int height);
|
uint8* dst_u, int dst_stride_u,
|
||||||
|
uint8* dst_v, int dst_stride_v,
|
||||||
|
int width, int height);
|
||||||
|
|
||||||
// RAW is also known as RGB3
|
// Convert I422 to I420.
|
||||||
int I420ToRAW(const uint8* src_y, int src_stride_y,
|
int I422ToI420(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);
|
|
||||||
|
|
||||||
int I420ToARGB4444(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);
|
|
||||||
|
|
||||||
int I420ToRGB565(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);
|
|
||||||
|
|
||||||
int I420ToARGB1555(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);
|
|
||||||
|
|
||||||
int I420ToYUY2(const uint8* src_y, int src_stride_y,
|
|
||||||
const uint8* src_u, int src_stride_u,
|
const uint8* src_u, int src_stride_u,
|
||||||
const uint8* src_v, int src_stride_v,
|
const uint8* src_v, int src_stride_v,
|
||||||
uint8* dst_frame, int dst_stride_frame,
|
|
||||||
int width, int height);
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
int I420ToUYVY(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);
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
int I420ToV210(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);
|
|
||||||
|
|
||||||
|
|
||||||
int RGB24ToI420(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);
|
|
||||||
|
|
||||||
int RAWToI420(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);
|
|
||||||
|
|
||||||
int RGB565ToI420(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);
|
|
||||||
|
|
||||||
int ARGB1555ToI420(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);
|
|
||||||
|
|
||||||
int ARGB4444ToI420(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);
|
|
||||||
|
|
||||||
int ABGRToI420(const uint8* src_frame, int src_stride_frame,
|
|
||||||
uint8* dst_y, int dst_stride_y,
|
uint8* dst_y, int dst_stride_y,
|
||||||
uint8* dst_u, int dst_stride_u,
|
uint8* dst_u, int dst_stride_u,
|
||||||
uint8* dst_v, int dst_stride_v,
|
uint8* dst_v, int dst_stride_v,
|
||||||
int width, int height);
|
int width, int height);
|
||||||
|
|
||||||
|
// Convert I444 to I420.
|
||||||
|
int I444ToI420(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 I400 (grey) to I420.
|
||||||
|
int I400ToI420(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);
|
||||||
|
|
||||||
|
// Convert NV12 to I420. Also used for NV21.
|
||||||
|
int NV12ToI420(const uint8* src_y, int src_stride_y,
|
||||||
|
const uint8* src_uv, int src_stride_uv,
|
||||||
|
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 M420 to I420.
|
||||||
|
int M420ToI420(const uint8* src_m420, int src_stride_m420,
|
||||||
|
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 Q420 to I420.
|
||||||
|
int Q420ToI420(const uint8* src_y, int src_stride_y,
|
||||||
|
const uint8* src_yuy2, int src_stride_yuy2,
|
||||||
|
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 YUY2 to I420.
|
||||||
|
int YUY2ToI420(const uint8* src_yuy2, int src_stride_yuy2,
|
||||||
|
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 UYVY to I420.
|
||||||
|
int UYVYToI420(const uint8* src_uyvy, int src_stride_uyvy,
|
||||||
|
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 V210 to I420.
|
||||||
|
int V210ToI420(const uint8* src_uyvy, int src_stride_uyvy,
|
||||||
|
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);
|
||||||
|
|
||||||
|
// ARGB little endian (bgra in memory) to I420
|
||||||
|
int ARGBToI420(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);
|
||||||
|
|
||||||
|
// BGRA little endian (argb in memory) to I420
|
||||||
int BGRAToI420(const uint8* src_frame, int src_stride_frame,
|
int BGRAToI420(const uint8* src_frame, int src_stride_frame,
|
||||||
uint8* dst_y, int dst_stride_y,
|
uint8* dst_y, int dst_stride_y,
|
||||||
uint8* dst_u, int dst_stride_u,
|
uint8* dst_u, int dst_stride_u,
|
||||||
uint8* dst_v, int dst_stride_v,
|
uint8* dst_v, int dst_stride_v,
|
||||||
int width, int height);
|
int width, int height);
|
||||||
|
|
||||||
int ARGBToI420(const uint8* src_frame, int src_stride_frame,
|
// ABGR little endian (rgba in memory) to I420
|
||||||
|
int ABGRToI420(const uint8* src_frame, int src_stride_frame,
|
||||||
uint8* dst_y, int dst_stride_y,
|
uint8* dst_y, int dst_stride_y,
|
||||||
uint8* dst_u, int dst_stride_u,
|
uint8* dst_u, int dst_stride_u,
|
||||||
uint8* dst_v, int dst_stride_v,
|
uint8* dst_v, int dst_stride_v,
|
||||||
int width, int height);
|
int width, int height);
|
||||||
|
|
||||||
|
// RGB little endian (bgr in memory) to I420
|
||||||
|
int RGB24ToI420(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);
|
||||||
|
|
||||||
|
// RGB big endian (rgb in memory) to I420
|
||||||
|
int RAWToI420(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);
|
||||||
|
|
||||||
|
// RGB16 (RGBP fourcc) little endian to I420
|
||||||
|
int RGB565ToI420(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);
|
||||||
|
|
||||||
|
// RGB15 (RGBO fourcc) little endian to I420
|
||||||
|
int ARGB1555ToI420(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);
|
||||||
|
|
||||||
|
// RGB12 (R444 fourcc) little endian to I420
|
||||||
|
int ARGB4444ToI420(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);
|
||||||
|
|
||||||
|
// Note Bayer formats (BGGR) To I420 are in format_conversion.h
|
||||||
|
|
||||||
// Convert camera sample to I420 with cropping, rotation and vertical flip.
|
// Convert camera sample to I420 with cropping, rotation and vertical flip.
|
||||||
// "src_size" is needed to parse MJPG.
|
// "src_size" is needed to parse MJPG.
|
||||||
// "dst_stride_y" number of bytes in a row of the dst_y plane.
|
// "dst_stride_y" number of bytes in a row of the dst_y plane.
|
||||||
@ -162,16 +188,6 @@ int ConvertToI420(const uint8* src_frame, size_t src_size,
|
|||||||
RotationMode rotation,
|
RotationMode rotation,
|
||||||
uint32 format);
|
uint32 format);
|
||||||
|
|
||||||
// Convert I420 to specified format.
|
|
||||||
// "dst_sample_stride" is bytes in a row for the destination. Pass 0 if the
|
|
||||||
// buffer has contiguous rows. Can be negative. A multiple of 16 is optimal.
|
|
||||||
int ConvertFromI420(const uint8* y, int y_stride,
|
|
||||||
const uint8* u, int u_stride,
|
|
||||||
const uint8* v, int v_stride,
|
|
||||||
uint8* dst_sample, int dst_sample_stride,
|
|
||||||
int width, int height,
|
|
||||||
uint32 format);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
} // namespace libyuv
|
} // namespace libyuv
|
||||||
|
|||||||
134
include/libyuv/convert_from.h
Normal file
134
include/libyuv/convert_from.h
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
/*
|
||||||
|
* 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_CONVERT_FROM_H_
|
||||||
|
#define INCLUDE_LIBYUV_CONVERT_FROM_H_
|
||||||
|
|
||||||
|
#include "libyuv/basic_types.h"
|
||||||
|
#include "libyuv/rotate.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
namespace libyuv {
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// See Also convert.h for conversions from formats to I420
|
||||||
|
|
||||||
|
// I420Copy in convert to I420ToI420
|
||||||
|
|
||||||
|
int I420ToI422(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);
|
||||||
|
|
||||||
|
int I420ToI444(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);
|
||||||
|
|
||||||
|
// Copy to I400. Source can be I420,422,444,400,NV12,NV21
|
||||||
|
int I400Copy(const uint8* src_y, int src_stride_y,
|
||||||
|
uint8* dst_y, int dst_stride_y,
|
||||||
|
int width, int height);
|
||||||
|
|
||||||
|
// TODO(fbarchard): I420ToNV12
|
||||||
|
// TODO(fbarchard): I420ToM420
|
||||||
|
// TODO(fbarchard): I420ToQ420
|
||||||
|
|
||||||
|
int I420ToYUY2(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);
|
||||||
|
|
||||||
|
int I420ToUYVY(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);
|
||||||
|
|
||||||
|
int I420ToV210(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);
|
||||||
|
|
||||||
|
int I420ToARGB(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);
|
||||||
|
|
||||||
|
int I420ToBGRA(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);
|
||||||
|
|
||||||
|
int I420ToABGR(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);
|
||||||
|
|
||||||
|
int I420ToRGB24(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);
|
||||||
|
|
||||||
|
int I420ToRAW(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);
|
||||||
|
|
||||||
|
int I420ToRGB565(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);
|
||||||
|
|
||||||
|
int I420ToARGB1555(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);
|
||||||
|
|
||||||
|
int I420ToARGB4444(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);
|
||||||
|
|
||||||
|
// Note Bayer formats (BGGR) To I420 are in format_conversion.h
|
||||||
|
|
||||||
|
// Convert I420 to specified format.
|
||||||
|
// "dst_sample_stride" is bytes in a row for the destination. Pass 0 if the
|
||||||
|
// buffer has contiguous rows. Can be negative. A multiple of 16 is optimal.
|
||||||
|
int ConvertFromI420(const uint8* y, int y_stride,
|
||||||
|
const uint8* u, int u_stride,
|
||||||
|
const uint8* v, int v_stride,
|
||||||
|
uint8* dst_sample, int dst_sample_stride,
|
||||||
|
int width, int height,
|
||||||
|
uint32 format);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} // extern "C"
|
||||||
|
} // namespace libyuv
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // INCLUDE_LIBYUV_CONVERT_FROM_H_
|
||||||
@ -18,14 +18,14 @@ namespace libyuv {
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Copy I420 to I420.
|
void SetPlane(uint8* dst_y, int dst_stride_y,
|
||||||
int I420Copy(const uint8* src_y, int src_stride_y,
|
int width, int height,
|
||||||
const uint8* src_u, int src_stride_u,
|
uint32 value);
|
||||||
const uint8* src_v, int src_stride_v,
|
|
||||||
uint8* dst_y, int dst_stride_y,
|
// Copy a plane of data (I420 to I400)
|
||||||
uint8* dst_u, int dst_stride_u,
|
void CopyPlane(const uint8* src_y, int src_stride_y,
|
||||||
uint8* dst_v, int dst_stride_v,
|
uint8* dst_y, int dst_stride_y,
|
||||||
int width, int height);
|
int width, int height);
|
||||||
|
|
||||||
// I420 mirror
|
// I420 mirror
|
||||||
int I420Mirror(const uint8* src_y, int src_stride_y,
|
int I420Mirror(const uint8* src_y, int src_stride_y,
|
||||||
@ -36,49 +36,6 @@ int I420Mirror(const uint8* src_y, int src_stride_y,
|
|||||||
uint8* dst_v, int dst_stride_v,
|
uint8* dst_v, int dst_stride_v,
|
||||||
int width, int height);
|
int width, int height);
|
||||||
|
|
||||||
// Convert I422 to I420.
|
|
||||||
int I422ToI420(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 I422 to I420.
|
|
||||||
int I420ToI422(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 I444 to I420.
|
|
||||||
int I444ToI420(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 I420 to I444.
|
|
||||||
int I420ToI444(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 I400 (grey) to I420.
|
|
||||||
int I400ToI420(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);
|
|
||||||
|
|
||||||
// Convert NV12 to ARGB. Also used for NV21.
|
// Convert NV12 to ARGB. Also used for NV21.
|
||||||
int NV12ToARGB(const uint8* src_y, int src_stride_y,
|
int NV12ToARGB(const uint8* src_y, int src_stride_y,
|
||||||
const uint8* src_uv, int src_stride_uv,
|
const uint8* src_uv, int src_stride_uv,
|
||||||
@ -91,76 +48,6 @@ int NV12ToRGB565(const uint8* src_y, int src_stride_y,
|
|||||||
uint8* dst_frame, int dst_stride_frame,
|
uint8* dst_frame, int dst_stride_frame,
|
||||||
int width, int height);
|
int width, int height);
|
||||||
|
|
||||||
// Copy to I400. Source can be I420,422,444,400,NV12,NV21
|
|
||||||
int I400Copy(const uint8* src_y, int src_stride_y,
|
|
||||||
uint8* dst_y, int dst_stride_y,
|
|
||||||
int width, int height);
|
|
||||||
|
|
||||||
// Convert NV12 to I420. Also used for NV21.
|
|
||||||
int NV12ToI420(const uint8* src_y, int src_stride_y,
|
|
||||||
const uint8* src_uv, int src_stride_uv,
|
|
||||||
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 Q420 to I420.
|
|
||||||
int Q420ToI420(const uint8* src_y, int src_stride_y,
|
|
||||||
const uint8* src_yuy2, int src_stride_yuy2,
|
|
||||||
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 M420 to I420.
|
|
||||||
int M420ToI420(const uint8* src_m420, int src_stride_m420,
|
|
||||||
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 YUY2 to I420.
|
|
||||||
int YUY2ToI420(const uint8* src_yuy2, int src_stride_yuy2,
|
|
||||||
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 UYVY to I420.
|
|
||||||
int UYVYToI420(const uint8* src_uyvy, int src_stride_uyvy,
|
|
||||||
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 V210 to I420.
|
|
||||||
int V210ToI420(const uint8* src_uyvy, int src_stride_uyvy,
|
|
||||||
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 I420 to ARGB.
|
|
||||||
int I420ToARGB(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 I420 to BGRA.
|
|
||||||
int I420ToBGRA(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 I420 to ABGR.
|
|
||||||
int I420ToABGR(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.
|
// Convert I422 to ARGB.
|
||||||
int I422ToARGB(const uint8* src_y, int src_stride_y,
|
int I422ToARGB(const uint8* src_y, int src_stride_y,
|
||||||
const uint8* src_u, int src_stride_u,
|
const uint8* src_u, int src_stride_u,
|
||||||
@ -242,9 +129,16 @@ int ARGBCopy(const uint8* src_argb, int src_stride_argb,
|
|||||||
uint8* dst_argb, int dst_stride_argb,
|
uint8* dst_argb, int dst_stride_argb,
|
||||||
int width, int height);
|
int width, int height);
|
||||||
|
|
||||||
// Copy a plane of data
|
int I422ToYUY2(const uint8* src_y, int src_stride_y,
|
||||||
void CopyPlane(const uint8* src_y, int src_stride_y,
|
const uint8* src_u, int src_stride_u,
|
||||||
uint8* dst_y, int dst_stride_y,
|
const uint8* src_v, int src_stride_v,
|
||||||
|
uint8* dst_frame, int dst_stride_frame,
|
||||||
|
int width, int height);
|
||||||
|
|
||||||
|
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);
|
int width, int height);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
#ifndef INCLUDE_LIBYUV_VERSION_H_
|
#ifndef INCLUDE_LIBYUV_VERSION_H_
|
||||||
#define INCLUDE_LIBYUV_VERSION_H_
|
#define INCLUDE_LIBYUV_VERSION_H_
|
||||||
|
|
||||||
#define LIBYUV_VERSION 173
|
#define LIBYUV_VERSION 174
|
||||||
|
|
||||||
#endif // INCLUDE_LIBYUV_VERSION_H_
|
#endif // INCLUDE_LIBYUV_VERSION_H_
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
# includes
|
# includes
|
||||||
'include/libyuv/basic_types.h',
|
'include/libyuv/basic_types.h',
|
||||||
'include/libyuv/convert.h',
|
'include/libyuv/convert.h',
|
||||||
|
'include/libyuv/convert_from.h',
|
||||||
'include/libyuv/scale.h',
|
'include/libyuv/scale.h',
|
||||||
'include/libyuv/planar_functions.h',
|
'include/libyuv/planar_functions.h',
|
||||||
'include/libyuv/video_common.h',
|
'include/libyuv/video_common.h',
|
||||||
@ -37,7 +38,7 @@
|
|||||||
# sources
|
# sources
|
||||||
'source/compare.cc',
|
'source/compare.cc',
|
||||||
'source/convert.cc',
|
'source/convert.cc',
|
||||||
'source/convertfrom.cc',
|
'source/convert_from.cc',
|
||||||
'source/cpu_id.cc',
|
'source/cpu_id.cc',
|
||||||
'source/format_conversion.cc',
|
'source/format_conversion.cc',
|
||||||
'source/planar_functions.cc',
|
'source/planar_functions.cc',
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
1227
source/convert_from.cc
Normal file
1227
source/convert_from.cc
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,239 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "libyuv/convert.h"
|
|
||||||
|
|
||||||
#include "libyuv/basic_types.h"
|
|
||||||
#include "libyuv/format_conversion.h"
|
|
||||||
#include "libyuv/planar_functions.h"
|
|
||||||
#include "libyuv/video_common.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
namespace libyuv {
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Convert I420 to specified format
|
|
||||||
int ConvertFromI420(const uint8* y, int y_stride,
|
|
||||||
const uint8* u, int u_stride,
|
|
||||||
const uint8* v, int v_stride,
|
|
||||||
uint8* dst_sample, int dst_sample_stride,
|
|
||||||
int width, int height,
|
|
||||||
uint32 format) {
|
|
||||||
|
|
||||||
if (y == NULL || u == NULL || v == NULL || dst_sample == NULL) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
switch (format) {
|
|
||||||
// Single plane formats
|
|
||||||
case FOURCC_YUY2:
|
|
||||||
I420ToYUY2(y, y_stride,
|
|
||||||
u, u_stride,
|
|
||||||
v, v_stride,
|
|
||||||
dst_sample,
|
|
||||||
dst_sample_stride ? dst_sample_stride : width * 2,
|
|
||||||
width, height);
|
|
||||||
break;
|
|
||||||
case FOURCC_UYVY:
|
|
||||||
I420ToUYVY(y, y_stride,
|
|
||||||
u, u_stride,
|
|
||||||
v, v_stride,
|
|
||||||
dst_sample,
|
|
||||||
dst_sample_stride ? dst_sample_stride : width * 2,
|
|
||||||
width, height);
|
|
||||||
break;
|
|
||||||
case FOURCC_V210:
|
|
||||||
I420ToV210(y, y_stride,
|
|
||||||
u, u_stride,
|
|
||||||
v, v_stride,
|
|
||||||
dst_sample,
|
|
||||||
dst_sample_stride ? dst_sample_stride :
|
|
||||||
(width + 47) / 48 * 128,
|
|
||||||
width, height);
|
|
||||||
break;
|
|
||||||
case FOURCC_RGBP:
|
|
||||||
I420ToRGB565(y, y_stride,
|
|
||||||
u, u_stride,
|
|
||||||
v, v_stride,
|
|
||||||
dst_sample,
|
|
||||||
dst_sample_stride ? dst_sample_stride : width * 2,
|
|
||||||
width, height);
|
|
||||||
break;
|
|
||||||
case FOURCC_RGBO:
|
|
||||||
I420ToARGB1555(y, y_stride,
|
|
||||||
u, u_stride,
|
|
||||||
v, v_stride,
|
|
||||||
dst_sample,
|
|
||||||
dst_sample_stride ? dst_sample_stride : width * 2,
|
|
||||||
width, height);
|
|
||||||
break;
|
|
||||||
case FOURCC_R444:
|
|
||||||
I420ToARGB4444(y, y_stride,
|
|
||||||
u, u_stride,
|
|
||||||
v, v_stride,
|
|
||||||
dst_sample,
|
|
||||||
dst_sample_stride ? dst_sample_stride : width * 2,
|
|
||||||
width, height);
|
|
||||||
break;
|
|
||||||
case FOURCC_24BG:
|
|
||||||
I420ToRGB24(y, y_stride,
|
|
||||||
u, u_stride,
|
|
||||||
v, v_stride,
|
|
||||||
dst_sample,
|
|
||||||
dst_sample_stride ? dst_sample_stride : width * 3,
|
|
||||||
width, height);
|
|
||||||
break;
|
|
||||||
case FOURCC_RAW:
|
|
||||||
I420ToRAW(y, y_stride,
|
|
||||||
u, u_stride,
|
|
||||||
v, v_stride,
|
|
||||||
dst_sample,
|
|
||||||
dst_sample_stride ? dst_sample_stride : width * 3,
|
|
||||||
width, height);
|
|
||||||
break;
|
|
||||||
case FOURCC_ARGB:
|
|
||||||
I420ToARGB(y, y_stride,
|
|
||||||
u, u_stride,
|
|
||||||
v, v_stride,
|
|
||||||
dst_sample,
|
|
||||||
dst_sample_stride ? dst_sample_stride : width * 4,
|
|
||||||
width, height);
|
|
||||||
break;
|
|
||||||
case FOURCC_BGRA:
|
|
||||||
I420ToBGRA(y, y_stride,
|
|
||||||
u, u_stride,
|
|
||||||
v, v_stride,
|
|
||||||
dst_sample,
|
|
||||||
dst_sample_stride ? dst_sample_stride : width * 4,
|
|
||||||
width, height);
|
|
||||||
break;
|
|
||||||
case FOURCC_ABGR:
|
|
||||||
I420ToABGR(y, y_stride,
|
|
||||||
u, u_stride,
|
|
||||||
v, v_stride,
|
|
||||||
dst_sample,
|
|
||||||
dst_sample_stride ? dst_sample_stride : width * 4,
|
|
||||||
width, height);
|
|
||||||
break;
|
|
||||||
case FOURCC_BGGR:
|
|
||||||
I420ToBayerBGGR(y, y_stride,
|
|
||||||
u, u_stride,
|
|
||||||
v, v_stride,
|
|
||||||
dst_sample,
|
|
||||||
dst_sample_stride ? dst_sample_stride : width,
|
|
||||||
width, height);
|
|
||||||
break;
|
|
||||||
case FOURCC_GBRG:
|
|
||||||
I420ToBayerGBRG(y, y_stride,
|
|
||||||
u, u_stride,
|
|
||||||
v, v_stride,
|
|
||||||
dst_sample,
|
|
||||||
dst_sample_stride ? dst_sample_stride : width,
|
|
||||||
width, height);
|
|
||||||
break;
|
|
||||||
case FOURCC_GRBG:
|
|
||||||
I420ToBayerGRBG(y, y_stride,
|
|
||||||
u, u_stride,
|
|
||||||
v, v_stride,
|
|
||||||
dst_sample,
|
|
||||||
dst_sample_stride ? dst_sample_stride : width,
|
|
||||||
width, height);
|
|
||||||
break;
|
|
||||||
case FOURCC_RGGB:
|
|
||||||
I420ToBayerRGGB(y, y_stride,
|
|
||||||
u, u_stride,
|
|
||||||
v, v_stride,
|
|
||||||
dst_sample,
|
|
||||||
dst_sample_stride ? dst_sample_stride : width,
|
|
||||||
width, height);
|
|
||||||
break;
|
|
||||||
case FOURCC_I400:
|
|
||||||
I400Copy(y, y_stride,
|
|
||||||
dst_sample,
|
|
||||||
dst_sample_stride ? dst_sample_stride : width,
|
|
||||||
width, height);
|
|
||||||
break;
|
|
||||||
// Triplanar formats
|
|
||||||
// TODO(fbarchard): halfstride instead of halfwidth
|
|
||||||
case FOURCC_I420:
|
|
||||||
case FOURCC_YV12: {
|
|
||||||
int halfwidth = (width + 1) / 2;
|
|
||||||
int halfheight = (height + 1) / 2;
|
|
||||||
uint8* dst_u;
|
|
||||||
uint8* dst_v;
|
|
||||||
if (format == FOURCC_I420) {
|
|
||||||
dst_u = dst_sample + width * height;
|
|
||||||
dst_v = dst_u + halfwidth * halfheight;
|
|
||||||
} else {
|
|
||||||
dst_v = dst_sample + width * height;
|
|
||||||
dst_u = dst_v + halfwidth * halfheight;
|
|
||||||
}
|
|
||||||
I420Copy(y, y_stride,
|
|
||||||
u, u_stride,
|
|
||||||
v, v_stride,
|
|
||||||
dst_sample, width,
|
|
||||||
dst_u, halfwidth,
|
|
||||||
dst_v, halfwidth,
|
|
||||||
width, height);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case FOURCC_I422:
|
|
||||||
case FOURCC_YV16: {
|
|
||||||
int halfwidth = (width + 1) / 2;
|
|
||||||
uint8* dst_u;
|
|
||||||
uint8* dst_v;
|
|
||||||
if (format == FOURCC_I422) {
|
|
||||||
dst_u = dst_sample + width * height;
|
|
||||||
dst_v = dst_u + halfwidth * height;
|
|
||||||
} else {
|
|
||||||
dst_v = dst_sample + width * height;
|
|
||||||
dst_u = dst_v + halfwidth * height;
|
|
||||||
}
|
|
||||||
I420ToI422(y, y_stride,
|
|
||||||
u, u_stride,
|
|
||||||
v, v_stride,
|
|
||||||
dst_sample, width,
|
|
||||||
dst_u, halfwidth,
|
|
||||||
dst_v, halfwidth,
|
|
||||||
width, height);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case FOURCC_I444:
|
|
||||||
case FOURCC_YV24: {
|
|
||||||
uint8* dst_u;
|
|
||||||
uint8* dst_v;
|
|
||||||
if (format == FOURCC_I444) {
|
|
||||||
dst_u = dst_sample + width * height;
|
|
||||||
dst_v = dst_u + width * height;
|
|
||||||
} else {
|
|
||||||
dst_v = dst_sample + width * height;
|
|
||||||
dst_u = dst_v + width * height;
|
|
||||||
}
|
|
||||||
I420ToI444(y, y_stride,
|
|
||||||
u, u_stride,
|
|
||||||
v, v_stride,
|
|
||||||
dst_sample, width,
|
|
||||||
dst_u, width,
|
|
||||||
dst_v, width,
|
|
||||||
width, height);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Formats not supported - MJPG, biplanar, some rgb formats.
|
|
||||||
default:
|
|
||||||
return -1; // unknown fourcc - return failure code.
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} // extern "C"
|
|
||||||
} // namespace libyuv
|
|
||||||
#endif
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -11,6 +11,7 @@
|
|||||||
#include "libyuv/rotate.h"
|
#include "libyuv/rotate.h"
|
||||||
|
|
||||||
#include "libyuv/cpu_id.h"
|
#include "libyuv/cpu_id.h"
|
||||||
|
#include "libyuv/convert.h"
|
||||||
#include "libyuv/planar_functions.h"
|
#include "libyuv/planar_functions.h"
|
||||||
#include "rotate_priv.h"
|
#include "rotate_priv.h"
|
||||||
#include "row.h"
|
#include "row.h"
|
||||||
|
|||||||
@ -46,6 +46,7 @@ extern "C" {
|
|||||||
#define HAS_I444TOARGBROW_SSSE3
|
#define HAS_I444TOARGBROW_SSSE3
|
||||||
#define HAS_MIRRORROW_SSSE3
|
#define HAS_MIRRORROW_SSSE3
|
||||||
#define HAS_MIRRORROW_SSE2
|
#define HAS_MIRRORROW_SSE2
|
||||||
|
#define HAS_SPLITUV_SSE2
|
||||||
#define HAS_YUY2TOYROW_SSE2
|
#define HAS_YUY2TOYROW_SSE2
|
||||||
#define HAS_UYVYTOYROW_SSE2
|
#define HAS_UYVYTOYROW_SSE2
|
||||||
#define HAS_YUY2TOUVROW_SSE2
|
#define HAS_YUY2TOUVROW_SSE2
|
||||||
@ -67,6 +68,7 @@ extern "C" {
|
|||||||
// The following are available on Neon platforms
|
// The following are available on Neon platforms
|
||||||
#if defined(__ARM_NEON__) && !defined(YUV_DISABLE_ASM)
|
#if defined(__ARM_NEON__) && !defined(YUV_DISABLE_ASM)
|
||||||
#define HAS_MIRRORROW_NEON
|
#define HAS_MIRRORROW_NEON
|
||||||
|
#define HAS_SPLITUV_NEON
|
||||||
#define HAS_I420TOARGBROW_NEON
|
#define HAS_I420TOARGBROW_NEON
|
||||||
#define HAS_I420TOBGRAROW_NEON
|
#define HAS_I420TOBGRAROW_NEON
|
||||||
#define HAS_I420TOABGRROW_NEON
|
#define HAS_I420TOABGRROW_NEON
|
||||||
@ -125,6 +127,10 @@ void MirrorRow_SSE2(const uint8* src, uint8* dst, int width);
|
|||||||
void MirrorRow_NEON(const uint8* src, uint8* dst, int width);
|
void MirrorRow_NEON(const uint8* src, uint8* dst, int width);
|
||||||
void MirrorRow_C(const uint8* src, uint8* dst, int width);
|
void MirrorRow_C(const uint8* src, uint8* dst, int width);
|
||||||
|
|
||||||
|
void SplitUV_SSE2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix);
|
||||||
|
void SplitUV_NEON(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix);
|
||||||
|
void SplitUV_C(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix);
|
||||||
|
|
||||||
void ARGBToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
|
void ARGBToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
|
||||||
void BGRAToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
|
void BGRAToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
|
||||||
void ABGRToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
|
void ABGRToYRow_C(const uint8* src_argb, uint8* dst_y, int pix);
|
||||||
|
|||||||
@ -350,9 +350,7 @@ void I444ToARGBRow_C(const uint8* y_buf,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void YToARGBRow_C(const uint8* y_buf,
|
void YToARGBRow_C(const uint8* y_buf, uint8* rgb_buf, int width) {
|
||||||
uint8* rgb_buf,
|
|
||||||
int width) {
|
|
||||||
for (int x = 0; x < width; ++x) {
|
for (int x = 0; x < width; ++x) {
|
||||||
YuvPixel(y_buf[0], 128, 128, rgb_buf, 24, 16, 8, 0);
|
YuvPixel(y_buf[0], 128, 128, rgb_buf, 24, 16, 8, 0);
|
||||||
y_buf += 1;
|
y_buf += 1;
|
||||||
@ -368,6 +366,17 @@ void MirrorRow_C(const uint8* src, uint8* dst, int width) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SplitUV_C(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix) {
|
||||||
|
// Copy a row of UV.
|
||||||
|
for (int x = 0; x < pix; ++x) {
|
||||||
|
dst_u[0] = src_uv[0];
|
||||||
|
dst_v[0] = src_uv[1];
|
||||||
|
src_uv += 2;
|
||||||
|
dst_u += 1;
|
||||||
|
dst_v += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Filter 2 rows of YUY2 UV's (422) into U and V (420)
|
// Filter 2 rows of YUY2 UV's (422) into U and V (420)
|
||||||
void YUY2ToUVRow_C(const uint8* src_yuy2, int src_stride_yuy2,
|
void YUY2ToUVRow_C(const uint8* src_yuy2, int src_stride_yuy2,
|
||||||
uint8* dst_u, uint8* dst_v, int pix) {
|
uint8* dst_u, uint8* dst_v, int pix) {
|
||||||
|
|||||||
@ -15,6 +15,9 @@ namespace libyuv {
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// This module is for GCC Neon
|
||||||
|
#if defined(__ARM_NEON__) && !defined(YUV_DISABLE_ASM)
|
||||||
|
|
||||||
#define YUVTORGB \
|
#define YUVTORGB \
|
||||||
"vld1.u8 {d0}, [%0]! \n" \
|
"vld1.u8 {d0}, [%0]! \n" \
|
||||||
"vld1.u32 {d2[0]}, [%1]! \n" \
|
"vld1.u32 {d2[0]}, [%1]! \n" \
|
||||||
@ -160,6 +163,29 @@ YUVTORGB
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAS_SPLITUV_NEON)
|
||||||
|
// Reads 16 pairs of UV and write even values to dst_u and odd to dst_v
|
||||||
|
// Alignment requirement: 16 bytes for pointers, and multiple of 16 pixels.
|
||||||
|
void SplitUV_NEON(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix) {
|
||||||
|
asm volatile (
|
||||||
|
"1: \n"
|
||||||
|
"vld2.u8 {q0,q1}, [%0]! \n" // load 16 pairs of UV
|
||||||
|
"subs %3, %3, #16 \n" // 16 processed per loop
|
||||||
|
"vst1.u8 {q0}, [%1]! \n" // store U
|
||||||
|
"vst1.u8 {q1}, [%2]! \n" // Store V
|
||||||
|
"bhi 1b \n"
|
||||||
|
: "+r"(src_uv),
|
||||||
|
"+r"(dst_u),
|
||||||
|
"+r"(dst_v),
|
||||||
|
"+r"(pix) // Output registers
|
||||||
|
: // Input registers
|
||||||
|
: "memory", "cc", "q0", "q1" // Clobber List
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // __ARM_NEON__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
} // namespace libyuv
|
} // namespace libyuv
|
||||||
|
|||||||
@ -17,6 +17,9 @@ namespace libyuv {
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// This module is for GCC x86 and x64
|
||||||
|
#if (defined(__x86_64__) || defined(__i386__)) && !defined(YUV_DISABLE_ASM)
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#define CONST
|
#define CONST
|
||||||
#else
|
#else
|
||||||
@ -816,7 +819,7 @@ void MirrorRow_SSE2(const uint8* src, uint8* dst, int width) {
|
|||||||
"lea -0x10(%0),%0 \n"
|
"lea -0x10(%0),%0 \n"
|
||||||
"1: \n"
|
"1: \n"
|
||||||
"movdqu (%0,%2),%%xmm0 \n"
|
"movdqu (%0,%2),%%xmm0 \n"
|
||||||
"movdqu %%xmm0,%%xmm1 \n"
|
"movdqa %%xmm0,%%xmm1 \n"
|
||||||
"psllw $0x8,%%xmm0 \n"
|
"psllw $0x8,%%xmm0 \n"
|
||||||
"psrlw $0x8,%%xmm1 \n"
|
"psrlw $0x8,%%xmm1 \n"
|
||||||
"por %%xmm1,%%xmm0 \n"
|
"por %%xmm1,%%xmm0 \n"
|
||||||
@ -839,6 +842,43 @@ void MirrorRow_SSE2(const uint8* src, uint8* dst, int width) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAS_SPLITUV_SSE2
|
||||||
|
void SplitUV_SSE2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix) {
|
||||||
|
asm volatile (
|
||||||
|
"pcmpeqb %%xmm5,%%xmm5 \n"
|
||||||
|
"psrlw $0x8,%%xmm5 \n"
|
||||||
|
"sub %1,%2 \n"
|
||||||
|
|
||||||
|
"1: \n"
|
||||||
|
"movdqa (%0),%%xmm0 \n"
|
||||||
|
"movdqa 0x10(%0),%%xmm1 \n"
|
||||||
|
"lea 0x20(%0),%0 \n"
|
||||||
|
"movdqa %%xmm0,%%xmm2 \n"
|
||||||
|
"movdqa %%xmm1,%%xmm3 \n"
|
||||||
|
"pand %%xmm5,%%xmm0 \n"
|
||||||
|
"pand %%xmm5,%%xmm1 \n"
|
||||||
|
"packuswb %%xmm1,%%xmm0 \n"
|
||||||
|
"psrlw $0x8,%%xmm2 \n"
|
||||||
|
"psrlw $0x8,%%xmm3 \n"
|
||||||
|
"packuswb %%xmm3,%%xmm2 \n"
|
||||||
|
"movdqa %%xmm0,(%1) \n"
|
||||||
|
"movdqa %%xmm2,(%1,%2) \n"
|
||||||
|
"lea 0x10(%1),%1 \n"
|
||||||
|
"sub $0x10,%3 \n"
|
||||||
|
"ja 1b \n"
|
||||||
|
: "+r"(src_uv), // %0
|
||||||
|
"+r"(dst_u), // %1
|
||||||
|
"+r"(dst_v), // %2
|
||||||
|
"+r"(pix) // %3
|
||||||
|
:
|
||||||
|
: "memory", "cc"
|
||||||
|
#if defined(__SSE2__)
|
||||||
|
, "xmm0", "xmm1", "xmm2", "xmm3", "xmm5"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_YUY2TOYROW_SSE2
|
#ifdef HAS_YUY2TOYROW_SSE2
|
||||||
void YUY2ToYRow_SSE2(const uint8* src_yuy2, uint8* dst_y, int pix) {
|
void YUY2ToYRow_SSE2(const uint8* src_yuy2, uint8* dst_y, int pix) {
|
||||||
asm volatile (
|
asm volatile (
|
||||||
@ -1099,9 +1139,10 @@ void UYVYToUVRow_Unaligned_SSE2(const uint8* src_uyvy, int stride_uyvy,
|
|||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_YUY2TOYROW_SSE2
|
#endif // HAS_YUY2TOYROW_SSE2
|
||||||
|
|
||||||
|
#endif // defined(__x86_64__) || defined(__i386__)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
} // namespace libyuv
|
} // namespace libyuv
|
||||||
|
|||||||
@ -15,6 +15,9 @@ namespace libyuv {
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// This module is for Visual C x86
|
||||||
|
#if defined(_M_IX86) && !defined(YUV_DISABLE_ASM)
|
||||||
|
|
||||||
#ifdef HAS_ARGBTOYROW_SSSE3
|
#ifdef HAS_ARGBTOYROW_SSSE3
|
||||||
|
|
||||||
// Constant multiplication table for converting ARGB to I400.
|
// Constant multiplication table for converting ARGB to I400.
|
||||||
@ -1503,7 +1506,7 @@ __asm {
|
|||||||
|
|
||||||
#ifdef HAS_MIRRORROW_SSE2
|
#ifdef HAS_MIRRORROW_SSE2
|
||||||
|
|
||||||
// SSE2 version has movdqu so it can be used on misaligned buffers when SSSE3
|
// SSE2 version has movdqu so it can be used on unaligned buffers when SSSE3
|
||||||
// version can not.
|
// version can not.
|
||||||
__declspec(naked)
|
__declspec(naked)
|
||||||
void MirrorRow_SSE2(const uint8* src, uint8* dst, int width) {
|
void MirrorRow_SSE2(const uint8* src, uint8* dst, int width) {
|
||||||
@ -1514,7 +1517,7 @@ __asm {
|
|||||||
lea eax, [eax - 16]
|
lea eax, [eax - 16]
|
||||||
convertloop:
|
convertloop:
|
||||||
movdqu xmm0, [eax + ecx]
|
movdqu xmm0, [eax + ecx]
|
||||||
movdqu xmm1, xmm0 // swap bytes
|
movdqa xmm1, xmm0 // swap bytes
|
||||||
psllw xmm0, 8
|
psllw xmm0, 8
|
||||||
psrlw xmm1, 8
|
psrlw xmm1, 8
|
||||||
por xmm0, xmm1
|
por xmm0, xmm1
|
||||||
@ -1530,6 +1533,42 @@ __asm {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAS_SPLITUV_SSE2
|
||||||
|
__declspec(naked)
|
||||||
|
void SplitUV_SSE2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix) {
|
||||||
|
__asm {
|
||||||
|
push edi
|
||||||
|
mov eax, [esp + 4 + 4] // src_uv
|
||||||
|
mov edx, [esp + 4 + 8] // dst_u
|
||||||
|
mov edi, [esp + 4 + 12] // dst_v
|
||||||
|
mov ecx, [esp + 4 + 16] // pix
|
||||||
|
pcmpeqb xmm5, xmm5 // generate mask 0x00ff00ff
|
||||||
|
psrlw xmm5, 8
|
||||||
|
sub edi, edx
|
||||||
|
|
||||||
|
convertloop:
|
||||||
|
movdqa xmm0, [eax]
|
||||||
|
movdqa xmm1, [eax + 16]
|
||||||
|
lea eax, [eax + 32]
|
||||||
|
movdqa xmm2, xmm0
|
||||||
|
movdqa xmm3, xmm1
|
||||||
|
pand xmm0, xmm5 // even bytes
|
||||||
|
pand xmm1, xmm5
|
||||||
|
packuswb xmm0, xmm1
|
||||||
|
psrlw xmm2, 8 // odd bytes
|
||||||
|
psrlw xmm3, 8
|
||||||
|
packuswb xmm2, xmm3
|
||||||
|
movdqa [edx], xmm0
|
||||||
|
movdqa [edx + edi], xmm2
|
||||||
|
lea edx, [edx + 16]
|
||||||
|
sub ecx, 16
|
||||||
|
ja convertloop
|
||||||
|
pop edi
|
||||||
|
ret
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_YUY2TOYROW_SSE2
|
#ifdef HAS_YUY2TOYROW_SSE2
|
||||||
__declspec(naked)
|
__declspec(naked)
|
||||||
void YUY2ToYRow_SSE2(const uint8* src_yuy2,
|
void YUY2ToYRow_SSE2(const uint8* src_yuy2,
|
||||||
@ -1800,6 +1839,8 @@ void UYVYToUVRow_Unaligned_SSE2(const uint8* src_uyvy, int stride_uyvy,
|
|||||||
}
|
}
|
||||||
#endif // HAS_YUY2TOYROW_SSE2
|
#endif // HAS_YUY2TOYROW_SSE2
|
||||||
|
|
||||||
|
#endif // _M_IX86
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
} // namespace libyuv
|
} // namespace libyuv
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user