以FFmpeg为数据源的NvDecodeD3D9


修改NVIDIA VIDEO CODEC SDK中 NvDecodeD3D9的数据源为FFmpeg,弥补原生SDK不能以流作为数据源的不足
资源截图
代码片段和文件信息
/*
 * Copyright 1993-2014 NVIDIA Corporation.  All rights reserved.
 *
 * Please refer to the NVIDIA end user license agreement (EULA) associated
 * with this source code for terms and conditions that govern your use of
 * this software. Any use reproduction disclosure or distribution of
 * this software and related documentation outside the terms of the EULA
 * is strictly prohibited.
 *
 */

/* This example demonstrates how to use the Video Decode Library with CUDA
 * bindings to interop between CUDA and DX9 textures for the purpose of post
 * processing video.
 */

#include “cudaProcessframe.h“

#include 
#include 
#include 
#include 

#include “dynlink_cuda.h“ // 
#include “dynlink_builtin_types.h“   // 
#include 

// These store the matrix for YUV2RGB transformation
__constant__ float  constHueColorSpaceMat[9];
__constant__ float  constAlpha;


extern “C“
CUresult  updateConstantMemory_drvapi(CUmodule module float *hueCSC)
{
    CUdeviceptr  d_constHueCSC d_constAlpha;
    size_t       d_cscBytes d_alphaBytes;

    // First grab the global device pointers from the CUBIN
    cuModuleGetGlobal(&d_constHueCSC  &d_cscBytes   module “constHueColorSpaceMat“);
    cuModuleGetGlobal(&d_constAlpha   &d_alphaBytes module “constAlpha“);

    CUresult error = CUDA_SUCCESS;

    // Copy the constants to video memory
    cuMemcpyHtoD(d_constHueCSC
                 reinterpret_cast(hueCSC)
                 d_cscBytes);
    getLastCudaDrvErrorMsg(“cuMemcpyHtoD (d_constHueCSC) copy to Constant Memory failed“);


    uint32 cudaAlpha      = ((uint32)0xff<< 24);

    cuMemcpyHtoD(d_constAlpha
                 reinterpret_cast(&cudaAlpha)
                 d_alphaBytes);
    getLastCudaDrvErrorMsg(“cuMemcpyHtoD (constAlpha) copy to Constant Memory failed“);

    return error;
}

