# Help with gamut mapping algorithm

### Help with gamut mapping algorithm

Hi, not really sure if this is the right section for this question, please move it if required.
I'm trying to implement the gamut mapping algorithm proposed in Annex 5 of ITU Report BT.2407-0, here is the link:

https://www.itu.int/dms_pub/itu-r/opb/rep/R-REP-BT.2407-2017-PDF-E.pdf

The problem is that I think that there are some mistakes in the algorithm steps proposed at the end, and I cannot figure out which should be the right way.
First, I think that the projections p2020 and p709 in step 4 should refer to the projections in the full 2020 and 709 gamut boundaries, since these are the source and target gamuts, and not the effective source and target gamuts projections computed in step 3. Then in step 6, w + $$\overline{w p709}$$ should refer again to the full gamut projection, but f($$\overline{w p2100}/\overline{w p709}$$) should refer to the effective gamut projections. This way, any value of $$\overline{w p2100}/\overline{w p709}$$ (effective gamut proyections) above 1+ $$\alpha$$ (full gamut projections) should map to the boundary of the full target gamut. But anyway $$\overline{w p2100}/\overline{w p709}$$ will always be above 1, and 1-$$\beta$$ = 0.8, so f(r) will never be r.
The text refers sometimes to 2020 and others to 2100, but both are the same gamut so I don't think the errors are related to this.

I would be most grateful if someone can deduce which should be the right algorithm steps.
Guest

### Re: Help with gamut mapping algorithm

I think I found the error. Step 6 should be:

c709 = w + $$\overline{w p709}$$ $$\cdot$$ f($$\overline{w c2020}$$ / $$\overline{w p709}$$)

and all the proyections are the computed in step 3.
Anyway I don't think this will give very good results because very bright and saturated values (even inside the target gamut) will become very desaturated.
Guest