Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se |
|
|
#1 | Link |
|
Registered User
Join Date: May 2003
Location: Germany
Posts: 502
|
MakeWritable and hidden bitblts
Does env->MakeWritable(&df) trigger an internal bitblt, if the Avisynths cache is enabled and can this bitblt be avoided if child->SetCacheHints(CACHE_NOTHING, 0) is called in the filter contructor?
|
|
|
|
|
|
#2 | Link |
|
Registered User
Join Date: Oct 2001
Location: france
Posts: 521
|
src/core/avisynth.cpp
Code:
bool ScriptEnvironment::MakeWritable(PVideoFrame* pvf) {
const PVideoFrame& vf = *pvf;
// If the frame is already writable, do nothing.
if (vf->IsWritable()) {
return false;
}
// Otherwise, allocate a new frame (using NewVideoFrame) and
// copy the data into it. Then modify the passed PVideoFrame
// to point to the new buffer.
const int row_size = vf->GetRowSize();
const int height = vf->GetHeight();
PVideoFrame dst;
if (vf->GetPitch(PLANAR_U)) { // we have no videoinfo, so we can only assume that it is Planar
dst = NewPlanarVideoFrame(row_size, height, FRAME_ALIGN,false); // Always V first on internal images
} else {
dst = NewVideoFrame(row_size, height, FRAME_ALIGN);
}
BitBlt(dst->GetWritePtr(), dst->GetPitch(), vf->GetReadPtr(), vf->GetPitch(), row_size, height);
// Blit More planes (pitch, rowsize and height should be 0, if none is present)
BitBlt(dst->GetWritePtr(PLANAR_V), dst->GetPitch(PLANAR_V), vf->GetReadPtr(PLANAR_V), vf->GetPitch(PLANAR_V), vf->GetRowSi
ze(PLANAR_V), vf->GetHeight(PLANAR_V));
BitBlt(dst->GetWritePtr(PLANAR_U), dst->GetPitch(PLANAR_U), vf->GetReadPtr(PLANAR_U), vf->GetPitch(PLANAR_U), vf->GetRowSi
ze(PLANAR_U), vf->GetHeight(PLANAR_U));
*pvf = dst;
return true;
}
But I guess that for what you are asking, the setCache() does not avoid to trigger any bitblt() code, as you still need to create a frame. So what do you want to do exactly? esby
__________________
http://esby.free.fr/ |
|
|
|
|
|
#3 | Link |
|
Registered User
Join Date: May 2003
Location: Germany
Posts: 502
|
Thanks for the (disappointing) information. I think that Avisynth could be smarter. If the cache is disabled with child->SetCacheHints(CACHE_NOTHING, 0), then it should be clear that the frame is not requested again. Thus there is no need to keep a copy in this case.
|
|
|
|
|
|
#4 | Link |
|
Retired AviSynth Dev ;)
![]() Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
|
...but other filters may have the same input, thus requiering a writeable frame. Consider this script:
v=avisource() a=yourfilter(v) b=anotherfilter(v) return overlay(a,b) Both yourfilter() and antherfiler() will request the same frame from the source. If both make them writable a bitblit is inavoidable.
__________________
Regards, sh0dan // VoxPod |
|
|
|
|
|
#5 | Link | |
|
Registered User
Join Date: May 2003
Location: Germany
Posts: 502
|
Quote:
|
|
|
|
|
|
|
#6 | Link | |
|
Avisynth 3.0 Developer
Join Date: Jan 2002
Location: France
Posts: 639
|
Quote:
|
|
|
|
|
|
|
#7 | Link | |
|
Registered User
Join Date: May 2003
Location: Germany
Posts: 502
|
Quote:
Last edited by kassandro; 27th April 2005 at 09:10. |
|
|
|
|
|
|
#8 | Link | |
|
Avisynth 3.0 Developer
Join Date: Jan 2002
Location: France
Posts: 639
|
Quote:
So in your case, cache sizes never grow, and MakeWritable will never blit. (though there is no more MakeWritable, it is implicitly done for you) Last edited by Bidoche; 28th April 2005 at 12:48. |
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|