MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / adjust_odd_shape

Function adjust_odd_shape

arm_compute/core/Validate.h:345–362  ·  view source on GitHub ↗

Adjust tensor shape size if width or height are odd for a given multi-planar format. No modification is done for other formats. * * @note Adding here a few links discussing the issue of odd size and sharing the same solution: * Android Source * <a

Source from the content-addressed store, hash-verified

343 * @return The adjusted tensor shape.
344 */
345inline TensorShape adjust_odd_shape(const TensorShape &shape, Format format)
346{
347 TensorShape output{shape};
348
349 // Force width to be even for formats which require subsampling of the U and V channels
350 if (has_format_horizontal_subsampling(format))
351 {
352 output.set(0, (output.x() + 1) & ~1U);
353 }
354
355 // Force height to be even for formats which require subsampling of the U and V channels
356 if (has_format_vertical_subsampling(format))
357 {
358 output.set(1, (output.y() + 1) & ~1U);
359 }
360
361 return output;
362}
363
364/** Return an error if the passed tensor objects are not even.
365 *

Callers 1

Calls 5

setMethod · 0.45
xMethod · 0.45
yMethod · 0.45

Tested by

no test coverage detected