A method of processing video data, the method comprising: obtaining a current block of a picture of the video data; determining the size of the current block, the size of the current block including at least one of a width or height of the current block; determining the number of rows of samples of neighboring pixels above the current block in a template of the current block (N i), wherein the template is neighboring the current block, and the number of rows of samples in a template of a reference picture based on the determined size of the current block, wherein the template is neighboring the reference block, and wherein the number of rows of samples in the template of the current block and in the template of the reference picture is greater than one row when the width of the current block is greater than a threshold width and the number of rows of samples in the template of the current block and in the template of the reference picture is one row when the width of the current block is less than a threshold width, and/or determining the number of columns of samples of neighboring pixels to left of the current block in a template of the current block (N i) and the number of columns of samples in a template of a reference picture based on the determined size of the current block, wherein the number of columns of samples in the template of the current block and in the template of the reference picture is greater than one column when the height of the current block is greater than a threshold height and the number of columns is one column when the height of the current block is less than a threshold width; and performing motion compensation for the current block, wherein performing the motion compensation includes deriving one or more local illumination compensation parameters for the current block using the template of the current block (N i) and the template of the reference picture; performing local illumination compensation using the one or more derived local illumination compensation parameters. obtaining a current block of a picture of the video data; determining the size of the current block, the size of the current block including at least one of a width or height of the current block; determining the number of rows of samples of neighboring pixels above the current block in a template of the current block (N i), wherein the template is neighboring the current block, and the number of rows of samples in a template of a reference picture based on the determined size of the current block, wherein the template is neighboring the reference block, and wherein the number of rows of samples in the template of the current block and in the template of the reference picture is greater than one row when the width of the current block is greater than a threshold width and the number of rows of samples in the template of the current block and in the template of the reference picture is one row when the width of the current block is less than a threshold width, and/or determining the number of columns of samples of neighboring pixels to left of the current block in a template of the current block (N i) and the number of columns of samples in a template of a reference picture based on the determined size of the current block, wherein the number of columns of samples in the template of the current block and in the template of the reference picture is greater than one column when the height of the current block is greater than a threshold height and the number of columns is one column when the height of the current block is less than a threshold width; and performing motion compensation for the current block, wherein performing the motion compensation includes deriving one or more local illumination compensation parameters for the current block using the template of the current block (N i) and the template of the reference picture; performing local illumination compensation using the one or more derived local illumination compensation parameters.