>In case you're interested, I've *finally* posted smilutils to kino CVS.
Still cool.
>Please feel free to report issues or patches (or new tools?) via the
>kino-dev mailing list.
And here is another patch, to add the 4:1:1 mode I mentioned a few weeks ago.
With the patch, if you specify "-i 2" to smil2yuv, then the output
stream will be in the 4:1:1 subsampling mode native to NTSC DV ---
which can then be converted properly to 4:2:0 by y4mscaler. (The
subsampling mode is identified by an 'X' tag in the YUV4MPEG2 header.
This patch also will identify PAL streams as the PAL-DV variant of
4:2:0, so that they can be processed appropriately by y4mscaler.)
I won't get around to packaging a version of y4mscaler which handles all
this properly for another week or so. However, the preliminary testing
I did last night showed a plainly visible improvement in NTSC DV material.
I am pleased with myself.
-matt m.
Here is the patch:
Index: extensions/YUV420Extractor.cc
===================================================================
RCS file: /cvsroot/kino/smilutils/extensions/YUV420Extractor.cc,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 YUV420Extractor.cc
--- extensions/YUV420Extractor.cc 11 Feb 2003 13:22:54 -0000 1.1.1.1
+++ extensions/YUV420Extractor.cc 13 Feb 2003 01:46:22 -0000
@@ -45,6 +45,7 @@
<< " H" << height
<< " F" << ( height == 576 ? "25:1" :
"30000:1001" )
<< (height == 576 ? " Ib A59:54" : " Ib
A10:11")
+ << (height == 576 ? " XYSCSS=420PALDV" : "")
<< std::endl;
return input != NULL;
@@ -177,6 +178,101 @@
}
};
+
+/*
+ * Extracts frames with 4:1:1 subsampling for experimental YUV4MPEG2 mode.
+ * Really only for NTSC DV material
+ *
+ */
+class ExtendedYUV411Extractor : public YUV420Extractor
+{
+public:
+ bool Initialise( Frame &frame )
+ {
+ width = frame.GetWidth( );
+ height = frame.GetHeight( );
+
+ pitches[ 0 ] = width * 2;
+ pitches[ 1 ] = 0;
+ pitches[ 2 ] = 0;
+
+ output[ 0 ] = new uint8_t[ width * height ];
+ output[ 1 ] = new uint8_t[ width * height / 4 ];
+ output[ 2 ] = new uint8_t[ width * height / 4 ];
+
+ // Define space for a uncompressed YUV422 PAL frame (being the maxiumum)
+
+ input = new uint8_t[ 720 * 576 * 4 ];
+
+ // Output the header
+ std::cout << "YUV4MPEG2 W" << width
+ << " H" << height
+ << " F" << ( height == 576 ? "25:1" : "30000:1001" )
+ << (height == 576 ? " Ib A59:54" : " Ib A10:11")
+ << " XYSCSS=411" // custom X-tag for chroma subsampling
+ << std::endl;
+
+ return input != NULL;
+ }
+
+ bool Output( Frame &frame )
+ {
+ Extract( frame );
+ std::cout << "FRAME" << std::endl;
+ int size = fwrite( output[0], width * height, 1, stdout );
+ fwrite( output[1], width * height / 4, 1, stdout );
+ fwrite( output[2], width * height / 4, 1, stdout );
+ return size != 0;
+ }
+
+ bool Flush( )
+ {
+ delete output[ 0 ];
+ delete output[ 1 ];
+ delete output[ 2 ];
+ delete input;
+ return true;
+ }
+
+protected:
+ int width;
+ int height;
+ int pitches[3];
+ uint8_t *output[3];
+ uint8_t *input;
+
+ virtual void Extract(Frame &frame)
+ {
+ frame.decoder->quality = DV_QUALITY_BEST;
+ frame.ExtractYUV( input );
+
+ int w4 = width / 4;
+ uint8_t *y = output[0];
+ uint8_t *cb = output[1];
+ uint8_t *cr = output[2];
+ uint8_t *p = input;
+
+ for (int i = 0; i < height; i++) {
+ /* process one scanline, 4 luma samples at a time:
+ use every luma sample, skip every other chroma sample */
+ for (int j = 0; j < w4; j++) {
+ /* packed YUV 422 is: Y[i] U[i] Y[i+1] V[i] */
+ *(y++) = *(p++);
+ *(cb++) = *(p++);
+ *(y++) = *(p++);
+ *(cr++) = *(p++);
+
+ *(y++) = *(p++);
+ (p++); // skip this Cb sample
+ *(y++) = *(p++);
+ (p++); // skip this Cr sample
+ }
+ }
+ }
+}; // ExtendedYUV411Extractor
+
+
+
/** Factory method to obtain the image extractor.
*/
@@ -184,11 +280,18 @@
{
YUV420Extractor *extractor = NULL;
- if ( deinterlace_type == 0 )
- extractor = new ExtendedYUV420Extractor( );
- else
+ switch (deinterlace_type) {
+ case 1:
extractor = new ExtendedYUV420CruftyExtractor( );
-
+ break;
+ case 2:
+ extractor = new ExtendedYUV411Extractor( );
+ break;
+ case 0:
+ default:
+ extractor = new ExtendedYUV420Extractor( );
+ break;
+ }
return extractor;
}
Index: apps/smil2yuv/smil2yuv.cc
===================================================================
RCS file: /cvsroot/kino/smilutils/apps/smil2yuv/smil2yuv.cc,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 smil2yuv.cc
--- apps/smil2yuv/smil2yuv.cc 11 Feb 2003 13:22:51 -0000 1.1.1.1
+++ apps/smil2yuv/smil2yuv.cc 13 Feb 2003 01:46:23 -0000
@@ -133,7 +133,8 @@
{
cerr << "Usage: smil2yuv [ -i type ] [ -a audio-file ] file [ file ... ]" <<
endl;
cerr << "Where: file is smil, dv avi (1 or 2) or raw dv" << endl;
- cerr << " -i type : 0 no deinterlacing, 1 bad deinterlacing (more to
follow)" << endl;
+ cerr << " -i type : 0 no deinterlacing, 1 bad deinterlacing" << endl;
+ cerr << " 2 experimental 4:1:1 subsampling (more to follow)"
+<< endl;
cerr << " -a file : mp2 or wav file to write to (more to be
supported)" << endl;
cerr << " -o offset : frame offset (default: 0)" << endl;
cerr << " -f count : frame count (default: all)" << endl;
Index: apps/smil2yuv/smil2yuv.1
===================================================================
RCS file: /cvsroot/kino/smilutils/apps/smil2yuv/smil2yuv.1,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 smil2yuv.1
--- apps/smil2yuv/smil2yuv.1 11 Feb 2003 13:22:51 -0000 1.1.1.1
+++ apps/smil2yuv/smil2yuv.1 13 Feb 2003 01:46:23 -0000
@@ -16,8 +16,10 @@
over the mp2 file generated, export to a wav first and then convert the wav
as required.
.TP
-\fB\-d\fR \fItype\fR
-Deinterlacing type - 0 is none, 1 provides very poor deinterlacing (default: 0).
+\fB\-i\fR \fItype\fR
+Deinterlacing type - 0 is none, 1 provides very poor deinterlacing (default: 0).
+2 results in no interlacing, but a 4:1:1 subsampled stream (native NTSC DV)
+which can be processed by y4mscaler.
More types will be supported in the future.
.TP
\fB\-o\fR \fIoffset\fR
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mjpeg-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mjpeg-users