我有一个基本的RIFF制作于20世纪90年代初,我正在键入一个基本的视频播放器的原生VB/C#代码。根据标头,它使用旧的MS编解码器。AVI中的位图头表示它是RLE8压缩的。

问题是下面的代码和Windows做同样的事情,部分丢失了,这导致我从一个旧的VirtualDub博客文章下面;
(GDI的RLE不同于AVI的RLE)“。
问题是我找不到区别。我在互联网上找不到任何来源,也找不到MSDN上的任何资料。
我将htttp://dirkbertels.net/computing/bitmap_decompression.php中的RLE8解压缩示例移植到VB (为了简洁起见略去位图结构)。这是个不错的选择。问题是,对于使用RLE8的AVI帧,它不能正确工作。
Dim firstByte As Byte
Dim secondByte As Byte
Dim currX As UInteger = 0
Dim currY As UInteger = 0
Dim i As UInteger
Do
firstByte = br.ReadByte
If 0 <> firstByte Then
' Encoded Mode
secondByte = br.ReadByte
For i = 0 To firstByte - 1
frame.SetPixel(currX, currY, _bitmap.biClut(secondByte))
currX += 1
Next i
Else
' Absolute Mode
firstByte = br.ReadByte ' store next byte
Select Case firstByte
Case 0 ' new line
currX = 0
currY += 1 ' move cursor to beginning of next line
Case 1 ' end of bitmap
Exit Do
Case 2 ' delta = goto X and Y
currX += CInt(br.ReadByte) ' read byte and add value to x value
currY += CInt(br.ReadByte) ' read byte and add value to y value
Case Else
For i = 0 To firstByte - 1
secondByte = br.ReadByte
frame.SetPixel(currX, currY, _bitmap.biClut(secondByte))
currX += 1
Next i
'If 0 <> (firstByte And &H1) Then
' br.ReadByte()
'End If
If firstByte And &H1 Then ' if the run doesn't end on a word boundary,
br.ReadByte()
End If
End Select
End If
Loop我现在不知道VirtualDub,FFMPEG和其他人是如何不使用旧的MSRLE.DLL编解码器的.有人有什么想法吗?
发布于 2015-03-11 01:47:43
我找到了解决方案,所以我会在这里回答,这样像我这样的人就有了一个起点。
帧数据正在正确地解压缩。问题是我没有正确遵循RIFF规格。对于我的视频,每一帧都是解压缩的。
https://stackoverflow.com/questions/28956728
复制相似问题