libyuv: fixing a bug in RotateI420 and updating test
Review URL: http://webrtc-codereview.appspot.com/324003 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1164 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
352ade7023
commit
71d6391716
@ -107,7 +107,7 @@ int CalcBufferSize(VideoType src_video_type,
|
|||||||
int ConvertI420ToRGB24(const uint8_t* src_frame, uint8_t* dst_frame,
|
int ConvertI420ToRGB24(const uint8_t* src_frame, uint8_t* dst_frame,
|
||||||
int width, int height) {
|
int width, int height) {
|
||||||
const uint8_t* yplane = src_frame;
|
const uint8_t* yplane = src_frame;
|
||||||
const uint8_t* uplane = src_frame + width * height;
|
const uint8_t* uplane = yplane + width * height;
|
||||||
const uint8_t* vplane = uplane + (width * height / 4);
|
const uint8_t* vplane = uplane + (width * height / 4);
|
||||||
|
|
||||||
return libyuv::I420ToRGB24(yplane, width,
|
return libyuv::I420ToRGB24(yplane, width,
|
||||||
@ -490,9 +490,9 @@ int ConvertI420ToI420(const uint8_t* src_frame, uint8_t* dst_frame,
|
|||||||
return libyuv::I420Copy(src_yplane, width,
|
return libyuv::I420Copy(src_yplane, width,
|
||||||
src_uplane, width / 2,
|
src_uplane, width / 2,
|
||||||
src_vplane, width / 2,
|
src_vplane, width / 2,
|
||||||
dst_yplane, width,
|
dst_yplane, dst_stride,
|
||||||
dst_uplane, width / 2,
|
dst_uplane, dst_stride / 2,
|
||||||
dst_vplane, width / 2,
|
dst_vplane, dst_stride / 2,
|
||||||
width, height);
|
width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -781,7 +781,7 @@ int I420Rotate(const uint8_t* src_frame,
|
|||||||
VideoRotationMode rotation_mode) {
|
VideoRotationMode rotation_mode) {
|
||||||
const uint8_t* src_yplane = src_frame;
|
const uint8_t* src_yplane = src_frame;
|
||||||
const uint8_t* src_uplane = src_frame + width * height;
|
const uint8_t* src_uplane = src_frame + width * height;
|
||||||
const uint8_t* src_vplane = src_frame + (width * height / 4);
|
const uint8_t* src_vplane = src_uplane + (width * height / 4);
|
||||||
uint8_t* dst_yplane = dst_frame;
|
uint8_t* dst_yplane = dst_frame;
|
||||||
uint8_t* dst_uplane = dst_frame + width * height;
|
uint8_t* dst_uplane = dst_frame + width * height;
|
||||||
uint8_t* dst_vplane = dst_uplane + (width * height / 4);
|
uint8_t* dst_vplane = dst_uplane + (width * height / 4);
|
||||||
|
@ -150,10 +150,10 @@ TEST_F(LibYuvTest, ConvertTest) {
|
|||||||
delete [] out_uyvy_buffer;
|
delete [] out_uyvy_buffer;
|
||||||
|
|
||||||
// printf("\nConvert #%d I420 <-> I420 \n", j);
|
// printf("\nConvert #%d I420 <-> I420 \n", j);
|
||||||
uint8_t* out_i420_buffer = new uint8_t[width_ * height_ * 2];
|
uint8_t* out_i420_buffer = new uint8_t[width_ * height_ * 3 / 2 ];
|
||||||
EXPECT_EQ(0, ConvertToI420(kI420, orig_buffer, width_, height_,
|
EXPECT_EQ(0, ConvertToI420(kI420, orig_buffer, width_, height_,
|
||||||
out_i420_buffer, false, kRotateNone));
|
out_i420_buffer, false, kRotateNone));
|
||||||
EXPECT_EQ(0, ConvertToI420(kI420 , out_i420_buffer, width_, height_,
|
EXPECT_EQ(0, ConvertFromI420(kI420 , out_i420_buffer, width_, height_,
|
||||||
res_i420_buffer, false, kRotateNone));
|
res_i420_buffer, false, kRotateNone));
|
||||||
fwrite(res_i420_buffer, frame_length_, 1, output_file);
|
fwrite(res_i420_buffer, frame_length_, 1, output_file);
|
||||||
ImagePSNRfromBuffer(orig_buffer, res_i420_buffer, width_, height_, &psnr);
|
ImagePSNRfromBuffer(orig_buffer, res_i420_buffer, width_, height_, &psnr);
|
||||||
@ -175,7 +175,7 @@ TEST_F(LibYuvTest, ConvertTest) {
|
|||||||
j++;
|
j++;
|
||||||
delete [] outYV120Buffer;
|
delete [] outYV120Buffer;
|
||||||
|
|
||||||
// printf("\nTEST #%d I420 <-> YUY2\n", j);
|
// printf("\nConvert #%d I420 <-> YUY2\n", j);
|
||||||
uint8_t* out_yuy2_buffer = new uint8_t[width_ * height_ * 2];
|
uint8_t* out_yuy2_buffer = new uint8_t[width_ * height_ * 2];
|
||||||
|
|
||||||
EXPECT_EQ(0, ConvertFromI420(kYUY2, orig_buffer, width_, height_,
|
EXPECT_EQ(0, ConvertFromI420(kYUY2, orig_buffer, width_, height_,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user