cuda-samples icon indicating copy to clipboard operation
cuda-samples copied to clipboard

[NV12toBGRandResize] output raw files with all of 0 value.

Open jskimn opened this issue 1 year ago • 0 comments

Sample name: 5_Domain_Specific/NV12toBGRandResize Environment: Windows VS2019.

After nv12ToBGRplanarBatch kernel, d_outputBGR has all of 0 value. And 'output/t1/converted_bgr_640x480_1.raw" has all of 0 value. I checked that 'nv12ToBGRplanarBatch' kernel has some problem like following code.

for (int i = 0; i < TEST_LOOP; i++) {
    nv12ToBGRplanarBatch(d_resizedNV12, g_ctx.dst_pitch,  // intput
                         d_outputBGR,
                         g_ctx.dst_pitch,    // output
                         g_ctx.dst_width, g_ctx.dst_height,  // output
                         g_ctx.batch, 0);
  }
  cudaEventRecord(stop, 0);
  cudaEventSynchronize(stop);

  int dataSize = g_ctx.dst_pitch * g_ctx.dst_height * 3 * g_ctx.batch * sizeof(float);
  char* cpuData = new char[dataSize];
  checkCudaErrors(cudaMemcpy((void*)cpuData, (void*)d_outputBGR, dataSize, cudaMemcpyDeviceToHost));
  int temp = 0;
  delete[] cpuData;

When I break at "int temp = 0" line, I could see that 'cpuData' has all of 0 value. What did I do wrong?

jskimn avatar Jun 26 '24 08:06 jskimn