Cropping and padding parameter in media registration phase

You can arrange the rendering area and position in media registration phase by specifying parameters for cropping and padding crop_position, padding_popsition, crop_inheriting, crop_policy_ob, and crop_policy_ib. For the way to use these parameters, please refer to “Video registration ”.

The detail contents of policy for crop/padding and rendering area.

The parameters crop_policy_ob and crop_policy_ib are used for padding and cropping gap between the frame size of input original media and the frame size of output tile.
Following figure describes the difference between original video and output tile file under the following conditions:

Conditions

Type Attribute Value
Input Original media size
  1. 100x100 (aspect ratio 1:1)
  2. 128x96 (aspect ratio 4:3)
Output TileType R (aspect ratio 3:2)
Level 1 (resolution is 96x64)
Policy crop_position (ex. location of focus) 1: [Center]
padding_position (ex. location of efficient region on output) 1: [Center]
crop_inheriting (ex. Whether cropping / padding result for first output tile is reused for other level output tile by simply resizing first output or not) 1: [Optimizing cropping area each levels]
  • Orange frame represents output tile size and outside of red-dot frame is not rendered on tile.
../_images/image1-en.png
../_images/image2-en.png

The difference of Cover and Contain

In this part, the difference of the case of Cover and Contain as crop policy is described by using following figure. In both cases original videos are resized keeping aspect ratio.

In Cover policy, original media is resized to completely cover output region (no vacant region). Among width and height of resized original media, the one fits with the output region and the other protrudes from output region and cropped.

In Contain policy, original media is resized to be completely contained within the output region. Among width and height of resized original media, the one fits with the output region and the other is smaller than output region, and vacant region around that side is filled with black pixels.

../_images/image3-en.png

The Cover policy case (top-right/bottom-right alignment)

1. original media is resized to completely cover output region.

In this example, the height fits with the output region and the width protrudes from output region.

../_images/image4-en.png

2. The part protrudes in target tile size is cropped.

../_images/image5-en.png

The Contain policy case (bottom-left/bottom-right alignment)

1. original media is resized to be completely included output region.

In this example, the width fits with the output region and the height become shorter than output region.

../_images/image6-en.png

2. The part that does not reach to target tile size is padded by black pixels.

../_images/image7-en.png

[Example 1] The case where the policy parameters about cropping and padding are not specified.

The conditions for this example are as follows.

Conditions

Type Attribute Value
Input Original media size 1920x1080 (aspect ratio 16:9)
Output TileType HD (aspect ratio 16:9)
Level 4,3,2,1 (resolutions are 1024x576, 768x432, 512x288, and 256x144 for each level)
Policy crop_position (ex. location of focus) Not specified, default value 1: [Center] is used
padding_position (ex. location of efficient region on output) Not specified, default value 1: [Center] is used
crop_inheriting (ex. Whether cropping / padding result for first output tile is reused for other level output tile by simply resizing first output or not) Not specified, default value 1: [Optimizing cropping area each levels.] is used
crop_policy_ob (ex. The policy for cropping / padding when output resolution is bigger than output one) Not specified, default value 1: [Contain] is used
crop_policy_ib (ex. The policy for cropping/padding when input resolution is bigger than output one) Not specified, default value 1: [Contain] is used

When tile_type is HD, original media size is resized to 1024x576, 768x432, 512x288, and 256x144, for each level. When the default policy parameter is used, crop_policy_ib is set to 1, which is the Contain policy. In this case, aspect ratio is same between original media and output tile size. Therefore, original media size is contracted with keeping aspect ratio without cropping or padding.

../_images/image8-en.png

[Example 2] The case where the policy parameters about cropping and padding are not specified.

This example is same as example 1 except tile_type is SD. The conditions for this example are as follows.

Conditions

Type Attribute Value
Input Original media size 1920x1080 (aspect ratio 16:9)
Output TileType SD (aspect ratio 4:3)
Level 4,3,2,1 (resolutions are 512x384, 384x288, 256x192, 128x96 for each level)
Policy crop_position (ex. location of focus) Not specified, default value 1: [Center] is used
padding_position (ex. location of efficient region on output) Not specified, default value 1: [Center] is used
crop_inheriting (ex. Whether cropping / padding result for first output tile is reused for other level output tile by simply resizing first output or not) Not specified, default value 1: [Optimizing cropping area each levels.] is used
crop_policy_ob (ex. The policy for cropping / padding when output resolution is bigger than output one) Not specified, default value 1: [Contain] is used
crop_policy_ib (ex. The policy for cropping/padding when input resolution is bigger than output one) Not specified, default value 1: [Contain] is used

In this example, for all level (4, 3, 2, 1) crop_policy_ib:1[contain] is applied because original media size is smaller than output size (1920x1080 > 512x384, 384x288, 256x192, 128x96). Original media is resized so that resized media is completely contained within the output region. Among width and height of resized original media, the one fits with the output region and the other is smaller than output region, and vacant region around that side is filled with black pixels. According to option padding_position: 1 [center], the region around original videos are simply padded so that original video position is center on output. And according to policy crop_inheriting: 1, first output is not re-used but padding region is decided individually for each level and original video region sizes.

../_images/image9-en.png

[Example 3] The case crop_policy is designated explicitly.

The conditions for this example are as follows.

Conditions

