Subject: Re: [Cellar] [FFmpeg-devel] clarification on General Description for FFV1 Draft Specification

From: Michael Niedermayer <[email-masked]>
Date: Thu, 31 Dec 2015 21:26:18 +0100

On Thu, Dec 31, 2015 at 11:41:22AM -0500, Dave Rice wrote:
> Hi all,
> 
> I’m reviewing the FFV1 Draft Specification [1] and commenting here specifically upon the General Description section and have some questions to clarify the meaning of this section. I’m cross-posting to ffmpeg-devel though responses are welcomed on either list though encouraged on the IETF Cellar working group listserv [2].
> 
> The General Description section [3] contains this introductory paragraph:
> 

> "Each frame is split in 1 to 4 planes (Y, Cb, Cr, Alpha). In the case of the normal YCbCr colorspace the Y plane is coded first followed by the Cb and Cr planes, if an Alpha/transparency plane exists, it is coded last. In the case of the JPEG2000-RCT colorspace the lines are interleaved to improve caching efficiency since it is most likely that the RCT will immediately be converted to RGB during decoding; the interleaved coding order is also Y, Cb, Cr, Alpha."
> 

> Two colorspaces are referenced, YCbCr(with optional Alpha) and JPEG2000-RCT (Reversible Color Transform), but the RCT sentence doesn’t reference planar storage. Does an RCT encoding store with planes and if so how many places are used and what are their names (3 planes or one packed plane)?

the RCT case uses planes interleaved at line granularity

> Also is storage of an alpha plane with RCT planes allowed?

I think theres nothing disallowing that combination, so it is allowed

> 
> What is the meaning of “line" in the paragraph above? What does "In the case of the JPEG2000-RCT colorspace the lines are interleaved” mean?

a plane is a 2 dimensional array of integer samples
a line in this context is meant as a horizontal line in that array
that is a set where the second coordinate is always the same

I think at least the word "horizontal" should be added somewhere

line interleaved is meant so that a 4x3 slice with 3 planes
YYYY UUUU VVVV
YYYY UUUU VVVV
YYYY UUUU VVVV

would be stored as
YYYYUUUUVVVVYYYYUUUUVVVVYYYYUUUUVVVV (left to right, top to bottom)

or as in
for (all horizontal lines)
    for (all planes)
        for (all samples in a line of a plane)
            store sample

> 
> Re: "Each frame is split in 1 to 4 planes". I'd like to be more specific. From this reading it seems like 2 planes is possible; however, are 2 plane encodings possible (grayscale with alpha or Y with only Cb)?

Y with alpha is possible
Cb without Cr is not possible

> 
> Re: "since it is most likely that the RCT will immediately be converted to RGB during decoding”. Is there anyone other conversion possible?

In theory the raw RCT values could be returned, thats purely a
API/implementation question and would have no effect on the ffv1 format

thats similar to using YCbCr values from NTSC/PAL instead of RGB
NTSC/PAL isnt affected by what a device turns it into

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA