On Sun, 13 Apr 2014 02:29:55 +0200
Vittorio Giovara <[email protected]> wrote:
> Add AV_PKT_DATA_DISPLAYMATRIX and AV_FRAME_DATA_DISPLAYMATRIX as stream and
> frame side data (respectively) to describe a display transformation matrix
> for linear transformation operations on the decoded video.
>
> Add APIs to easily access values such as rotation, scaling and translation.
> ---
> + /**
> + * This side data contains a 3x2 matrix (math notation) describing
> + * two dimensional transformations to be applied on the decoded video.
> + * Elements are represented as s32le, fixed point 16.16.
> + */
> + AV_PKT_DATA_DISPLAYMATRIX,
> };
> +int av_display_rotation_angle(uint8_t *matrix)
> +{
> + int32_t (*display_matrix)[2] = (int32_t (*)[2])matrix;
> + double rotationf, scale[2];
> +
> + scale[0] = sqrt(CONV_FP(display_matrix[0][0]) *
> CONV_FP(display_matrix[0][0]) +
> + CONV_FP(display_matrix[1][0]) *
> CONV_FP(display_matrix[1][0]));
The entries are defined as s32le, but you access it as int32_t. This
will break on big endian platforms (apparently these refuse to die, so
it's still an issue).
> diff --git a/libavutil/frame.h b/libavutil/frame.h
> index 3bec8e5..bfd1937 100644
> --- a/libavutil/frame.h
> +++ b/libavutil/frame.h
> @@ -73,6 +73,10 @@ enum AVFrameSideDataType {
> * ReplayGain information in the form of the AVReplayGain struct.
> */
> AV_FRAME_DATA_REPLAYGAIN,
> + /**
> + * Transformation matrix. Accessors defined in libavutil/display.h.
> + */
> + AV_FRAME_DATA_DISPLAYMATRIX,
> };
This is a bit unclear. Ideally, it would use the same format as the
packet side data. (Like it's done for replaygain metadata.)
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel