Hi Richard,

Nice to see that you've got yourself a fix. But you are leaking your
> temp buffer -- you'll need to free it somewhere.
>

Thanks,
I've already solved this leakage...
yesterday I've posted a new mail with some corrections, including this one.
I hope it will be published soon on the uvcvideo mailing list.


> But it does seem expensive to copy the data 3 times.


Why "3 time"? In "uvc_video_decode_data" function "memcpy" is called just 2
times. ;)


> Could you do
> something like this instead?
>
> int *src = (int*) data + len;
> int *dst = (int*) buffer;
>
> for ( int i= 0; i < len /sizeof(int); i++) {
>        src--;
>        *dst++ = *src;
> }
>
> that way you only have to copy the data once and you don't need a
> temporary buffer.
>

thank you for the suggestion but the problem is that I've already tried this
solution, and thanks to it I've understood that "data" doesn't contain a
full image, but just one part. So in order to complete an image, the
function "uvc_video_decode_data" has to be called different times.
Each time data is copyed into "mem", where:
  mem = queue->mem + buf->buf.m.offset + buf->buf.bytesused;
// "queue->mem" and "buf->buf.m.offset" are constant in relation to the same
image
  buf->buf.bytesused += nbytes;
// "nbytes" is just the number of bytes copied in the current call of
"uvc_video_decode_data"

So before to flip the image I have to wait that the frame is fully captured:
"if (len >= maxlen)" statement just helps in solving this need.
I've added the "=" condition, but I'm not sure about it.
I hope someone could give me confirmation of this.

Please Richard let me know if I've misunderstood your suggestions or if you
don't agree with my explanation.

Just for now,
thank you for your interest.

Marco Argiolas
_______________________________________________
Linux-uvc-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/linux-uvc-devel

Reply via email to