Fix rotation degree calculation

This commit is contained in:
wangqr 2019-10-28 20:21:02 -04:00
parent bd7a7ac551
commit 5fc01de1e5

View file

@ -351,7 +351,7 @@ void FFmpegSourceVideoProvider::GetFrame(int n, VideoFrame &out) {
out.data[4 * (Width * x + y) + ch] = data[frame->Linesize[0] * (Height - 1 - x) + 4 * (Width - 1 - y) + ch]; out.data[4 * (Width * x + y) + ch] = data[frame->Linesize[0] * (Height - 1 - x) + 4 * (Width - 1 - y) + ch];
out.pitch = 4 * Width; out.pitch = 4 * Width;
} }
else if (VideoInfo->Rotation % 180 == 90 || VideoInfo->Rotation % 360 == -270) { else if (VideoInfo->Rotation % 360 == 90 || VideoInfo->Rotation % 360 == -270) {
std::vector<unsigned char> data(std::move(out.data)); std::vector<unsigned char> data(std::move(out.data));
out.data.resize(Width * Height * 4); out.data.resize(Width * Height * 4);
for (int x = 0; x < Width; ++x) for (int x = 0; x < Width; ++x)
@ -362,7 +362,7 @@ void FFmpegSourceVideoProvider::GetFrame(int n, VideoFrame &out) {
out.height = Width; out.height = Width;
out.pitch = 4 * Height; out.pitch = 4 * Height;
} }
else if (VideoInfo->Rotation % 180 == 270 || VideoInfo->Rotation % 360 == -90) { else if (VideoInfo->Rotation % 360 == 270 || VideoInfo->Rotation % 360 == -90) {
std::vector<unsigned char> data(std::move(out.data)); std::vector<unsigned char> data(std::move(out.data));
out.data.resize(Width * Height * 4); out.data.resize(Width * Height * 4);
for (int x = 0; x < Width; ++x) for (int x = 0; x < Width; ++x)