|
|
| jpsdr |
| Posted: Sep 8 2008, 10:50 AM |
 |
|
Advanced Member
  
Group: Members
Posts: 335
Member No.: 20490
Joined: 23-December 06

|
Hello.
Something is bugging me a little.
If in a filter, the flag FILTERPARAM_SWAP_BUFFERS isn't used, it seems that *src and *dst can overlap.
In case of single memory transfert, can we do (as said in SDK) :
for i=0; i<h ; i++ { memcpy(dst,src,line_size) src+=src_pitch dst+=dst_pitch }
or is it safer to do
for i=0; i<h ; i++ { memmove(dst,src,line_size) src+=src_pitch dst+=dst_pitch }
??????? |
 |
| phaeron |
| Posted: Sep 9 2008, 05:38 AM |
 |
|

Virtualdub Developer
  
Group: Administrator
Posts: 7773
Member No.: 61
Joined: 30-July 02

|
Almost.
If you fail to pass the FILTERPARAM_SWAP_BUFFERS flag, it isn't that the buffers can overlap. You're requesting that they overlap. That means that the memcpy() loop is always bad and the memmove() loop is OK, although strange (and probably unnecessary). I don't know of any implementations of memcpy() that will screw up if you pass exactly the same pointer for src and dst, but technically any overlapping memcpy() invokes undefined behavior according to the C standard. |
 |