Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinPulec committed Jan 15, 2025
1 parent 7403c40 commit 112e695
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/gpujpeg_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,17 @@ gpujpeg_decoder_decode(struct gpujpeg_decoder* decoder, uint8_t* image, size_t i
GPUJPEG_CUSTOM_TIMER_START(coder->duration_memory_to, coder->param.perf_stats, decoder->stream, return -1);

// Copy scan data to device memory
cudaMemcpyAsync(coder->d_data_compressed, coder->data_compressed, decoder->data_compressed_size * sizeof(uint8_t), cudaMemcpyHostToDevice, decoder->stream);
gpujpeg_cuda_check_error("Decoder copy compressed data", return -1);
cudaMemcpyAsync(coder->d_data_compressed, coder->data_compressed,
MIN(decoder->data_compressed_size * sizeof(uint8_t), coder->data_compressed_pinned_sz),
cudaMemcpyHostToDevice, decoder->stream);
gpujpeg_cuda_check_error("Decoder copy compressed data to pinned memory", return -1);
if ( decoder->data_compressed_size * sizeof(uint8_t) > coder->data_compressed_pinned_sz ) {
cudaMemcpyAsync(coder->d_data_compressed + coder->data_compressed_pinned_sz,
coder->d_data_compressed + coder->data_compressed_pinned_sz,
decoder->data_compressed_size - coder->data_compressed_pinned_sz, cudaMemcpyHostToDevice,
decoder->stream);
gpujpeg_cuda_check_error("Decoder copy compressed data to pageable memory", return -1);
}

// Copy segments to device memory
cudaMemcpyAsync(coder->d_segment, coder->segment, decoder->segment_count * sizeof(struct gpujpeg_segment), cudaMemcpyHostToDevice, decoder->stream);
Expand Down

0 comments on commit 112e695

Please sign in to comment.