A method of determining a block size, the method comprising: obtaining luminance data from a frame of video data, wherein the frame of the video data comprises R rows and C columns; detecting boundary data by: high-pass filtering the luminance data; quantizing the filtered luminance data by comparing each element of the filtered luminance data to a low threshold and a high threshold, wherein: the low threshold is set to a value to distinguish between noise and block boundary transitions in the frame of video data, and the high threshold is set to a value to distinguish between block boundary transitions and object features in the frame of the video data; and comparing, for each element of the quantized filtered luminance data, a neighbourhood of data centered about each element to a template and detecting, for each said element, if there is a template match; computing a detection array comprising C elements, each element based on a respective column of the detected boundary data, wherein computing each element of the detection array comprises summing the elements in the respective column of the detected boundary data and using, as the computed element of the detection array, a first logic value when the resulting sum exceeds a threshold and a second logic value when the resulting sum does not exceed the threshold; selecting a subset of candidate block sizes from a set of possible block sizes; computing a frequency transform of the C elements in the detection array at transform coefficients corresponding to the selected subset of candidate block sizes; and extracting the block size from an output of the frequency transform. obtaining luminance data from a frame of video data, wherein the frame of the video data comprises R rows and C columns; detecting boundary data by: high-pass filtering the luminance data; quantizing the filtered luminance data by comparing each element of the filtered luminance data to a low threshold and a high threshold, wherein: the low threshold is set to a value to distinguish between noise and block boundary transitions in the frame of video data, and the high threshold is set to a value to distinguish between block boundary transitions and object features in the frame of the video data; and comparing, for each element of the quantized filtered luminance data, a neighbourhood of data centered about each element to a template and detecting, for each said element, if there is a template match; high-pass filtering the luminance data; quantizing the filtered luminance data by comparing each element of the filtered luminance data to a low threshold and a high threshold, wherein: the low threshold is set to a value to distinguish between noise and block boundary transitions in the frame of video data, and the high threshold is set to a value to distinguish between block boundary transitions and object features in the frame of the video data; and comparing, for each element of the quantized filtered luminance data, a neighbourhood of data centered about each element to a template and the low threshold is set to a value to distinguish between noise and block boundary transitions in the frame of video data, and the high threshold is set to a value to distinguish between block boundary transitions and object features in the frame of the video data; and comparing, for each element of the quantized filtered luminance data, a neighbourhood of data centered about each element to a template and detecting, for each said element, if there is a template match; computing a detection array comprising C elements, each element based on a respective column of the detected boundary data, wherein computing each element of the detection array comprises summing the elements in the respective column of the detected boundary data and using, as the computed element of the detection array, a first logic value when the resulting sum exceeds a threshold and a second logic value when the resulting sum does not exceed the threshold; selecting a subset of candidate block sizes from a set of possible block sizes; computing a frequency transform of the C elements in the detection array at transform coefficients corresponding to the selected subset of candidate block sizes; and extracting the block size from an output of the frequency transform.