[PATCH 4/5] qcap: Get rid of an unnecessary allocation and copy.

Zebediah Figura z.figura12 at gmail.com
Wed Apr 10 22:32:02 CDT 2019


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 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 fb10cce283..74443291c9 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;
 }
 
-- 
2.21.0




More information about the wine-devel mailing list