A method comprising: selecting a current block of a picture for encoding; selecting a reference block for the current block, wherein the selecting the reference block comprises providing one or more reference pictures for the selecting of the reference block, wherein the one or more reference pictures comprises at least one of the following: - a view synthesized picture, - a picture used for inter-view prediction, - a picture used for inter-layer prediction, or - a picture used for inter-prediction, determining a type of prediction associated with each reference picture based on the reference picture index identifying the reference picture; determine a range of valid motion vectors for each reference picture by in response to the type of prediction equal to inter-layer prediction, setting the motion vector to zero; and in response to the type of prediction equal to inter-view prediction, restricting vertical motion vector component of the motion vector for the current block within a range ┌a1,b1┐; selecting a reference block that can be identified in a reference picture with a motion vector belonging to the range of valid motion vectors determined for said reference picture; encoding the motion vector belonging to said range of valid motion vectors and associated with the selected reference block, wherein the encoding corresponds to context-based entropy encoding and is based on the type of prediction associated with the reference picture containing the reference block; encoding the current block based on the motion vector associated with the selected reference block and based on the selected reference block. selecting a current block of a picture for encoding; selecting a reference block for the current block, wherein the selecting the reference block comprises providing one or more reference pictures for the selecting of the reference block, wherein the one or more reference pictures comprises at least one of the following: - a view synthesized picture, - a picture used for inter-view prediction, - a picture used for inter-layer prediction, or - a picture used for inter-prediction, - a view synthesized picture, - a picture used for inter-view prediction, - a picture used for inter-layer prediction, or - a picture used for inter-prediction, determining a type of prediction associated with each reference picture based on the reference picture index identifying the reference picture; determine a range of valid motion vectors for each reference picture by in response to the type of prediction equal to inter-layer prediction, setting the motion vector to zero; and in response to the type of prediction equal to inter-view prediction, restricting vertical motion vector component of the motion vector for the current block within a range ┌a1,b1┐; selecting a reference block that can be identified in a reference picture with a motion vector belonging to the range of valid motion vectors determined for said reference picture; encoding the motion vector belonging to said range of valid motion vectors and associated with the selected reference block, wherein the encoding corresponds to context-based entropy encoding and is based on the type of prediction associated with the reference picture containing the reference block; encoding the current block based on the motion vector associated with the selected reference block and based on the selected reference block. in response to the type of prediction equal to inter-layer prediction, setting the motion vector to zero; and in response to the type of prediction equal to inter-view prediction, restricting vertical motion vector component of the motion vector for the current block within a range ┌a1,b1┐; selecting a reference block that can be identified in a reference picture with a motion vector belonging to the range of valid motion vectors determined for said reference picture; encoding the motion vector belonging to said range of valid motion vectors and associated with the selected reference block, wherein the encoding corresponds to context-based entropy encoding and is based on the type of prediction associated with the reference picture containing the reference block; encoding the current block based on the motion vector associated with the selected reference block and based on the selected reference block.