资源简介
海康H.264解码 yv12转换成rgb格式
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Drawing;
using System.IO;
namespace NetViewApp
{
public class YV12ToBMP
{
///BMP文件头结构
[StructLayout(LayoutKind.Sequential)]
public struct BITMAPINFOHEADER
{
[MarshalAs(UnmanagedType.I4)]
public int biSize;
[MarshalAs(UnmanagedType.I4)]
public Int32 biWidth;
[MarshalAs(UnmanagedType.I4)]
public Int32 biHeight;
[MarshalAs(UnmanagedType.I2)]
public short biPlanes;
[MarshalAs(UnmanagedType.I2)]
public short biBitCount;
[MarshalAs(UnmanagedType.I4)]
public UInt32 biCompression;
[MarshalAs(UnmanagedType.I4)]
public UInt32 biSizeImage;
[MarshalAs(UnmanagedType.I4)]
public Int32 biXPelsPerMeter;
[MarshalAs(UnmanagedType.I4)]
public Int32 biYPelsPerMeter;
[MarshalAs(UnmanagedType.I4)]
public UInt32 biClrUsed;
[MarshalAs(UnmanagedType.I4)]
public UInt32 biClrImportant;
}
public BITMAPINFOHEADER BMPInfoHead()
{
BITMAPINFOHEADER myheader = new BITMAPINFOHEADER();
myheader.biSize = 40;
myheader.biPlanes = 1;
myheader.biBitCount = 24;
myheader.biCompression = 0;
myheader.biWidth = width;
myheader.biHeight = -height; // bmp.Height;
//myheader.biSizeImage = (uint)rgb24.Length;
//myheader.biXPelsPerMeter = 0;
//myheader.biYPelsPerMeter = 0;
//myheader.biClrUsed = 0;
//myheader.biClrImportant = 0;
return myheader;
//结构体指针用法
//IntPtr pp = Marshal.AllocHGlobal(Marshal.SizeOf(myheader));
//Marshal.StructureToPtr(myheader pp true);
//Marshal.FreeHGlobal(pp);
}
private int width;
private int height;
private int length;
private int v; //v值的起始位置
private int u; //u值的起始位置
private int[] Table_fv1;
private int[] Table_fv2;
private int[] Table_fu1;
private int[] Table_fu2;
private int[] rgb = new int[3];
private int rdif invgdif bdif;
private int m n i j hfWidth;
private bool addHalf = true;
private int py;
private int pos pos1;//dopod 595 图像调整
private byte temp;
private int bytePerLine;
private byte[] rgb24;
public YV12ToBMP(int iWidth int iHeight)
{
Table_fv1 = new int[256] { -180 -179 -177 -176 -174 -173 -172 -170 -169 -167 -166 -165 -163 -162 -160 -159 -158 -156 -155 -153 -152 -151
- 上一篇:曼哈顿路径预测算法C#寻路
- 下一篇:c#时间片轮转算法
相关资源
- C#解析HL7消息的库135797
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
评论
共有 条评论