Type Attribute Value
Input Original media size 1920x1080 (aspect ratio 16:9)
Output TileType R (aspect ratio 3:2)
Level 4,3,2,1 (resolutions are 384x256, 288x192, 192x128, 96x64 for each level)
Policy crop_position (ex. location of focus) 3: [top-right]
padding_position (ex. location of efficient region on output) 2: [top-left]
crop_inheriting (ex. Whether cropping / padding result for first output tile is reused for other level output tile by simply resizing first output or not) 0: [Applying for same cropping / padding area]
crop_policy_ob (ex. The policy for cropping / padding when output resolution is bigger than output one) 3: [dot by dot] (simple padding)
crop_policy_ib (ex. The policy for cropping/padding when input resolution is bigger than output one) 3: [dot by dot] (simple cropping)

In this case, as crop_policy_ib is 3, “dot by dot”, expansion or contraction is not applied and simply cropped according to the output tile resolution. In addition, because crop_position is 3, top-left part in original media is cropped. Also according to crop_inheriting is 0 [Applying for same cropping / padding area], the cropped picture in max level is reused for the creation of other level by simply resizing it. Thus the valid contents of all levels are same with first output even its region size is different.

../_images/image10-en.png

[Example 4] The case crop_policy is designated explicitly.

The conditions for this example are as follows.

Conditions

Type Attribute Value
Input Original media size 128x64 (aspect ratio 2:1)
Output TileType R (aspect ratio 3:2)
Level 4,3,2,1 (resolutions are 384x256, 288x192, 192x128, 96x64 for each level)
Policy crop_position (ex. location of focus) 3: [top-right]
padding_position (ex. location of efficient region on output) 2: [top-left]
crop_inheriting (ex. Whether cropping / padding result for first output tile is reused for other level output tile by simply resizing first output or not) 1: [optimizing cropping area each levels]
crop_policy_ob (ex. The policy for cropping / padding when output resolution is bigger than output one) 3: [dot by dot] (simple padding)
crop_policy_ib (ex. The policy for cropping/padding when input resolution is bigger than output one) 0: [cover] (Resize without aspect ratio change and with shorter side of input be same size of output region)

In this example, for level 4, 3, and 2, crop_policy_ob is applied because original media size is smaller than output size (128x96 < 384x256, 288x192, 192x128) and according to option padding_position: 2 [top-left], the region around original videos are simply padded so that original video position top-left on output. And according to policy crop_inheriting: 1, first output is not re-used but padding region is decided individually for each level and original video region sizes and contents on outputs are same between level 4, 3, and 2. After then, for level 1, crop_policy_ib:0 [cover] is applied because input size is larger than output size (128x96 > 96x64) and original media is resized so that it completely cover output region (no vacant region). Among width and height of resized original media, the one fits with the output region and the other protrudes from output region and cropped. Cropped region is left side of output according to the policy crop_position: 3 [top-right].

../_images/image11-en.png

[Example 5] The case crop_policy is designated explicitly.

The conditions for this example are as follows.

Conditions

Type Attribute Value
Input Original media size 320x240 (aspect ratio 4:3)
Output TileType R (aspect ratio 3:2)
Level 4,3,2,1 (resolutions are 384x256, 288x192, 192x128, 96x64 for each level)
Policy crop_position (ex. location of focus) 3: [top-right]
padding_position (ex. location of efficient region on output) 2: [top-left]
crop_inheriting (ex. Whether cropping / padding result for first output tile is reused for other level output tile by simply resizing first output or not) 1: [optimizing cropping area each levels]
crop_policy_ob (ex. The policy for cropping / padding when output resolution is bigger than output one) 0: [cover] (Resize without aspect ratio change and with longer side of input be same size of output region)
crop_policy_ib (ex. The policy for cropping/padding when input resolution is bigger than output one) 2: [fill] (Resizing to full output region with aspect ratio change)

In this example, for level 4, crop_policy_ob [0: cover] is applied because original media size is smaller than output size (320x240 < 384x256) so original media is resized so that it completely cover output region (no vacant region). Among width and height of resized original media, the one fits with the output region and the other protrudes from output region and cropped. According to option crop position: 3 [top-right], the region cropped is left part of output. After then, for level 3, 2, and 1, crop_policy_ib: 2 [fill] is applied because input size is larger than output size (320x240 > 288x192, 192x128, 96x64) and original video is resized to fulfill output tile size with its aspect ratio changed.

../_images/image12-en.png

[Example 6] The case crop_policy is designated explicitly and same as example 3 except crop_inheriting parameter is 1.

The conditions for this example are as follows.

Conditions

Type Attribute Value
Input Original media size 1920x1080 (aspect ratio 16:9)
Output TileType R (aspect ratio 3:2)
Level 4,3,2,1 (resolutions are 384x256, 288x192, 192x128, 96x64 for each level)
Policy crop_position (ex. location of focus) 3: [top-right]
padding_position (ex. location of efficient region on output) 2: [top-left]
crop_inheriting (ex. Whether cropping / padding result for first output tile is reused for other level output tile by simply resizing first output or not) 1: [optimizing cropping area each levels]
crop_policy_ob (ex. The policy for cropping / padding when output resolution is bigger than output one) 3: [dot by dot] (simple padding)
crop_policy_ib (ex. The policy for cropping/padding when input resolution is bigger than output one) 3: [dot by dot] (simple cropping)

In this case, because crop_policy_ib is 3, “dot by dot”, expansion or contraction is not applied. In addition, as crop_position is 3 [top-right], outside of top-right region in original media is cropped. In example 3, according to crop_inheriting is 0 [Applying for same cropping area], the cropped picture in max level (level 4) is reused for other level’s outputs. But, in this example, as crop_inheriting is 1 [Optimizing cropping area each levels], tile of level 1, 2, and 3 is created individually from original media so the valid region of all level’s outputs are different among each output tiles.

../_images/image13-en.png