Skip to content

Commit

Permalink
fix image upload when we need to re-stride it as we copy the data
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@8176 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Dec 3, 2014
1 parent b3edefc commit 397c12e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/xpra/codecs/nvenc4/encoder.pyx
Expand Up @@ -1690,7 +1690,7 @@ cdef class Encoder:

#FIXME: we should copy from pixels directly..
#copy to input buffer:
if image_stride<self.inputPitch:
if image_stride<=self.inputPitch:
stride = image_stride
assert len(pixels)<=input_size, "too many pixels (expected %s max, got %s) image: %sx%s stride=%s, input buffer: stride=%s, height=%s" % (input_size, len(pixels), w, h, stride, self.inputPitch, self.input_height)
self.inputBuffer.data[:len(pixels)] = pixels
Expand All @@ -1699,7 +1699,9 @@ cdef class Encoder:
#before uploading to the device... this is probably costly!
stride = self.inputPitch
for i in range(h):
self.inputBuffer.data[i*stride:(i+1)*stride] = pixels[i*image_stride:(i+1)*image_stride+stride]
x = i*stride
y = i*image_stride
self.inputBuffer.data[x:x+stride] = pixels[y:y+stride]
log("compress_image(..) host buffer populated with %s bytes (max %s)", len(pixels), input_size)

#copy input buffer to CUDA buffer:
Expand Down

0 comments on commit 397c12e

Please sign in to comment.