What's the reasoning of H264 to have frame_crop_left_offset and XXX_right_offset?

StackOverflow https://stackoverflow.com/questions/23561464

  •  18-07-2023
  •  | 
  •  

Question

It's interesting H264 define:

frame_cropping_flag equal to 1 specifies that the frame cropping offset parameters follow next in the sequence parameter set. frame_cropping_flag equal to 0 specifies that the frame cropping offset parameters are not present.

frame_crop_left_offset, frame_crop_right_offset, frame_crop_top_offset, frame_crop_bottom_offset specify the samples of the pictures in the coded video sequence

So what's the reasoning H264 standard need crop functionality?

Was it helpful?

Solution

If you have a look at resolution formulas, e.g. here, you will see that blocks, such as 16px granular, are in use. Hence, to reach specific, pixel accurate, resolution you might have to crop the picture built of macroblocks. For example, to get 1920x1080 built of 16x16 blocks, you have 120x68 blocks per frame with bottom macroblock row cut in half: macroblocks get you 1088 px height and you crop bottom 8 pixels.

Then for example, your task might be to encode 180 degrees rotates stream, and you find it convenient to crop those 8 pixels from top, not from bottom. frame_crop_* flags get you sufficient flexibility to crop on any side.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top