Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > sci.image.processing > #4141

Re: Lossless rgb<->yuv discuss

From Thomas Richter <thor@math.tu-berlin.de>
Newsgroups sci.image.processing
Subject Re: Lossless rgb<->yuv discuss
Date 2016-07-18 15:08 +0200
Organization University of Stuttgart, FRG
Message-ID <nmikcb$143$1@news2.informatik.uni-stuttgart.de> (permalink)
References <303fec14-c8b3-40a7-913a-a274cc729ede@googlegroups.com>

Show all headers | View raw


On 18.07.2016 01:25, Yang Luo wrote:
> Is there a lossless rgb<->yuv formula, no clip?

Not "yuv" directly, but "ycgco", which is "close enough" to yuv for many
purposes. It doesn't clip, but it (necessarily) extends the range of the
chroma signal by one bit. Alternatively, you can also use RCT from JPEG
2000.

If you look for a continuous (i.e. no wrap-arounds, no jumps) lossless
conversion from RGB to some other color space *without* range extension,
then I afraid the identity transformation and trivial variations thereof
(i.e. reflections, and permutations of the axes) are the only option.


This is the forwards transform:

 LONG rp = *r;
 LONG gp = *g;
 LONG bp = *b;
 LONG v  = bp - rp;
 LONG t  = rp - gp + (v >> 1);
 LONG y  = gp + (t >> 1);
 LONG u  = -t;

And this is the backwards transform:

u         = -u;            // this was called t above
y        -= u >> 1;        // restore g. yp is now == g
u        += y - (v >> 1); // this restores r. up is now == r
v        += u;             // this restores b
r         = u
g         = y
b         = v

HTHH,
	Thomas

Back to sci.image.processing | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Lossless rgb<->yuv discuss Yang Luo <youngluoyang@gmail.com> - 2016-07-17 16:25 -0700
  Re: Lossless rgb<->yuv discuss Thomas Richter <thor@math.tu-berlin.de> - 2016-07-18 15:08 +0200
    Re: Lossless rgb<->yuv discuss Sand Glass <youngluoyang@gmail.com> - 2016-07-18 08:20 -0700

csiph-web