delphi2007:"Invalid floating point operation" 错误的解决方法
2011-08-01 09:11
495 查看
这两天用使用海思的库hi_h264dec_w.dll(版本v2.2.2.0.2)解码时,在直接拷贝时出现"Invalid floating point operation.”的错误;
目前根据网络资料,屏蔽FPU错误,由于功能正常,因此具体原因还没有去分析,代码如下:
function TVideoDecoder.DecodeVideoFrame(var frame: H264_frame): boolean;
var
fOutFrame: H264_DEC_FRAME_S; //解码帧
iy, iuv: integer; //yuv长度,u的长度
Saved8087CW: Word;//Default 8087 control word. FPU control register is set to this value.
begin
Saved8087CW := Get8087CW; //保存当前
try
Set8087CW($133F); { Disable all fpu exceptions. }
result := DecodeVideoFrame(fOutFrame);
if not result then exit;
frame.FrameNo := fDecFrameCount;
frame.Width := foutframe.uWidth;
frame.Height := foutframe.uHeight;
frame.FrameRate := 25; //默认
frame.PicType := fDecAttr.uPictureFormat;
//拷贝 I420的yuv数据
iy := foutframe.uHeight * foutframe.uYStride;
iuv := foutframe.uHeight * foutframe.uUVStride div 2;
frame.datalen := iy + 2 * iuv;
getmem(frame.data, frame.datalen + 10);
copymemory(frame.data, foutframe.pY, iy);//不设置FPU,那么这句会报错
copymemory(frame.data + iy, foutframe.pu, iuv);
copymemory(frame.data + iy + iuv, foutframe.pv, iuv);
{$IFDEF __SaveH264}
if result then
fYuvStream.Write(frame.data[0], frame.datalen);
{$ENDIF}
finally
Set8087CW(Saved8087CW); //恢复
end;
end;
关于FPU的设置,有几个建议:
1)It is recommend that you disable all floating-point exceptions when using OpenGL to render 3D graphics;
2)如果在程序中使用了SceneControl.LoadSxFile载入了3D文档,那么必须在程序退出时,在Set8087CW之前调用IScene的ClearLayers方法清除图层,否则程序在退出时会出现异常。参考代码为:SceneControl1.Scene.ClearLayers;
参考文档(非常感谢以下文章):
1) http://www.langjisky.com/netdown/?type=detail&id=99
2) /article/5780507.html
目前根据网络资料,屏蔽FPU错误,由于功能正常,因此具体原因还没有去分析,代码如下:
function TVideoDecoder.DecodeVideoFrame(var frame: H264_frame): boolean;
var
fOutFrame: H264_DEC_FRAME_S; //解码帧
iy, iuv: integer; //yuv长度,u的长度
Saved8087CW: Word;//Default 8087 control word. FPU control register is set to this value.
begin
Saved8087CW := Get8087CW; //保存当前
try
Set8087CW($133F); { Disable all fpu exceptions. }
result := DecodeVideoFrame(fOutFrame);
if not result then exit;
frame.FrameNo := fDecFrameCount;
frame.Width := foutframe.uWidth;
frame.Height := foutframe.uHeight;
frame.FrameRate := 25; //默认
frame.PicType := fDecAttr.uPictureFormat;
//拷贝 I420的yuv数据
iy := foutframe.uHeight * foutframe.uYStride;
iuv := foutframe.uHeight * foutframe.uUVStride div 2;
frame.datalen := iy + 2 * iuv;
getmem(frame.data, frame.datalen + 10);
copymemory(frame.data, foutframe.pY, iy);//不设置FPU,那么这句会报错
copymemory(frame.data + iy, foutframe.pu, iuv);
copymemory(frame.data + iy + iuv, foutframe.pv, iuv);
{$IFDEF __SaveH264}
if result then
fYuvStream.Write(frame.data[0], frame.datalen);
{$ENDIF}
finally
Set8087CW(Saved8087CW); //恢复
end;
end;
关于FPU的设置,有几个建议:
1)It is recommend that you disable all floating-point exceptions when using OpenGL to render 3D graphics;
2)如果在程序中使用了SceneControl.LoadSxFile载入了3D文档,那么必须在程序退出时,在Set8087CW之前调用IScene的ClearLayers方法清除图层,否则程序在退出时会出现异常。参考代码为:SceneControl1.Scene.ClearLayers;
参考文档(非常感谢以下文章):
1) http://www.langjisky.com/netdown/?type=detail&id=99
2) /article/5780507.html
相关文章推荐
- delphi “Invalid floating point operation.”错误的解决方法
- Delphi “Invalid floating point operation.”错误的解决方法(使用System单元提供的Set8087CW函数禁用浮点异常)
- delphi “Invalid floating point operation.”错误的解决方法
- Delphi中WebBrowser(或者EmbeddedWebBrowser)控件打开部分网站报“Invalid floating point operation”异常的解决方法
- 调用Application.Quit()方法时报"This operation cannot be performed in this event handler."错误的一种解决方法
- Delphi中WebBrowser(或者EmbeddedWebBrowser)控件打开部分网站报“Invalid floating point operation”异常的解决方法
- EmbeddedWebBrowser网站报“Invalid floating point operation”异常的解决方法
- Delphi中WebBrowser控件打开部分网站报"Invalid floating point operation”解决
- Delphi中WebBrowser(或者EmbeddedWebBrowser)控件打开部分网站报“Invalid floating point operation”异常的解决方法
- 关于delphi软件运行出现Invalid floating point operation的错误的解决办法
- Delphi中WebBrowser(或者EmbeddedWebBrowser)控件打开部分网站报“Invalid floating point operation”异常的解决方法
- 解决提示:Invalid floating point operation.无效的浮点运算
- MySQL Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (utf8_general_ci,IMPLICIT) for operation 'UNION' 错误解决方法
- "com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown column"错误解决方法
- "控件必须放在具有 runat=server 的窗体标记内"错误的解决方法
- 使用Vue.js加sass时遇到 Invalid CSS after ".xxx{": expected "}", was "{" 错误的解决方法
- 用户"sa "登陆失败 SQLServer 错误18456----解决方法
- Environment error: "JAVA_HOME" should not be defined. 错误解决方法
- 用户"sa "登陆失败 SQLServer 错误18456----解决方法
- C++编译错误"a storage class can only be specified for objects and functions"解决方法