mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2026-01-01 03:12:16 +08:00
Call CanonicalCode in convert functions and add unittest for function.
BUG=none TEST=video_common_test added Review URL: https://webrtc-codereview.appspot.com/1001007 git-svn-id: http://libyuv.googlecode.com/svn/trunk@521 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
f491a094c7
commit
442b0ad0ac
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 520
|
||||
Version: 521
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
|
||||
#define INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
#define LIBYUV_VERSION 520
|
||||
#define LIBYUV_VERSION 521
|
||||
|
||||
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
'unit_test/scale_argb_test.cc',
|
||||
'unit_test/scale_test.cc',
|
||||
'unit_test/unit_test.cc',
|
||||
'unit_test/video_common_test.cc',
|
||||
'unit_test/version_test.cc',
|
||||
],
|
||||
'conditions': [
|
||||
|
||||
@ -1848,7 +1848,8 @@ int ConvertToI420(const uint8* sample,
|
||||
int src_width, int src_height,
|
||||
int dst_width, int dst_height,
|
||||
RotationMode rotation,
|
||||
uint32 format) {
|
||||
uint32 fourcc) {
|
||||
uint32 format = CanonicalFourCC(fourcc);
|
||||
if (!y || !u || !v || !sample ||
|
||||
src_width <= 0 || dst_width <= 0 ||
|
||||
src_height == 0 || dst_height == 0) {
|
||||
|
||||
@ -1033,7 +1033,8 @@ int ConvertToARGB(const uint8* sample, size_t sample_size,
|
||||
int src_width, int src_height,
|
||||
int dst_width, int dst_height,
|
||||
RotationMode rotation,
|
||||
uint32 format) {
|
||||
uint32 fourcc) {
|
||||
uint32 format = CanonicalFourCC(fourcc);
|
||||
if (dst_argb == NULL || sample == NULL ||
|
||||
src_width <= 0 || dst_width <= 0 ||
|
||||
src_height == 0 || dst_height == 0) {
|
||||
|
||||
@ -1060,7 +1060,8 @@ int ConvertFromI420(const uint8* y, int y_stride,
|
||||
const uint8* v, int v_stride,
|
||||
uint8* dst_sample, int dst_sample_stride,
|
||||
int width, int height,
|
||||
uint32 format) {
|
||||
uint32 fourcc) {
|
||||
uint32 format = CanonicalFourCC(fourcc);
|
||||
if (!y || !u|| !v || !dst_sample ||
|
||||
width <= 0 || height == 0) {
|
||||
return -1;
|
||||
|
||||
@ -982,6 +982,8 @@ int ARGBColorTable(uint8* dst_argb, int dst_stride_argb,
|
||||
// e.g. rgb / qvalue * qvalue + qvalue / 2
|
||||
// But the low levels implement efficiently with 3 parameters, and could be
|
||||
// used for other high level operations.
|
||||
// dst_argb[0] = (b * scale >> 16) * interval_size + interval_offset;
|
||||
// where scale is 1 / interval_size as a fixed point value.
|
||||
// The divide is replaces with a multiply by reciprocal fixed point multiply.
|
||||
// Caveat - although SSE2 saturates, the C function does not and should be used
|
||||
// with care if doing anything but quantization.
|
||||
|
||||
27
unit_test/video_common_test.cc
Normal file
27
unit_test/video_common_test.cc
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2012 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 <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "libyuv/video_common.h"
|
||||
#include "../unit_test/unit_test.h"
|
||||
|
||||
namespace libyuv {
|
||||
|
||||
// Tests SVN version against include/libyuv/version.h
|
||||
// SVN version is bumped by documentation changes as well as code.
|
||||
// Although the versions should match, once checked in, a tolerance is allowed.
|
||||
TEST_F(libyuvTest, TestCanonicalFourCC) {
|
||||
EXPECT_EQ(FOURCC_YUY2, CanonicalFourCC(FOURCC_YUYV));
|
||||
EXPECT_EQ(FOURCC_YUY2, CanonicalFourCC(FOURCC_YUVS));
|
||||
}
|
||||
|
||||
} // namespace libyuv
|
||||
Loading…
x
Reference in New Issue
Block a user