From 791cc4b30050994eddcc6d283b28b5186ba2c6c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=91=D0=B0=D0=B3?= =?UTF-8?q?=D1=80=D1=8F=D0=BD=D1=86=D0=B5=D0=B2?= Date: Tue, 12 May 2020 18:26:52 +0300 Subject: [PATCH] Fixed color pallette (#58) Former-commit-id: 29fd4a76c092e15ae146d8fda6b988a130fd11b4 --- FFMpegCore.Test/BitmapSources.cs | 4 +++- FFMpegCore/Extend/BitmapVideoFrameWrapper.cs | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/FFMpegCore.Test/BitmapSources.cs b/FFMpegCore.Test/BitmapSources.cs index 2a81d57..c3e8d40 100644 --- a/FFMpegCore.Test/BitmapSources.cs +++ b/FFMpegCore.Test/BitmapSources.cs @@ -30,12 +30,14 @@ private static BitmapVideoFrameWrapper CreateVideoFrame(int index, PixelFormat f for (int y = 0; y < h; y++) for (int x = 0; x < w; x++) { + var xf = x / (float)w; + var yf = y / (float)h; var nx = x * scaleNoise + offset; var ny = y * scaleNoise + offset; var value = (int)((Perlin.Noise(nx, ny) + 1.0f) / 2.0f * 255); - var color = Color.FromArgb(value, value, value); + var color = Color.FromArgb((int)(value * xf), (int)(value * yf), value); bitmap.SetPixel(x, y, color); } diff --git a/FFMpegCore/Extend/BitmapVideoFrameWrapper.cs b/FFMpegCore/Extend/BitmapVideoFrameWrapper.cs index 5a96357..e2f0737 100644 --- a/FFMpegCore/Extend/BitmapVideoFrameWrapper.cs +++ b/FFMpegCore/Extend/BitmapVideoFrameWrapper.cs @@ -70,9 +70,9 @@ private static string ConvertStreamFormat(PixelFormat fmt) case PixelFormat.Format16bppRgb565: return "bgr565le"; case PixelFormat.Format24bppRgb: - return "rgb24"; + return "bgr24"; case PixelFormat.Format32bppArgb: - return "rgba"; + return "bgra"; case PixelFormat.Format32bppPArgb: //This is not really same as argb32 return "argb";