extern “C“
void setColorSpaceMatrix(eColorSpace CSC float *hueCSC float hue)
{
    float hueSin = sin(hue);
    float hueCos = cos(hue);

    if (CSC == ITU601)
    {
        //CCIR 601
        hueCSC[0] = 1.1644f;
        hueCSC[1] = hueSin * 1.5960f;
        hueCSC[2] = hueCos * 1.5960f;
        hueCSC[3] = 1.1644f;
        hueCSC[4] = (hueCos * -0.3918f) - (hueSin * 0.8130f);
        hueCSC[5] = (hueSin *  0.3918f) - (hueCos * 0.8130f);
        hueCSC[6] = 1.1644f;
        hueCSC[7] = hueCos *  2.0172f;
        hueCSC[8] = hueSin * -2.0172f;
    }
    else if (CSC == ITU709)
    {
        //CCIR 709
        hueCSC[0] = 1.0f;
        hueCSC[1] = hueSin * 1.57480f;
        hueCSC[2] = hueCos * 1.57480f;
        hueCSC[3] = 1.0;
        hueCSC[4] = (hueCos * -0.18732f) - (hueSin * 0.46812f);
        hueCSC[5] = (hueSin *  0.18732f) - (hueCos * 0.46812f);
        hueCSC[6] = 1.0f;
        hueCSC[7] = hueCos *  1.85560f;
        hueCSC[8] = hueSin * -1.85560f;
    }
}


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-03-24 21:31  ffmpeg  NvDecodeD3D9
     目录           0  2017-03-24 21:31  ffmpeg  NvDecodeD3D9NvDecodeD3D9
     文件        4774  2016-11-23 18:34  ffmpeg  NvDecodeD3D9NvDecodeD3D9frameQueue.cpp
     文件        2828  2016-11-23 18:34  ffmpeg  NvDecodeD3D9NvDecodeD3D9frameQueue.h
     文件        6876  2016-11-23 18:34  ffmpeg  NvDecodeD3D9NvDecodeD3D9ImageDX.cpp
     文件        3647  2016-11-23 18:34  ffmpeg  NvDecodeD3D9NvDecodeD3D9ImageDX.h
     文件       54770  2017-03-22 19:00  ffmpeg  NvDecodeD3D9NvDecodeD3D9NvDecodeD3D9.cpp
     文件        1324  2017-03-10 16:11  ffmpeg  NvDecodeD3D9NvDecodeD3D9NvDecodeD3D9_2013.sln
     文件       12116  2017-03-22 19:00  ffmpeg  NvDecodeD3D9NvDecodeD3D9NvDecodeD3D9_2013.vcxproj
     文件        7864  2017-03-21 22:10  ffmpeg  NvDecodeD3D9NvDecodeD3D9VideoDecoder.cpp
     文件        2418  2016-11-23 18:34  ffmpeg  NvDecodeD3D9NvDecodeD3D9VideoDecoder.h
     文件        4338  2017-03-14 11:08  ffmpeg  NvDecodeD3D9NvDecodeD3D9VideoParser.cpp
     文件        3647  2016-11-23 18:34  ffmpeg  NvDecodeD3D9NvDecodeD3D9VideoParser.h
     文件        9857  2017-03-21 22:10  ffmpeg  NvDecodeD3D9NvDecodeD3D9VideoSource.cpp
     文件        4655  2017-03-20 11:23  ffmpeg  NvDecodeD3D9NvDecodeD3D9VideoSource.h
     文件       31116  2015-12-10 10:28  ffmpeg  NvDecodeD3D9NvDecodeD3D9callback.hpp
     文件        5909  2016-11-23 18:34  ffmpeg  NvDecodeD3D9NvDecodeD3D9cudaProcessframe.cpp
     文件        2302  2016-11-23 18:34  ffmpeg  NvDecodeD3D9NvDecodeD3D9cudaProcessframe.h
     目录           0  2017-03-24 21:31  ffmpeg  NvDecodeD3D9NvDecodeD3D9 hird_party
     目录           0  2017-03-24 21:31  ffmpeg  NvDecodeD3D9NvDecodeD3D9 hird_partycuvid
     目录           0  2017-03-24 21:31  ffmpeg  NvDecodeD3D9NvDecodeD3D9 hird_partycuvidinc
     目录           0  2017-03-24 21:31  ffmpeg  NvDecodeD3D9NvDecodeD3D9 hird_partycuvidincGL
     文件         703  2016-11-23 18:34  ffmpeg  NvDecodeD3D9NvDecodeD3D9 hird_partycuvidincGLfreeglut.h
     文件       10682  2016-11-23 18:34  ffmpeg  NvDecodeD3D9NvDecodeD3D9 hird_partycuvidincGLfreeglut_ext.h
     文件       27750  2016-11-23 18:34  ffmpeg  NvDecodeD3D9NvDecodeD3D9 hird_partycuvidincGLfreeglut_std.h
     文件       70198  2016-11-23 18:34  ffmpeg  NvDecodeD3D9NvDecodeD3D9 hird_partycuvidincGLgl.h
     文件      943450  2016-11-23 18:34  ffmpeg  NvDecodeD3D9NvDecodeD3D9 hird_partycuvidincGLglew.h
     文件      691298  2016-11-23 18:34  ffmpeg  NvDecodeD3D9NvDecodeD3D9 hird_partycuvidincGLglext.h
     文件       19252  2016-11-23 18:34  ffmpeg  NvDecodeD3D9NvDecodeD3D9 hird_partycuvidincGLglu.h
     文件         660  2016-11-23 18:34  ffmpeg  NvDecodeD3D9NvDecodeD3D9 hird_partycuvidincGLglut.h
     文件       14378  2016-11-23 18:34  ffmpeg  NvDecodeD3D9NvDecodeD3D9 hird_partycuvidincGLglx.h
............此处省略586个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)