View Full Version : YV12: mpeg2dec, mpeg2dec2 and mpeg3dec developers
DSPguru
15th November 2002, 06:29
Originally posted by Nic
I started it & then got completely sidetracked. At present, as far as I know, besweet.dll doesn't let you have access to the output frames (i.e. it gets you to specify an output file then you use *_Burst to send the input packets).
That would need to be changed before a besweet plugin can be made....
-Nic latest beta dll has a new function "SetWriteRoutine", that gets a pointer for the callback function. callback function prototype :
int (*WriteRoutine) (const void*,size_t)
int 21h
15th November 2002, 17:15
where void* contains the processed data and size_t contains size of it in bytes?
DSPguru
15th November 2002, 17:23
Originally posted by int 21h
where void* contains the processed data and size_t contains size of it in bytes? exactly :D
int 21h
15th November 2002, 22:24
What and where do I need to declare to use this new function?
DSPguru
16th November 2002, 06:58
you just need to call this function once, at the very beginning, to set your callback (WriteRoutine).
if you won't do that, BeSweet's defualt WriteRoutine is fwrite ;)
int 21h
16th November 2002, 18:53
and what's the prototype for SetWriteRoutine?
DSPguru
16th November 2002, 20:27
it only gets one parameter. the callback function intself.
Originally posted by DSPguru
latest beta dll has a new function "SetWriteRoutine", that gets a pointer for the callback function. callback function prototype :
int (*WriteRoutine) (const void*,size_t)
int 21h
17th November 2002, 00:52
And no return type right?
DSPguru
17th November 2002, 05:58
right :)
int 21h
17th November 2002, 19:18
I must be dense because I cannot figure out how to get to the SetWriteRoutine function, I tried this:
HINSTANCE hDLL =NULL;
BESWEET BeSweet =NULL;
BURSTS AC3_Bursts =NULL;
BURSTS MPA_Bursts =NULL;
BURSTS PCM16S_Bursts =NULL;
VERSION BS_VERSION =NULL;
LPVOID SetWriteRoutine =NULL;
and later
SetWriteRoutine = (LPVOID) GetProcAddress(hDLL, "SetWriteRoutine");
then setting the routine with SetWriteRoutine(&WriteFunction);
but it won't compile and says:
error: expression must have (pointer-to-) function type
SetWriteRoutine(&WriteAudioData);
Any ideas? Also would it be possible for you to just make a .lib like Azid has? It would make this alot easier because we could just declare prototypes and then make the calls.
[Toff]
17th November 2002, 20:20
First I have not followed all the discussion ;)
Maybe you should define SetWriteRoutine this way :
// ------
int WriteRoutine(const void*,size_t);
// ------
int (__stdcall *SetWriteRoutinePtr)(void);
SetWriteRoutinePtr SetWriteRoutine;
// ------
SetWriteRoutine = (SetWriteRoutinePtr)GetProcAddress(hDLL, "SetWriteRoutine");
SetWriteRoutine(WriteRoutine);
// ------
int WriteRoutine(const void*,size_t)
{
...
}
(humm, aren't we offtopic here ???)
int 21h
17th November 2002, 20:51
Originally posted by [Toff]
(humm, aren't we offtopic here ???)
Yes, we are ;)
This code doesn't work either, I guess I need more guidance from DSPGuru.
DSPguru
18th November 2002, 18:17
here's how i would have write this code (if i only had the time :(!) :
typedef int (*WRITEROUTINE) (const void*,size_t);
typedef (*SETWRITEROUTINE) (WRITEROUTINE*);
SetWriteRoutine = (SETWRITEROUTINE) GetProcAddress(hDLL, "SetWriteRoutine");
SetWriteRoutine(&WriteFunction);
as for .lib -
that's a good idea :)
Wilbert
28th November 2002, 11:05
@int 21h,
Any progress?
@Sh0dan,
I've some questions about the audio in v2.5. Let's look at your script:
Mpeg2dec2("poelle.d2v")
audiodub(AudioSource("poelle.ac3"))
trim(505,-10000)
l_ch = getchannel(1)
r_ch = getchannel(2)
mergechannels(l_ch,r_ch).normalize().ssrc(rate=44100)
1) How are the channels numbered. I.e. is channel 1 the front left channel, channel 2 the front right channel, etc.?
2) If you want to merge all six channels (from different wav files), do you have to apply mergechannels five times? (Ok, problem is that VirtualDub still can't read them ...)
3) In AC3 to MP3 conversions they mix the front, rear, center and LFE channels. Can you do something like that in AviSynth?
4) When do you need the filter "ConvertAudioToFloat", and what is the purpose of this filter?
5) If the audiosamples are not 8,16,24,32 or float are they still converted to 16 bit (like in v2.0x)?
sh0dan
28th November 2002, 13:44
1) How the individual channels are numbered is up to the input source. In stereo, left is channel 0, right is channel 1.
2) For the moment, yes, but it would actually make sense to be able to give any number of clips. I'll put this on the todo-list.
3) Use GetChannel(int channel) and MixAudio(clip1,clip2 [,float clip1_volume, float clip2_volume]) to do this. MixAudio will mix channel 0 of clip 1 with channel 0 of clip two and so forth.
4) & 5) There is now 100% automatic sample conversion between filters. Filters may not support all sample types (typically 16bit and float), and if the sample type isn't this type, it will be converted to the filters prefered format (typically float).
You will never see this conversion, but the filters in general requests the best quality possible. But if the filter supports both 16bit and float input, and the input is 16bit, the samples are not converted to float!
"ConvertAudioToFloat" will forcibly convert to float.
If the sample type is float, when AviSynth has to output the data, it will be converted to 16bit, since float cannot be passed as valid AVI data.
Guest
30th November 2002, 04:27
I've just returned to this thread after long.
I wanted to say thank you to all who expressed sympathies and condolences to me, and to say of course the "call for the mod" was not out of line.
You're a great bunch of people.
Wilbert
4th December 2002, 10:46
1) How the individual channels are numbered is up to the input source. In stereo, left is channel 0, right is channel 1.
... left is channel 1, right is channel 2. But ok.
2) For the moment, yes, but it would actually make sense to be able to give any number of clips. I'll put this on the todo-list.
I saw that you already have done this. Thanks!
If the sample type is float, when AviSynth has to output the data, it will be converted to 16bit, since float cannot be passed as valid AVI data.
What if the output is 24 or 32 bit? (I saw that Virtualdub only can process 8 or 16 bit.)
I've done some tests with this multichannel stuff:
clip = AviSource("F:\test\red_ac3.avi")
# When opening in VdubMod/WMP6.4 it gives:
# ACM failed to suggest a compatible PCM format
# (F:\test\red.avs, line 1)
[The same message is shown if you use getchannel and mergechannels so that the output has only two channels instead of six. So AviSource can't open an avi+ac3 file. Note that VdubMod can open the avi itself.]
# ac3 --> (uncompressed) wav5.1 besweet --> muxed with VdubMod
clip = AviSource("F:\test\red_wav51.avi")
c1 = clip.GetChannel(1)
c2 = clip.GetChannel(2)
MergeChannels(c1, c2)
# When opening in VdubMod/WMP6.4 it gives:
# file info is correct;
# VdubMod just crashed when starting encoding
[So I converted the ac3 to an uncompressed six channel wav in Besweet and muxed it with the avi. Apperently AviSource can open the file since the file info. in Vdubmod is correct. But when you start encoding it just crashes. (I put the audio on encoding to "uncompressed wav" in VdubMod.)]
# ac3 --> (uncompressed) wav5.1 besweet --> muxed with VdubMod
clip = AviSource("F:\test\red_wav51.avi")
clip.GetChannel(1)
# When opening in VdubMod/WMP6.4 it gives:
# file info is correct;
# access violation at 0x065b4f64, attempting to write to 0x063ac000
[So I converted the ac3 to an uncompressed six channel wav in Besweet and muxed it with the avi, and I took the first channel. Apperently AviSource can open the file since the file info. in Vdubmod is correct. But when you start encoding it gives an access violation.]
# xvid+mp3
clip = AviSource("F:\test\test.avi")
clip.GetChannel(1)
# When opening in VdubMod/WMP6.4 it gives:
# file info is correct;
# access violation at 0x065b4f64, attempting to write to 0x0649c000
[Same problem as above.]
# xvid+mp3
clip = AviSource("F:\test\test.avi")
c1 = clip.GetChannel(1)
c2 = clip.GetChannel(2)
MergeChannels(c1, c2)
# When opening in VdubMod/WMP6.4 it gives:
# file info is correct;
# VdubMod just crashed when starting encoding
[Same problem as above.]
conclusions:
1) If the audio in uncompressed 6 channel wav, VdubMod will crash.
2) If the audio in 6 channel ac3, AviSource can't open it.
3) If you do something with getchannel/mergechannels (even if the input is a normal avi with mp3 or uncompressed two channel wav) VdubMod will crash.
other bugs:
1) VdubMod/WMP6.4 will crash if the path in AviSource doesn't exist (instead of giving an error message).
2) VdubMod/WMP6.4 will crash using a filter which doesn't exist (instead of given the error message "don't know what xxx means".
Let me know if you want me to do some other tests.
Wilbert
6th December 2002, 11:03
Oops. The arguments of mergechannels/getchannel must be wav files (I guess). Thus
# ac3 --> (uncompressed) wav5.1 besweet --> muxed with VdubMod
video = AviSource("F:\test\red_wav51.avi")
audio = WavSource("F:\test\red_wav51.avi").GetChannel(1,2)
AudioDub(video, audio)
Encoding goes fine in Vdubmod. Except that the sound was crippled, but that could be a problem of the source. The ac3 file plays fine but I can't play the 6 channel wav. Anyone know how to play them?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.