Adding a 64 bit alignment calcualtion to LibYuv.
BUG= Review URL: https://webrtc-codereview.appspot.com/823006 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2800 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -56,13 +56,19 @@ enum VideoRotationMode {
|
||||
kRotate270 = 270,
|
||||
};
|
||||
|
||||
// Align value to 64 bits.
|
||||
// Input:
|
||||
// - value : Input value to be aligned.
|
||||
// Return value: An aligned to 64 bit form of the input value.
|
||||
int AlignTo64Bit(int value);
|
||||
|
||||
// Calculate the required buffer size.
|
||||
// Input:
|
||||
// - type - The type of the designated video frame.
|
||||
// - width - frame width in pixels.
|
||||
// - height - frame height in pixels.
|
||||
// Return value: The required size in bytes to accommodate the specified
|
||||
// video frame or -1 in case of an error .
|
||||
// - type :The type of the designated video frame.
|
||||
// - width :frame width in pixels.
|
||||
// - height :frame height in pixels.
|
||||
// Return value: :The required size in bytes to accommodate the specified
|
||||
// video frame or -1 in case of an error .
|
||||
int CalcBufferSize(VideoType type, int width, int height);
|
||||
|
||||
// Convert To I420
|
||||
|
@ -301,4 +301,16 @@ TEST_F(TestLibYuv, DISABLED_MirrorTest) {
|
||||
delete [] test_frame2;
|
||||
}
|
||||
|
||||
TEST_F(TestLibYuv, alignment) {
|
||||
int value = 640;
|
||||
int aligned_value = (value + 63) & ~63;
|
||||
EXPECT_EQ(AlignTo64Bit(value), aligned_value);
|
||||
value = 600;
|
||||
aligned_value = (value + 63) & ~63;
|
||||
EXPECT_EQ(AlignTo64Bit(value), aligned_value);
|
||||
value = 0;
|
||||
aligned_value = (value + 63) & ~63;
|
||||
EXPECT_EQ(AlignTo64Bit(value), aligned_value);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -52,6 +52,10 @@ VideoType RawVideoTypeToCommonVideoVideoType(RawVideoType type) {
|
||||
return kUnknown;
|
||||
}
|
||||
|
||||
int AlignTo64Bit(int value) {
|
||||
return ((value + 63) & ~63);
|
||||
}
|
||||
|
||||
int CalcBufferSize(VideoType type, int width, int height) {
|
||||
int buffer_size = 0;
|
||||
switch (type) {
|
||||
|
Reference in New Issue
Block a user