You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* mediaarea/Ballot_Robert:
Link from Quantization Table Sets to Coding of the Sample Difference
Move ESC definition to the place where it is used.
Introduction line for State Transition Table
Replace [()] by (())
Split formulae of color space transformations when RGB is used
Move exceptions in a specific sub-section of the section describing the normal behavior
Copy file name to clipboardexpand all lines: ffv1.md
+45-22
Original file line number
Diff line number
Diff line change
@@ -39,8 +39,6 @@ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "S
39
39
40
40
`Pixel`: The smallest addressable representation of a color in a Frame. It is composed of one or more Samples.
41
41
42
-
`ESC`: An ESCape Symbol to indicate that the Symbol to be stored is too large for normal storage and that an alternate storage method is used.
43
-
44
42
`MSB`: Most Significant Bit, the bit that can cause the largest change in magnitude of the Symbol.
45
43
46
44
`VLC`: Variable Length Code, a code that maps source symbols to a variable number of bits.
@@ -261,8 +259,9 @@ median(l, t, l + t - tl)
261
259
262
260
Note, this prediction template is also used in [@ISO.14495-1.1999] and [@HuffYUV].
263
261
264
-
Exception for the median predictor:
265
-
if `colorspace_type == 0 && bits_per_raw_sample == 16 && ( coder_type == 1 || coder_type == 2 )` (see (#colorspace-type), (#bits-per-raw-sample) and (#colorspace-type)), the following median predictor MUST be used:
262
+
### Exception
263
+
264
+
If `colorspace_type == 0 && bits_per_raw_sample == 16 && ( coder_type == 1 || coder_type == 2 )` (see (#colorspace-type), (#bits-per-raw-sample) and (#colorspace-type)), the following median predictor MUST be used:
@@ -280,6 +279,8 @@ Background: a two's complement 16-bit signed integer was used for storing Sample
280
279
281
280
## Quantization Table Sets
282
281
282
+
Quantization Tables are used on Sample Differences (see (#coding-of-the-sample-difference)), so Quantized Sample Differences are stored in the bitstream.
283
+
283
284
The FFV1 bitstream contains one or more Quantization Table Sets. Each Quantization Table Set contains exactly 5 Quantization Tables with each Quantization Table corresponding to one of the five Quantized Sample Differences. For each Quantization Table, both the number of quantization steps and their distribution are stored in the FFV1 bitstream; each Quantization Table has exactly 256 entries, and the 8 least significant bits of the Quantized Sample Difference are used as index:
284
285
285
286
SVGI:!---
@@ -351,28 +352,20 @@ JPEG2000-RCT is a Reversible Color Transform that codes RGB (red, green, blue) P
351
352
SVGI:!---
352
353
SVGI:
353
354
SVGI:!---
354
-
SVGC:rgb1.svg=$$\\\\begin{array}{ccccccc}Cb & = & b - g \\\\\\ Cr & = & r - g \\\\\\ Y & = & g + ( Cb + Cr)>>2 \\\\\\ g & = & Y - ( Cb + Cr ) >> 2 \\\\\\ r & = & Cr + g \\\\\\ b & = & Cb + g \\\\end{array}$$
355
+
SVGC:rgb1.svg=$$\\\\begin{array}{ccccccc}Cb & = & b - g \\\\\\ Cr & = & r - g \\\\\\ Y & = & g + ( Cb + Cr)>>2 \\\\end{array}$$
355
356
AART:Cb = b - g
356
357
AART:Cr = r - g
357
358
AART:Y = g + (Cb + Cr) >> 2
358
-
AART:g = Y - (Cb + Cr) >> 2
359
-
AART:r = Cr + g
360
-
AART:b = Cb + g
361
-
362
-
Exception for the JPEG2000-RCT conversion: if `bits_per_raw_sample` is between 9 and 15 inclusive and `extra_plane` is 0, the following formulae for reversible conversions between YCbCr and RGB MUST be used instead of the ones above:
359
+
Figure: Description of the transformation of pixels from RGB color space to coded modified YCbCr color space. {#figureRgbYcbcr}
363
360
364
361
SVGI:!---
365
362
SVGI:
366
363
SVGI:!---
367
-
SVGC:rgb2.svg=$$\\\\begin{array}{ccccccc}Cb & = & g - b \\\\\\ Cr & = & r - b \\\\\\ Y & = & b + (Cb + Cr)>>2 \\\\\\ b & = & Y - (Cb + Cr)>>2 \\\\\\ r & = & Cr + b \\\\\\ g & = & Cb + b \\\\end{array}$$
368
-
AART:Cb = g - b
369
-
AART:Cr = r - b
370
-
AART:Y = b +(Cb + Cr) >> 2
371
-
AART:b = Y -(Cb + Cr) >> 2
372
-
AART:r = Cr + b
373
-
AART:g = Cb + b
374
-
375
-
Background: At the time of this writing, in all known implementations of FFV1 bitstream, when `bits_per_raw_sample` was between 9 and 15 inclusive and `extra_plane` is 0, GBR Planes were used as BGR Planes during both encoding and decoding. In the meanwhile, 16-bit JPEG2000-RCT was implemented without this issue in one implementation and validated by one conformance checker. Methods to address this exception for the transform are under consideration for the next version of the FFV1 bitstream.
364
+
SVGC:rgb2.svg=$$\\\\begin{array}{ccccccc}g & = & Y - ( Cb + Cr ) >> 2 \\\\\\ r & = & Cr + g \\\\\\ b & = & Cb + g \\\\end{array}$$
365
+
AART:g = Y - (Cb + Cr) >> 2
366
+
AART:r = Cr + g
367
+
AART:b = Cb + g
368
+
Figure: Description of the transformation of pixels from coded modified YCbCr color space to RGB color space. {#figureYcbcrRgb}
376
369
377
370
Cb and Cr are positively offset by `1 << bits_per_raw_sample` after the conversion from RGB to the modified YCbCr and are negatively offseted by the same value before the conversion from the modified YCbCr to RGB, in order to have only non-negative values after the conversion.
378
371
@@ -394,16 +387,40 @@ In JPEG2000-RCT, the coding order would be left to right and then top to bottom,
If `bits_per_raw_sample` is between 9 and 15 inclusive and `extra_plane` is 0, the following formulae for reversible conversions between YCbCr and RGB MUST be used instead of the ones above:
393
+
394
+
SVGI:!---
395
+
SVGI:
396
+
SVGI:!---
397
+
SVGC:rgb3.svg=$$\\\\begin{array}{ccccccc}Cb & = & g - b \\\\\\ Cr & = & r - b \\\\\\ Y & = & b + (Cb + Cr)>>2 \\\\end{array}$$
398
+
AART:Cb = g - b
399
+
AART:Cr = r - b
400
+
AART:Y = b + (Cb + Cr) >> 2
401
+
Figure: Description of the transformation of pixels from RGB color space to coded modified YCbCr color space (in case of exception). {#figureRgbYcbcrException}
402
+
403
+
SVGI:!---
404
+
SVGI:
405
+
SVGI:!---
406
+
SVGC:rgb4.svg=$$\\\\begin{array}{ccccccc}b & = & Y - (Cb + Cr)>>2 \\\\\\ r & = & Cr + b \\\\\\ g & = & Cb + b \\\\end{array}$$
407
+
AART:b = Y - (Cb + Cr) >> 2
408
+
AART:r = Cr + b
409
+
AART:g = Cb + b
410
+
Figure: Description of the transformation of pixels from coded modified YCbCr color space to RGB color space (in case of exception). {#figureYcbcrRgbException}
411
+
412
+
Background: At the time of this writing, in all known implementations of FFV1 bitstream, when `bits_per_raw_sample` was between 9 and 15 inclusive and `extra_plane` is 0, GBR Planes were used as BGR Planes during both encoding and decoding. In the meanwhile, 16-bit JPEG2000-RCT was implemented without this issue in one implementation and validated by one conformance checker. Methods to address this exception for the transform are under consideration for the next version of the FFV1 bitstream.
413
+
397
414
## Coding of the Sample Difference
398
415
399
416
Instead of coding the n+1 bits of the Sample Difference with Huffman or Range coding (or n+2 bits, in the case of JPEG2000-RCT), only the n (or n+1, in the case of JPEG2000-RCT) least significant bits are used, since this is sufficient to recover the original Sample. In the equation below, the term "bits" represents `bits_per_raw_sample + 1` for JPEG2000-RCT or `bits_per_raw_sample` otherwise:
400
417
401
418
SVGI:!---
402
419
SVGI:
Figure: Description of the coding of the Sample Difference in the bitstream. {#figureSampleDifference}
408
425
409
426
### Range Coding Mode
@@ -586,6 +603,8 @@ When `keyframe` (see (#frame)) value is 1, all Range coder state variables are s
586
603
587
604
#### State Transition Table
588
605
606
+
In this mode a State Transition Table is used, indicating in which state the decoder will move to, based on the current state and the value extracted from [@figureGetRacPseudoCode].
0 commit comments