Blame gst-libs/gst/video/video-tile.h

Packit 971217
/* GStreamer
Packit 971217
 * Copyright (C) <2013> Wim Taymans <wim.taymans@gmail.com>
Packit 971217
 *
Packit 971217
 * This library is free software; you can redistribute it and/or
Packit 971217
 * modify it under the terms of the GNU Library General Public
Packit 971217
 * License as published by the Free Software Foundation; either
Packit 971217
 * version 2 of the License, or (at your option) any later version.
Packit 971217
 *
Packit 971217
 * This library is distributed in the hope that it will be useful,
Packit 971217
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 971217
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 971217
 * Library General Public License for more details.
Packit 971217
 *
Packit 971217
 * You should have received a copy of the GNU Library General Public
Packit 971217
 * License along with this library; if not, write to the
Packit 971217
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit 971217
 * Boston, MA 02110-1301, USA.
Packit 971217
 */
Packit 971217
Packit 971217
#ifndef __GST_VIDEO_TILE_H__
Packit 971217
#define __GST_VIDEO_TILE_H__
Packit 971217
Packit 971217
#include <gst/gst.h>
Packit 971217
#include <gst/video/video-prelude.h>
Packit 971217
Packit 971217
G_BEGIN_DECLS
Packit 971217
Packit 971217
/**
Packit 971217
 * GstVideoTileType:
Packit 971217
 * @GST_VIDEO_TILE_TYPE_INDEXED: Tiles are indexed. Use
Packit 971217
 *   gst_video_tile_get_index () to retrieve the tile at the requested
Packit 971217
 *   coordinates.
Packit 971217
 *
Packit 971217
 * Enum value describing the most common tiling types.
Packit 971217
 */
Packit 971217
typedef enum
Packit 971217
{
Packit 971217
  GST_VIDEO_TILE_TYPE_INDEXED = 0
Packit 971217
} GstVideoTileType;
Packit 971217
Packit 971217
#define GST_VIDEO_TILE_TYPE_SHIFT     (16)
Packit 971217
Packit 971217
/**
Packit 971217
 * GST_VIDEO_TILE_TYPE_MASK: (value 65535)
Packit 971217
 */
Packit 971217
#define GST_VIDEO_TILE_TYPE_MASK      ((1 << GST_VIDEO_TILE_TYPE_SHIFT) - 1)
Packit 971217
Packit 971217
/**
Packit 971217
 * GST_VIDEO_TILE_MAKE_MODE:
Packit 971217
 * @num: the mode number to create
Packit 971217
 * @type: the tile mode type
Packit 971217
 *
Packit 971217
 * use this macro to create new tile modes.
Packit 971217
 */
Packit 971217
#define GST_VIDEO_TILE_MAKE_MODE(num, type) \
Packit 971217
    (((num) << GST_VIDEO_TILE_TYPE_SHIFT) | (GST_VIDEO_TILE_TYPE_ ##type))
Packit 971217
Packit 971217
/**
Packit 971217
 * GST_VIDEO_TILE_MODE_TYPE:
Packit 971217
 * @mode: the tile mode
Packit 971217
 *
Packit 971217
 * Get the tile mode type of @mode
Packit 971217
 */
Packit 971217
#define GST_VIDEO_TILE_MODE_TYPE(mode)       ((mode) & GST_VIDEO_TILE_TYPE_MASK)
Packit 971217
Packit 971217
/**
Packit 971217
 * GST_VIDEO_TILE_MODE_IS_INDEXED:
Packit 971217
 * @mode: a tile mode
Packit 971217
 *
Packit 971217
 * Check if @mode is an indexed tile type
Packit 971217
 */
Packit 971217
#define GST_VIDEO_TILE_MODE_IS_INDEXED(mode) (GST_VIDEO_TILE_MODE_TYPE(mode) == GST_VIDEO_TILE_TYPE_INDEXED)
Packit 971217
Packit 971217
Packit 971217
#define GST_VIDEO_TILE_Y_TILES_SHIFT     (16)
Packit 971217
Packit 971217
/**
Packit 971217
 * GST_VIDEO_TILE_X_TILES_MASK: (value 65535)
Packit 971217
 */
Packit 971217
#define GST_VIDEO_TILE_X_TILES_MASK      ((1 << GST_VIDEO_TILE_Y_TILES_SHIFT) - 1)
Packit 971217
Packit 971217
/**
Packit 971217
 * GST_VIDEO_TILE_MAKE_STRIDE:
Packit 971217
 * @x_tiles: number of tiles in X
Packit 971217
 * @y_tiles: number of tiles in Y
Packit 971217
 *
Packit 971217
 * Encode the number of tile in X and Y into the stride.
Packit 971217
 */
Packit 971217
#define GST_VIDEO_TILE_MAKE_STRIDE(x_tiles, y_tiles) \
Packit 971217
    (((y_tiles) << GST_VIDEO_TILE_Y_TILES_SHIFT) | (x_tiles))
Packit 971217
Packit 971217
/**
Packit 971217
 * GST_VIDEO_TILE_X_TILES:
Packit 971217
 * @stride: plane stride
Packit 971217
 *
Packit 971217
 * Extract the number of tiles in X from the stride value.
Packit 971217
 */
Packit 971217
#define GST_VIDEO_TILE_X_TILES(stride) ((stride) & GST_VIDEO_TILE_X_TILES_MASK)
Packit 971217
Packit 971217
/**
Packit 971217
 * GST_VIDEO_TILE_Y_TILES:
Packit 971217
 * @stride: plane stride
Packit 971217
 *
Packit 971217
 * Extract the number of tiles in Y from the stride value.
Packit 971217
 */
Packit 971217
#define GST_VIDEO_TILE_Y_TILES(stride) ((stride) >> GST_VIDEO_TILE_Y_TILES_SHIFT)
Packit 971217
Packit 971217
/**
Packit 971217
 * GstVideoTileMode:
Packit 971217
 * @GST_VIDEO_TILE_MODE_UNKNOWN: Unknown or unset tile mode
Packit 971217
 * @GST_VIDEO_TILE_MODE_ZFLIPZ_2X2: Every four adjacent blocks - two
Packit 971217
 *    horizontally and two vertically are grouped together and are located
Packit 971217
 *    in memory in Z or flipped Z order. In case of odd rows, the last row
Packit 971217
 *    of blocks is arranged in linear order.
Packit 971217
 *
Packit 971217
 * Enum value describing the available tiling modes.
Packit 971217
 */
Packit 971217
typedef enum
Packit 971217
{
Packit 971217
  GST_VIDEO_TILE_MODE_UNKNOWN = 0,
Packit 971217
  GST_VIDEO_TILE_MODE_ZFLIPZ_2X2 = GST_VIDEO_TILE_MAKE_MODE (1, INDEXED),
Packit 971217
} GstVideoTileMode;
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
guint           gst_video_tile_get_index                (GstVideoTileMode mode, gint x, gint y,
Packit 971217
                                                         gint x_tiles, gint y_tiles);
Packit 971217
Packit 971217
Packit 971217
G_END_DECLS
Packit 971217
Packit 971217
#endif /* __GST_VIDEO_TILE_H__ */