资源简介
海康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#时间片轮转算法
- 曼哈顿路径预测算法C#寻路
- 基于C#的波形显示控件的实现源码
- C# 斑马标签打印 WEB&WINFORM
- C# TCP服务器客户端通讯源码
- C#窗体小程序,实现文件夹创建、删除
- C#连接Oracle10g,11g,12g所需的DLL无需安
- C#Winform 销售管理系统
- 服务端获取DTU GPRS数据C#
-
Js to CSharp sc
ript converter - 测控课程设计ad转换程序
- Head First C#(第二版)中文版
- 简单的C#课程设计
- 基于讯飞的离线语音识别C#
- 基于C#的五点N次平滑算法
- c#上位机开发.txt
- 科达数据读取
- C#实现坐标转换
- c# socket 异步通信,一个服务器端和多
- 基于C#的实验室设备管理系统
- kepware c# demo
- C# u盘操作源代码
- AnimatedGifEncoder 类 c# 制作 gif 用到
- C# ECHART WPF 开发,非常漂亮的demo
- modbus协议的上位机
- 旅行商问题 遗传算法 贪婪基因重组
- C#利用fft实现快速卷积
- C# 矩阵运算实数+复数
- Winform分页控件(C#)
- 用VS2010做的绘图板C#
评论
共有 条评论