Adam M. Costello
2001-12-09 05:28:03 UTC
The YUV4MPEG2 format specified in yuv4mpeg.h is silent on the alignment
of the chroma samples; it simply says 4:2:0. For MPEG-1, the chroma
samples are supposed to be here:
Y Y
C
Y Y
But for MPEG-2 the chroma samples are supposed to be here:
Y Y
C
Y Y
mpeg2enc can output both MPEG-1 and MPEG-2 streams, but neither the
input stream nor the command-line options contain explicit information
about the alignment of the input chroma samples. So it must do one of
two things:
1) It assumes that all yuv4mpeg streams contain chroma samples aligned
for MPEG-2, and it resamples if the output is MPEG-1. Or vice-versa.
or
2) It assumes that the input yuv4mpeg stream contains chroma
samples suitably aligned for the output format. It's the caller's
responsibility to ensure that this is true.
If (2) is true, then it would seem that lav2yuv and yuv2lav ought
to have command-line options for indicating which alignment to
produce/expect, but they don't.
What is the story on chroma alignment? Does mjpegtools follow the
standards? Do most software MPEG implementations? Do most hardware
MPEG implementations?
Thanks,
AMC
of the chroma samples; it simply says 4:2:0. For MPEG-1, the chroma
samples are supposed to be here:
Y Y
C
Y Y
But for MPEG-2 the chroma samples are supposed to be here:
Y Y
C
Y Y
mpeg2enc can output both MPEG-1 and MPEG-2 streams, but neither the
input stream nor the command-line options contain explicit information
about the alignment of the input chroma samples. So it must do one of
two things:
1) It assumes that all yuv4mpeg streams contain chroma samples aligned
for MPEG-2, and it resamples if the output is MPEG-1. Or vice-versa.
or
2) It assumes that the input yuv4mpeg stream contains chroma
samples suitably aligned for the output format. It's the caller's
responsibility to ensure that this is true.
If (2) is true, then it would seem that lav2yuv and yuv2lav ought
to have command-line options for indicating which alignment to
produce/expect, but they don't.
What is the story on chroma alignment? Does mjpegtools follow the
standards? Do most software MPEG implementations? Do most hardware
MPEG implementations?
Thanks,
AMC