Skip to content

Commit

Permalink
Update to r3
Browse files Browse the repository at this point in the history
Add 16 bit depth support
  • Loading branch information
WolframRhodium committed Jun 3, 2017
1 parent e2e7293 commit f64d32a
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 319 deletions.
22 changes: 9 additions & 13 deletions Source/dpid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#include <cmath>
#include <string>

#include <vapoursynth\VapourSynth.h>
#include <vapoursynth\VSHelper.h>
#include "vapoursynth\VapourSynth.h"
#include "vapoursynth\VSHelper.h"
#include "dpid.h"

struct DpidData {
VSNodeRef * node;
Expand All @@ -13,13 +14,8 @@ struct DpidData {
uint16_t * src16Interleaved, *dst16Interleaved;
};

struct Params {
uint32_t oWidth, oHeight, iWidth, iHeight, pixel_max;
float pWidth, pHeight, lambda;
};

void run8(Params& i, const void* hInput, void* hOutput);
void run16(Params& i, const void* hInput, void* hOutput);
extern void run8(Params& i, const void* hInput, void* hOutput);
extern void run16(Params& i, const void* hInput, void* hOutput);

static void process8(const VSFrameRef * src, VSFrameRef * dst, DpidData * d, const VSAPI * vsapi)
{
Expand All @@ -39,8 +35,8 @@ static void process8(const VSFrameRef * src, VSFrameRef * dst, DpidData * d, con
args.iHeight = height;
args.oWidth = d->vi.width;
args.oHeight = d->vi.height;
//args.pWidth = args.iWidth / (float)args.oWidth;
//args.pHeight = args.iHeight / (float)args.oHeight; // This args broke when the struct "Params" contained "pixel_max".
args.pWidth = args.iWidth / (float)args.oWidth;
args.pHeight = args.iHeight / (float)args.oHeight;
args.lambda = d->lambda;
args.pixel_max = (1 << d->vi.format->bitsPerSample) - 1;

Expand Down Expand Up @@ -95,8 +91,8 @@ static void process16(const VSFrameRef * src, VSFrameRef * dst, DpidData * d, co
args.iHeight = height;
args.oWidth = d->vi.width;
args.oHeight = d->vi.height;
//args.pWidth = args.iWidth / (float)args.oWidth;
//args.pHeight = args.iHeight / (float)args.oHeight; // This args broke when the struct "Params" contained "pixel_max".
args.pWidth = args.iWidth / (float)args.oWidth;
args.pHeight = args.iHeight / (float)args.oHeight;
args.lambda = d->lambda;
args.pixel_max = (1 << d->vi.format->bitsPerSample) - 1;

Expand Down
11 changes: 11 additions & 0 deletions Source/dpid.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef DPID_H_
#define DPID_H_

#include <cstdint>

struct Params {
uint32_t oWidth, oHeight, iWidth, iHeight, pixel_max;
float pWidth, pHeight, lambda;
};

#endif
300 changes: 0 additions & 300 deletions Source/kernel.cu

This file was deleted.

3 changes: 0 additions & 3 deletions Source/kernel16.cu
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,6 @@ void run16(Params& i, const void* hInput, void* hOutput)
check(cudaMalloc(&dOutput, sOutput));
check(cudaMalloc(&dGuidance, sGuidance));

i.pHeight = i.iHeight / (float)i.oHeight;
i.pWidth = i.iWidth / (float)i.oWidth;

// copy data
check(cudaMemcpy(dInput, hInput, sInput, cudaMemcpyHostToDevice));

Expand Down
3 changes: 0 additions & 3 deletions Source/kernel8.cu
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,6 @@ void run8(Params& i, const void* hInput, void* hOutput)
check(cudaMalloc(&dOutput, sOutput));
check(cudaMalloc(&dGuidance, sGuidance));

i.pHeight = i.iHeight / (float)i.oHeight;
i.pWidth = i.iWidth / (float)i.oWidth;

// copy data
check(cudaMemcpy(dInput, hInput, sInput, cudaMemcpyHostToDevice));

Expand Down
3 changes: 3 additions & 0 deletions Source/vapoursynth-dpid/vapoursynth-dpid.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@
<CudaCompile Include="..\kernel16.cu" />
<CudaCompile Include="..\kernel8.cu" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\dpid.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 8.0.targets" />
Expand Down
Loading

0 comments on commit f64d32a

Please sign in to comment.