mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-07 17:26:49 +08:00
libyuv: Adding I420rotate. Updating gyp file to include rotation.
Review URL: http://webrtc-codereview.appspot.com/230002 git-svn-id: http://libyuv.googlecode.com/svn/trunk@30 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
8b071f6dc2
commit
ec9d86cab3
@ -21,11 +21,11 @@
|
||||
namespace libyuv {
|
||||
|
||||
// Supported rotation
|
||||
enum VideoRotationMode
|
||||
enum RotationMode
|
||||
{
|
||||
kRotateNone = 0,
|
||||
kRotateClockwise = 90,
|
||||
kRotateCounterClockwise = -90,
|
||||
kRotateCounterClockwise = 270,
|
||||
kRotate180 = 180,
|
||||
};
|
||||
|
||||
@ -51,6 +51,17 @@ I420Crop(uint8* frame,
|
||||
int src_width, int src_height,
|
||||
int dst_width, int dst_height);
|
||||
|
||||
// Rotate I420 frame
|
||||
int
|
||||
I420Rotate(const uint8* src_yplane, int src_ystride,
|
||||
const uint8* src_uplane, int src_ustride,
|
||||
const uint8* src_vplane, int src_vstride,
|
||||
uint8* dst_yplane, int dst_ystride,
|
||||
uint8* dst_uplane, int dst_ustride,
|
||||
uint8* dst_vplane, int dst_vstride,
|
||||
int width, int height,
|
||||
RotationMode mode);
|
||||
|
||||
|
||||
} // namespace libyuv
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
'common/common.h',
|
||||
'common/constructor_magic.h',
|
||||
'source/cpu_id.h',
|
||||
'source/rotate.h'
|
||||
'source/row.h',
|
||||
'source/video_common.h',
|
||||
|
||||
@ -42,6 +43,8 @@
|
||||
'source/format_conversion.cc',
|
||||
'source/general.cc',
|
||||
'source/planar_functions.cc',
|
||||
'source/rotate.cc',
|
||||
'source/rotate_deinterleave.cc',
|
||||
'source/row_table.cc',
|
||||
'source/scale.cc',
|
||||
'source/video_common.cc',
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
|
||||
#include <string.h> // memcpy(), memset()
|
||||
|
||||
#include "planar_functions.h"
|
||||
#include "rotate.h"
|
||||
|
||||
|
||||
namespace libyuv {
|
||||
|
||||
int
|
||||
@ -305,4 +309,69 @@ I420CropPad(const uint8* src_frame, int src_width,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
I420Rotate(const uint8* src_yplane, int src_ystride,
|
||||
const uint8* src_uplane, int src_ustride,
|
||||
const uint8* src_vplane, int src_vstride,
|
||||
uint8* dst_yplane, int dst_ystride,
|
||||
uint8* dst_uplane, int dst_ustride,
|
||||
uint8* dst_vplane, int dst_vstride,
|
||||
int width, int height,
|
||||
RotationMode mode)
|
||||
{
|
||||
switch (mode){
|
||||
// TODO: should return int
|
||||
case kRotateNone:
|
||||
// copy frame
|
||||
I420Copy(src_yplane, src_ystride,
|
||||
src_uplane, src_ustride,
|
||||
src_vplane, src_vstride,
|
||||
dst_yplane, dst_ystride,
|
||||
dst_uplane, dst_ustride,
|
||||
dst_vplane, dst_vstride,
|
||||
width, height);
|
||||
return 0;
|
||||
break;
|
||||
case kRotateClockwise:
|
||||
Rotate90(src_yplane, src_ystride,
|
||||
dst_yplane, dst_ystride,
|
||||
width, height);
|
||||
Rotate90(src_uplane, src_ustride,
|
||||
dst_uplane, dst_ustride,
|
||||
width, height);
|
||||
Rotate90(src_vplane, src_vstride,
|
||||
dst_vplane, dst_vstride,
|
||||
width, height);
|
||||
return 0;
|
||||
break;
|
||||
case kRotateCounterClockwise:
|
||||
Rotate270(src_yplane, src_ystride,
|
||||
dst_yplane, dst_ystride,
|
||||
width, height);
|
||||
Rotate270(src_uplane, src_ustride,
|
||||
dst_uplane, dst_ustride,
|
||||
width, height);
|
||||
Rotate270(src_vplane, src_vstride,
|
||||
dst_vplane, dst_vstride,
|
||||
width, height);
|
||||
return 0;
|
||||
break;
|
||||
case kRotate180:
|
||||
Rotate180(src_yplane, src_ystride,
|
||||
dst_yplane, dst_ystride,
|
||||
width, height);
|
||||
Rotate180(src_uplane, src_ustride,
|
||||
dst_uplane, dst_ustride,
|
||||
width, height);
|
||||
Rotate180(src_vplane, src_vstride,
|
||||
dst_vplane, dst_vstride,
|
||||
width, height);
|
||||
return 0;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // nmaespace libyuv
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user