mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
codecparsers: mpeg2: add helpers to convert quantization matrices.
Add utility functions to convert quantization matrices from zigzag scan order (as encoded in the bitstream) into raster scan order. Also provide another function to reverse the operation. https://bugzilla.gnome.org/show_bug.cgi?id=693000 Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
parent
46c01de05d
commit
250555a7de
2 changed files with 56 additions and 0 deletions
|
@ -819,3 +819,53 @@ failed:
|
|||
GST_WARNING ("error parsing \"GOP\"");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_mpeg_video_quant_matrix_get_raster_from_zigzag:
|
||||
* @out_quant: (out): The resulting quantization matrix
|
||||
* @quant: The source quantization matrix
|
||||
*
|
||||
* Converts quantization matrix @quant from zigzag scan order to
|
||||
* raster scan order and store the resulting factors into @out_quant.
|
||||
*
|
||||
* Note: it is an error to pass the same table in both @quant and
|
||||
* @out_quant arguments.
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
void
|
||||
gst_mpeg_video_quant_matrix_get_raster_from_zigzag (guint8 out_quant[64],
|
||||
const guint8 quant[64])
|
||||
{
|
||||
guint i;
|
||||
|
||||
g_return_if_fail (out_quant != quant);
|
||||
|
||||
for (i = 0; i < 64; i++)
|
||||
out_quant[mpeg_zigzag_8x8[i]] = quant[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_mpeg_video_quant_matrix_get_zigzag_from_raster:
|
||||
* @out_quant: (out): The resulting quantization matrix
|
||||
* @quant: The source quantization matrix
|
||||
*
|
||||
* Converts quantization matrix @quant from raster scan order to
|
||||
* zigzag scan order and store the resulting factors into @out_quant.
|
||||
*
|
||||
* Note: it is an error to pass the same table in both @quant and
|
||||
* @out_quant arguments.
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
void
|
||||
gst_mpeg_video_quant_matrix_get_zigzag_from_raster (guint8 out_quant[64],
|
||||
const guint8 quant[64])
|
||||
{
|
||||
guint i;
|
||||
|
||||
g_return_if_fail (out_quant != quant);
|
||||
|
||||
for (i = 0; i < 64; i++)
|
||||
out_quant[i] = quant[mpeg_zigzag_8x8[i]];
|
||||
}
|
||||
|
|
|
@ -428,6 +428,12 @@ gboolean gst_mpeg_video_parse_sequence_display_extension (GstMpegVideoSequenceDi
|
|||
gboolean gst_mpeg_video_parse_quant_matrix_extension (GstMpegVideoQuantMatrixExt * quant,
|
||||
const guint8 * data, gsize size, guint offset);
|
||||
|
||||
void gst_mpeg_video_quant_matrix_get_raster_from_zigzag (guint8 out_quant[64],
|
||||
const guint8 quant[64]);
|
||||
|
||||
void gst_mpeg_video_quant_matrix_get_zigzag_from_raster (guint8 out_quant[64],
|
||||
const guint8 quant[64]);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue