Zebediah Figura : qcap: Get rid of an unnecessary allocation and copy.

Alexandre Julliard julliard at winehq.org
Thu Apr 11 13:10:30 CDT 2019


Module: wine
Branch: master
Commit: 2011518d30b7af6ff715d59cc1edcf5aa5ead45a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=2011518d30b7af6ff715d59cc1edcf5aa5ead45a

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed Apr 10 22:32:02 2019 -0500

qcap: Get rid of an unnecessary allocation and copy.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/qcap/v4l.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/dlls/qcap/v4l.c b/dlls/qcap/v4l.c
index fb10cce..7444329 100644
--- a/dlls/qcap/v4l.c
+++ b/dlls/qcap/v4l.c
@@ -367,7 +367,7 @@ static DWORD WINAPI ReadThread(LPVOID lParam)
     HRESULT hr;
     IMediaSample *pSample = NULL;
     ULONG framecount = 0;
-    unsigned char *pTarget, *pOutput;
+    unsigned char *pTarget;
 
     capBox->image_size = capBox->height * capBox->width * 3;
     if (!(capBox->image_data = heap_alloc(capBox->image_size)))
@@ -378,8 +378,6 @@ static DWORD WINAPI ReadThread(LPVOID lParam)
         return 0;
     }
 
-    pOutput = CoTaskMemAlloc(capBox->width * capBox->height * capBox->bitDepth / 8);
-
     while (1)
     {
         EnterCriticalSection(&capBox->CritSect);
@@ -410,8 +408,7 @@ static DWORD WINAPI ReadThread(LPVOID lParam)
                 }
             }
 
-            memcpy(pOutput, capBox->image_data, len);
-            Resize(capBox, pTarget, pOutput);
+            Resize(capBox, pTarget, capBox->image_data);
             hr = BaseOutputPinImpl_Deliver((BaseOutputPin *)capBox->pOut, pSample);
             TRACE("%p -> Frame %u: %x\n", capBox, ++framecount, hr);
             IMediaSample_Release(pSample);
@@ -428,7 +425,6 @@ static DWORD WINAPI ReadThread(LPVOID lParam)
     }
 
     LeaveCriticalSection(&capBox->CritSect);
-    CoTaskMemFree(pOutput);
     return 0;
 }
 




More information about the wine-cvs mailing list