tateu
8th October 2005, 00:09
I am writing an OMF import (and hopefully, one day, export) filter for Avisynth. The uncompressed OMFs I am working with are in CCIR601 (16-235 range) YUY2 format with each field written sequentially in the file. I have no trouble reading these files. I create a YUY2 PVideoframe and copy the OMF data directly to it. When I open a script with an uncompressed OMF file in VirtualDub, the levels are correctly expanded back out to 0-255.
The compressed OMFs I have are sequential fields of jpeg data, 16-235 range, but I'm not sure if they are RGB or YUY2. It looks like they are probably RGB, though. If I use a hex editor to copy one field of data to a new file I end up with a 720x248 jpg that can be opened by any program capable of reading jpegs. The file properties list it as 24-bit RGB. My current method of reading this data into Avisynth is to copy the jpeg data for 2 fields into memory and then I use an image library (CxImage) to convert it to uncompressed RGB data which I then copy to a new RGB PVideoframe. I probably should have used DevIL since it is already used in Avisynth but we just bought an AVID at work and I needed to get a working import filter done quickly. I was already familiar with the interface to CxImage so it was easier for me to get done fast.
There are two problems with my current method for compressed OMFs:
1) If the jpeg data is originally in YUY2 format, I'd like to skip the step of converting it to RGB with the image library.
2) When I convert the jpeg data to uncompressed RGB, it still only has a luminance range of 16-235. When I load compressed OMFs into After FX, it expands them back out to a range of 0-255. As a fix, I took the code from Avisynth's Levels.cpp and modified it to work on a PVideoframe instead of a PClip and I use that to expand the levels back to 0-255 before I send the PVideoframe back to Avisynth.
It seems that I have probably answered my own question by looking at the jpeg properties of one of the fields. I just wanted to check and see if anyone knew for sure or had any suggestions for.
The compressed OMFs I have are sequential fields of jpeg data, 16-235 range, but I'm not sure if they are RGB or YUY2. It looks like they are probably RGB, though. If I use a hex editor to copy one field of data to a new file I end up with a 720x248 jpg that can be opened by any program capable of reading jpegs. The file properties list it as 24-bit RGB. My current method of reading this data into Avisynth is to copy the jpeg data for 2 fields into memory and then I use an image library (CxImage) to convert it to uncompressed RGB data which I then copy to a new RGB PVideoframe. I probably should have used DevIL since it is already used in Avisynth but we just bought an AVID at work and I needed to get a working import filter done quickly. I was already familiar with the interface to CxImage so it was easier for me to get done fast.
There are two problems with my current method for compressed OMFs:
1) If the jpeg data is originally in YUY2 format, I'd like to skip the step of converting it to RGB with the image library.
2) When I convert the jpeg data to uncompressed RGB, it still only has a luminance range of 16-235. When I load compressed OMFs into After FX, it expands them back out to a range of 0-255. As a fix, I took the code from Avisynth's Levels.cpp and modified it to work on a PVideoframe instead of a PClip and I use that to expand the levels back to 0-255 before I send the PVideoframe back to Avisynth.
It seems that I have probably answered my own question by looking at the jpeg properties of one of the fields. I just wanted to check and see if anyone knew for sure or had any suggestions for.