Skip to content

Commit

Permalink
Fixed Mpeg4VcmVideoEncoder: bitmap was not vertically flipped in the …
Browse files Browse the repository at this point in the history
…code path for .NET 5 targets.
  • Loading branch information
baSSiLL committed Aug 22, 2022
1 parent 02b1447 commit dab8cd6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
6 changes: 0 additions & 6 deletions SharpAvi/Codecs/MJpegWpfVideoEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ namespace SharpAvi.Codecs
/// <para>
/// The implementation relies on <see cref="JpegBitmapEncoder"/>.
/// </para>
/// <para>
/// This encoder is not fully conformant to the Motion JPEG standard, as each encoded frame is a full JPEG picture
/// with its own Huffman tables, and not those fixed Huffman tables defined by the Motion JPEG standard.
/// However, (at least most) modern decoders for Motion JPEG properly handle this situation.
/// This also produces a little overhead on the file size.
/// </para>
/// </remarks>
public sealed class MJpegWpfVideoEncoder : IVideoEncoder
{
Expand Down
3 changes: 2 additions & 1 deletion SharpAvi/Codecs/Mpeg4VcmVideoEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ public unsafe int EncodeFrame(ReadOnlySpan<byte> source, Span<byte> destination,
Argument.ConditionIsMet(4 * width * height <= source.Length,
"Source end offset exceeds the source length.");

fixed (void* srcPtr = source, destPtr = destination)
BitmapUtils.FlipVertical(source, sourceBuffer, height, width * 4);
fixed (void* srcPtr = sourceBuffer, destPtr = destination)
{
var srcIntPtr = new IntPtr(srcPtr);
var destIntPtr = new IntPtr(destPtr);
Expand Down

0 comments on commit dab8cd6

Please sign in to comment.