Add ConvertToARGB and enable RGB565
Review URL: https://webrtc-codereview.appspot.com/566004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2174 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
e62fec2285
commit
3ebff4c2e9
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 The WebRTC 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
|
||||
@ -149,6 +149,9 @@ int ConvertRGB24ToARGB(const uint8_t* src_frame,
|
||||
int ConvertNV12ToRGB565(const uint8_t* src_frame,
|
||||
uint8_t* dst_frame,
|
||||
int width, int height);
|
||||
int ConvertI420ToARGB8888(const uint8_t* src_frame,
|
||||
uint8_t* dst_frame,
|
||||
int width, int height);
|
||||
|
||||
// Mirror functions
|
||||
// The following 2 functions perform mirroring on a given image
|
||||
|
@ -143,6 +143,25 @@ int CalcBufferSize(VideoType src_video_type,
|
||||
return (length * dst_bits_per_pixel) / src_bits_per_pixel;
|
||||
}
|
||||
|
||||
int ConvertI420ToARGB8888(const uint8_t* src_frame,
|
||||
uint8_t* dst_frame,
|
||||
int width, int height) {
|
||||
|
||||
const uint8_t* src_y = src_frame;
|
||||
const uint8_t* src_u = src_y + width * height;
|
||||
const uint8_t* src_v = src_u + (width * height / 4);
|
||||
int src_stride_y = width;
|
||||
int src_stride_u = width / 2;
|
||||
int src_stride_v = width / 2;
|
||||
int dst_stride_argb = width * 4;
|
||||
|
||||
return libyuv::I420ToARGB(src_y, src_stride_y,
|
||||
src_u, src_stride_u,
|
||||
src_v, src_stride_v,
|
||||
dst_frame, dst_stride_argb,
|
||||
width, height);
|
||||
}
|
||||
|
||||
int ConvertI420ToARGB4444(const uint8_t* src_frame,
|
||||
uint8_t* dst_frame,
|
||||
int width, int height,
|
||||
@ -245,8 +264,9 @@ int ConvertVideoType(VideoType video_type) {
|
||||
return libyuv::FOURCC_24BG;
|
||||
case kABGR:
|
||||
return libyuv::FOURCC_ABGR;
|
||||
case kARGB4444:
|
||||
case kRGB565:
|
||||
return libyuv::FOURCC_RGBP;
|
||||
case kARGB4444:
|
||||
case kARGB1555:
|
||||
// TODO(mikhal): Not supported;
|
||||
assert(false);
|
||||
|
Loading…
Reference in New Issue
Block a user