A method for hiding values of a coding unit having hierarchical structure with several layers in transform coefficients comprised by said coding unit, the method comprising: dynamically selecting a layered stack of data hiding patterns based on the structure of the coding unit for hiding said values of the coding unit at different layers of the coding unit, wherein dynamically selecting the layered stack of data hiding patterns corresponds to dynamically selecting the number of data hiding patterns per layer and their size, wherein each of the data hiding patterns has a check function associated to it for hiding one or more of said values of the coding unit at one of the layers of the coding unit; for each of the data hiding patterns, performing the following: (i) calculating the check function associated to a respective one of said data hiding patterns based on values of the transform coefficients selected by the respective data hiding pattern from said transform coefficients of the coding unit; (ii) determining whether the result of the check function corresponds to a value of said coding unit that is to be hidden by the respective data hiding pattern; and (iii) if not, modifying at least one of said values of the transform coefficients selected by the respective data hiding pattern from said transform coefficients of the coding unit so that the result of the check function in step (ii) corresponds to said value of said coding unit that is to be hidden by the respective data hiding pattern; wherein an encoded coding unit comprises the transform coefficients of the coding unit as modified in step (iii) for all data hiding patterns; wherein the values of said coding unit represent the transform coefficients of a block of pixels of an image, and the coding unit has one or more prediction units, one or more transform units, and one or more coefficient groups, wherein the data hiding patterns are associated to layers of the coding unit corresponding to the prediction units, the transform units and the coding unit, respectively, and each of the data hiding patterns hides one or more values of the associated layer of the coding unit. dynamically selecting a layered stack of data hiding patterns based on the structure of the coding unit for hiding said values of the coding unit at different layers of the coding unit, wherein dynamically selecting the layered stack of data hiding patterns corresponds to dynamically selecting the number of data hiding patterns per layer and their size, wherein each of the data hiding patterns has a check function associated to it for hiding one or more of said values of the coding unit at one of the layers of the coding unit; for each of the data hiding patterns, performing the following: (i) calculating the check function associated to a respective one of said data hiding patterns based on values of the transform coefficients selected by the respective data hiding pattern from said transform coefficients of the coding unit; (ii) determining whether the result of the check function corresponds to a value of said coding unit that is to be hidden by the respective data hiding pattern; and (iii) if not, modifying at least one of said values of the transform coefficients selected by the respective data hiding pattern from said transform coefficients of the coding unit so that the result of the check function in step (ii) corresponds to said value of said coding unit that is to be hidden by the respective data hiding pattern; (i) calculating the check function associated to a respective one of said data hiding patterns based on values of the transform coefficients selected by the respective data hiding pattern from said transform coefficients of the coding unit; (ii) determining whether the result of the check function corresponds to a value of said coding unit that is to be hidden by the respective data hiding pattern; and (iii) if not, modifying at least one of said values of the transform coefficients selected by the respective data hiding pattern from said transform coefficients of the coding unit so that the result of the check function in step (ii) corresponds to said value of said coding unit that is to be hidden by the respective data hiding pattern; wherein an encoded coding unit comprises the transform coefficients of the coding unit as modified in step (iii) for all data hiding patterns; wherein the values of said coding unit represent the transform coefficients of a block of pixels of an image, and the coding unit has one or more prediction units, one or more transform units, and one or more coefficient groups, wherein the data hiding patterns are associated to layers of the coding unit corresponding to the prediction units, the transform units and the coding unit, respectively, and each of the data hiding patterns hides one or more values of the associated layer of the coding unit.