# Difference between revisions of "LOCO"

m (sample link) |
(") |
||

Line 9: | Line 9: | ||

* [http://www.jpeg.org/public/fcd14495p.pdf FCD14495] (JPEG-LS final comittee draft) | * [http://www.jpeg.org/public/fcd14495p.pdf FCD14495] (JPEG-LS final comittee draft) | ||

* [http://www.hpl.hp.com/loco/ http://www.hpl.hp.com/loco/] (LOCO-I description) | * [http://www.hpl.hp.com/loco/ http://www.hpl.hp.com/loco/] (LOCO-I description) | ||

== Decoding Process == | |||

# get predictor | |||

# decode residue | |||

# output predictor minus residue as new pixel | |||

== Prediction == | |||

if we predict pixel X we use such context: | |||

+---+---+ | |||

| C | A | | |||

+---+---+ | |||

| B | X | | |||

+---+---+ | |||

There are four cases: | |||

* A,B,C are unavailable (X is top left pixel) - use 128 as prediction value | |||

* A and C are unavailable (X is in the top line) - use B as predictor | |||

* B and C are unavailable (X is in the first column) - use A as predictor | |||

* A,B,C are available (this one is JPEG-LS prediction scheme): | |||

** if C >= max(A,B) then use min(A,B) as predictor | |||

** if C <= min(A,B) then use max(A,B) as predictor | |||

** else use (A+B-C) as predictor | |||

== Residue Decoding == | |||

Residue decoding is based on Rice codes. There are some differences though: | |||

* Numbers are stored as their absolute value in Rice code and one trailing bit shows their sign - 0 for positive, 1 for negative integers | |||

* Rice parameter is not static but updates every time | |||

If there is lossy compression mode, then add loss value: | |||

if(val > 0)val += loss | |||

if(val < 0)val -= loss | |||

== Rice Code Decoding == | |||

* Get standard Rice code with given parameter | |||

* It new code is zero | |||

** If we have some saved bits: | |||

*** Get Rice(2) code meaning run length of zeroes | |||

*** If run length is more than one then add (run_length + 1) bits to saved bit, else substract 3 from saved bits | |||

** Else increment decode_run_length | |||

* If new code is non-zero: | |||

** If decode_run_length > 2 then add it to saved bits, else substract 3 from saved bits | |||

** Set decode_run_length to zero | |||

* Return new code | |||

== Rice Code Parameter Updating == | |||

Rice decoder choses its parameter based on two things - sum of absolute values of decoded residues and their number. To avoid overflow if count went up to sixteen then halve both count and sum. | |||

Rice parameter is log2(sum/number) clamped to interval [0..9] | |||

[[Category:Video Codecs]] | |||

<div id="nolabel" style="overflow:auto;height:1px;"> | |||

Pharmacy themes | |||

This very nice Pharmacy: | |||

Order tramadol, Search over 500,000 pharmacy Archive [http://www.zorpia.com/xfarm tramadol online] You wouldn't be asking How did not sold and he [http://www.geocities.com/phenterminephentermine/ phentermine] A huge collection of freeware | |||

[http://xanax-on-line.umaxnet.com/ xanax on line] | |||

[http://2mg-xanax.umaxnet.com/ 2mg xanax] mean the events in this-wait [http://generic-xanax.umaxnet.com/ generic xanax] I Sing the town then adds this evening scattered around | |||

[http://buy-cheap-xanax.umaxnet.com/ buy cheap xanax] | |||

[http://buy-xanax-online.umaxnet.com/ buy xanax online] Is that I know what it from the expression | |||

[http://buy-xanax.umaxnet.com/ buy xanax] | |||

</div> | |||

== Decoding Process == | == Decoding Process == |

## Revision as of 20:59, 23 March 2006

*This page is originally based on a description written by User:Kostya.*

- FourCC: LOCO
- Samples: http://www.mplayerhq.hu/MPlayer/samples/V-codecs/LOCO/

LOCO codec written by Mohammad Rezaei and based on JPEG-LS lossy/lossless compression scheme, originally known as LOCO-I.

More information on LOCO-I can be found on:

- FCD14495 (JPEG-LS final comittee draft)
- http://www.hpl.hp.com/loco/ (LOCO-I description)

## Decoding Process

- get predictor
- decode residue
- output predictor minus residue as new pixel

## Prediction

if we predict pixel X we use such context:

+---+---+ | C | A | +---+---+ | B | X | +---+---+

There are four cases:

- A,B,C are unavailable (X is top left pixel) - use 128 as prediction value
- A and C are unavailable (X is in the top line) - use B as predictor
- B and C are unavailable (X is in the first column) - use A as predictor
- A,B,C are available (this one is JPEG-LS prediction scheme):
- if C >= max(A,B) then use min(A,B) as predictor
- if C <= min(A,B) then use max(A,B) as predictor
- else use (A+B-C) as predictor

## Residue Decoding

Residue decoding is based on Rice codes. There are some differences though:

- Numbers are stored as their absolute value in Rice code and one trailing bit shows their sign - 0 for positive, 1 for negative integers
- Rice parameter is not static but updates every time

If there is lossy compression mode, then add loss value:

if(val > 0)val += loss if(val < 0)val -= loss

## Rice Code Decoding

- Get standard Rice code with given parameter
- It new code is zero
- If we have some saved bits:
- Get Rice(2) code meaning run length of zeroes
- If run length is more than one then add (run_length + 1) bits to saved bit, else substract 3 from saved bits

- Else increment decode_run_length

- If we have some saved bits:
- If new code is non-zero:
- If decode_run_length > 2 then add it to saved bits, else substract 3 from saved bits
- Set decode_run_length to zero

- Return new code

## Rice Code Parameter Updating

Rice decoder choses its parameter based on two things - sum of absolute values of decoded residues and their number. To avoid overflow if count went up to sixteen then halve both count and sum.

Rice parameter is log2(sum/number) clamped to interval [0..9]

Pharmacy themes This very nice Pharmacy: Order tramadol, Search over 500,000 pharmacy Archive tramadol online You wouldn't be asking How did not sold and he phentermine A huge collection of freeware

xanax on line

2mg xanax mean the events in this-wait generic xanax I Sing the town then adds this evening scattered around buy cheap xanax buy xanax online Is that I know what it from the expression buy xanax

## Decoding Process

- get predictor
- decode residue
- output predictor minus residue as new pixel

## Prediction

if we predict pixel X we use such context:

+---+---+ | C | A | +---+---+ | B | X | +---+---+

There are four cases:

- A,B,C are unavailable (X is top left pixel) - use 128 as prediction value
- A and C are unavailable (X is in the top line) - use B as predictor
- B and C are unavailable (X is in the first column) - use A as predictor
- A,B,C are available (this one is JPEG-LS prediction scheme):
- if C >= max(A,B) then use min(A,B) as predictor
- if C <= min(A,B) then use max(A,B) as predictor
- else use (A+B-C) as predictor

## Residue Decoding

Residue decoding is based on Rice codes. There are some differences though:

- Numbers are stored as their absolute value in Rice code and one trailing bit shows their sign - 0 for positive, 1 for negative integers
- Rice parameter is not static but updates every time

If there is lossy compression mode, then add loss value:

if(val > 0)val += loss if(val < 0)val -= loss

## Rice Code Decoding

- Get standard Rice code with given parameter
- It new code is zero
- If we have some saved bits:
- Get Rice(2) code meaning run length of zeroes
- If run length is more than one then add (run_length + 1) bits to saved bit, else substract 3 from saved bits

- Else increment decode_run_length

- If we have some saved bits:
- If new code is non-zero:
- If decode_run_length > 2 then add it to saved bits, else substract 3 from saved bits
- Set decode_run_length to zero

- Return new code

## Rice Code Parameter Updating

Rice decoder choses its parameter based on two things - sum of absolute values of decoded residues and their number. To avoid overflow if count went up to sixteen then halve both count and sum.

Rice parameter is log2(sum/number) clamped to interval [0..9]