mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
v4l2codecs: vp8: Update to the new uAPI
Starting from Linux v5.13, the V4L2 stateless VP8 uAPI is updated and stable. Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2075>
This commit is contained in:
parent
c8ffd39dfe
commit
d036b4aad4
5 changed files with 237 additions and 154 deletions
|
@ -25,7 +25,6 @@
|
|||
#include "gstv4l2codecalphadecodebin.h"
|
||||
#include "gstv4l2codecpool.h"
|
||||
#include "gstv4l2codecvp8dec.h"
|
||||
#include "linux/vp8-ctrls.h"
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (v4l2_vp8dec_debug);
|
||||
#define GST_CAT_DEFAULT v4l2_vp8dec_debug
|
||||
|
@ -70,7 +69,7 @@ struct _GstV4l2CodecVp8Dec
|
|||
gboolean need_negotiation;
|
||||
gboolean copy_frames;
|
||||
|
||||
struct v4l2_ctrl_vp8_frame_header frame_header;
|
||||
struct v4l2_ctrl_vp8_frame frame_header;
|
||||
|
||||
GstMemory *bitstream;
|
||||
GstMapInfo bitstream_map;
|
||||
|
@ -163,7 +162,7 @@ gst_v4l2_codec_vp8_dec_negotiate (GstVideoDecoder * decoder)
|
|||
/* *INDENT-OFF* */
|
||||
struct v4l2_ext_control control[] = {
|
||||
{
|
||||
.id = V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER,
|
||||
.id = V4L2_CID_STATELESS_VP8_FRAME,
|
||||
.ptr = &self->frame_header,
|
||||
.size = sizeof (self->frame_header),
|
||||
},
|
||||
|
@ -288,57 +287,57 @@ gst_v4l2_codec_vp8_dec_decide_allocation (GstVideoDecoder * decoder,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_v4l2_codec_vp8_dec_fill_segment_header (struct v4l2_vp8_segment_header
|
||||
*segment_header, const GstVp8Segmentation * segmentation)
|
||||
gst_v4l2_codec_vp8_dec_fill_segment (struct v4l2_vp8_segment
|
||||
*segment, const GstVp8Segmentation * segmentation)
|
||||
{
|
||||
gint i;
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
segment_header->flags =
|
||||
(segmentation->segmentation_enabled ? V4L2_VP8_SEGMENT_HEADER_FLAG_ENABLED : 0) |
|
||||
(segmentation->update_mb_segmentation_map ? V4L2_VP8_SEGMENT_HEADER_FLAG_UPDATE_MAP : 0) |
|
||||
(segmentation->update_segment_feature_data ? V4L2_VP8_SEGMENT_HEADER_FLAG_UPDATE_FEATURE_DATA : 0) |
|
||||
(segmentation->segment_feature_mode ? 0 : V4L2_VP8_SEGMENT_HEADER_FLAG_DELTA_VALUE_MODE);
|
||||
segment->flags =
|
||||
(segmentation->segmentation_enabled ? V4L2_VP8_SEGMENT_FLAG_ENABLED : 0) |
|
||||
(segmentation->update_mb_segmentation_map ? V4L2_VP8_SEGMENT_FLAG_UPDATE_MAP : 0) |
|
||||
(segmentation->update_segment_feature_data ? V4L2_VP8_SEGMENT_FLAG_UPDATE_FEATURE_DATA : 0) |
|
||||
(segmentation->segment_feature_mode ? 0 : V4L2_VP8_SEGMENT_FLAG_DELTA_VALUE_MODE);
|
||||
/* *INDENT-ON* */
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
segment_header->quant_update[i] = segmentation->quantizer_update_value[i];
|
||||
segment_header->lf_update[i] = segmentation->lf_update_value[i];
|
||||
segment->quant_update[i] = segmentation->quantizer_update_value[i];
|
||||
segment->lf_update[i] = segmentation->lf_update_value[i];
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
segment_header->segment_probs[i] = segmentation->segment_prob[i];
|
||||
segment->segment_probs[i] = segmentation->segment_prob[i];
|
||||
|
||||
segment_header->padding = 0;
|
||||
segment->padding = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_v4l2_codec_vp8_dec_fill_lf_header (struct v4l2_vp8_loopfilter_header
|
||||
*lf_header, const GstVp8MbLfAdjustments * lf_adj)
|
||||
gst_v4l2_codec_vp8_dec_fill_lf (struct v4l2_vp8_loop_filter
|
||||
*lf, const GstVp8MbLfAdjustments * lf_adj)
|
||||
{
|
||||
gint i;
|
||||
|
||||
lf_header->flags |=
|
||||
(lf_adj->loop_filter_adj_enable ? V4L2_VP8_LF_HEADER_ADJ_ENABLE : 0) |
|
||||
(lf_adj->mode_ref_lf_delta_update ? V4L2_VP8_LF_HEADER_DELTA_UPDATE : 0);
|
||||
lf->flags |=
|
||||
(lf_adj->loop_filter_adj_enable ? V4L2_VP8_LF_ADJ_ENABLE : 0) |
|
||||
(lf_adj->mode_ref_lf_delta_update ? V4L2_VP8_LF_DELTA_UPDATE : 0);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
lf_header->ref_frm_delta[i] = lf_adj->ref_frame_delta[i];
|
||||
lf_header->mb_mode_delta[i] = lf_adj->mb_mode_delta[i];
|
||||
lf->ref_frm_delta[i] = lf_adj->ref_frame_delta[i];
|
||||
lf->mb_mode_delta[i] = lf_adj->mb_mode_delta[i];
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_v4l2_codec_vp8_dec_fill_entropy_header (struct v4l2_vp8_entropy_header
|
||||
*entropy_header, const GstVp8FrameHdr * frame_hdr)
|
||||
gst_v4l2_codec_vp8_dec_fill_entropy (struct v4l2_vp8_entropy
|
||||
*entropy, const GstVp8FrameHdr * frame_hdr)
|
||||
{
|
||||
memcpy (entropy_header->coeff_probs, frame_hdr->token_probs.prob,
|
||||
memcpy (entropy->coeff_probs, frame_hdr->token_probs.prob,
|
||||
sizeof (frame_hdr->token_probs.prob));
|
||||
memcpy (entropy_header->y_mode_probs, frame_hdr->mode_probs.y_prob,
|
||||
memcpy (entropy->y_mode_probs, frame_hdr->mode_probs.y_prob,
|
||||
sizeof (frame_hdr->mode_probs.y_prob));
|
||||
memcpy (entropy_header->uv_mode_probs, frame_hdr->mode_probs.uv_prob,
|
||||
memcpy (entropy->uv_mode_probs, frame_hdr->mode_probs.uv_prob,
|
||||
sizeof (frame_hdr->mode_probs.uv_prob));
|
||||
memcpy (entropy_header->mv_probs, frame_hdr->mv_probs.prob,
|
||||
memcpy (entropy->mv_probs, frame_hdr->mv_probs.prob,
|
||||
sizeof (frame_hdr->mv_probs.prob));
|
||||
}
|
||||
|
||||
|
@ -349,13 +348,13 @@ gst_v4l2_codec_vp8_dec_fill_frame_header (GstV4l2CodecVp8Dec * self,
|
|||
gint i;
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
self->frame_header = (struct v4l2_ctrl_vp8_frame_header) {
|
||||
.lf_header = (struct v4l2_vp8_loopfilter_header) {
|
||||
self->frame_header = (struct v4l2_ctrl_vp8_frame) {
|
||||
.lf = (struct v4l2_vp8_loop_filter) {
|
||||
.sharpness_level = frame_hdr->sharpness_level,
|
||||
.level = frame_hdr->loop_filter_level,
|
||||
.flags = (frame_hdr->filter_type == 1 ? V4L2_VP8_LF_FILTER_TYPE_SIMPLE : 0)
|
||||
},
|
||||
.quant_header = (struct v4l2_vp8_quantization_header) {
|
||||
.quant = (struct v4l2_vp8_quantization) {
|
||||
.y_ac_qi = frame_hdr->quant_indices.y_ac_qi,
|
||||
.y_dc_delta = frame_hdr->quant_indices.y_dc_delta,
|
||||
.y2_dc_delta = frame_hdr->quant_indices.y2_dc_delta,
|
||||
|
@ -385,19 +384,18 @@ gst_v4l2_codec_vp8_dec_fill_frame_header (GstV4l2CodecVp8Dec * self,
|
|||
.first_part_size = frame_hdr->first_part_size,
|
||||
.first_part_header_bits = frame_hdr->header_size,
|
||||
|
||||
.flags = (frame_hdr->key_frame ? V4L2_VP8_FRAME_HEADER_FLAG_KEY_FRAME : 0) |
|
||||
(frame_hdr->show_frame ? V4L2_VP8_FRAME_HEADER_FLAG_SHOW_FRAME : 0) |
|
||||
(frame_hdr->mb_no_skip_coeff ? V4L2_VP8_FRAME_HEADER_FLAG_MB_NO_SKIP_COEFF : 0) |
|
||||
(frame_hdr->sign_bias_golden ? V4L2_VP8_FRAME_HEADER_FLAG_SIGN_BIAS_GOLDEN : 0) |
|
||||
(frame_hdr->sign_bias_alternate ? V4L2_VP8_FRAME_HEADER_FLAG_SIGN_BIAS_ALT : 0),
|
||||
.flags = (frame_hdr->key_frame ? V4L2_VP8_FRAME_FLAG_KEY_FRAME : 0) |
|
||||
(frame_hdr->show_frame ? V4L2_VP8_FRAME_FLAG_SHOW_FRAME : 0) |
|
||||
(frame_hdr->mb_no_skip_coeff ? V4L2_VP8_FRAME_FLAG_MB_NO_SKIP_COEFF : 0) |
|
||||
(frame_hdr->sign_bias_golden ? V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN : 0) |
|
||||
(frame_hdr->sign_bias_alternate ? V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT : 0),
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
self->frame_header.dct_part_sizes[i] = frame_hdr->partition_size[i];
|
||||
|
||||
gst_v4l2_codec_vp8_dec_fill_entropy_header (&self->
|
||||
frame_header.entropy_header, frame_hdr);
|
||||
gst_v4l2_codec_vp8_dec_fill_entropy (&self->frame_header.entropy, frame_hdr);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -524,9 +522,9 @@ gst_v4l2_codec_vp8_dec_decode_picture (GstVp8Decoder * decoder,
|
|||
}
|
||||
|
||||
gst_v4l2_codec_vp8_dec_fill_frame_header (self, &picture->frame_hdr);
|
||||
gst_v4l2_codec_vp8_dec_fill_segment_header (&self->
|
||||
frame_header.segment_header, &parser->segmentation);
|
||||
gst_v4l2_codec_vp8_dec_fill_lf_header (&self->frame_header.lf_header,
|
||||
gst_v4l2_codec_vp8_dec_fill_segment (&self->frame_header.seg,
|
||||
&parser->segmentation);
|
||||
gst_v4l2_codec_vp8_dec_fill_lf (&self->frame_header.lf,
|
||||
&parser->mb_lf_adjust);
|
||||
gst_v4l2_codec_vp8_dec_fill_references (self);
|
||||
|
||||
|
@ -561,7 +559,7 @@ gst_v4l2_codec_vp8_dec_end_picture (GstVp8Decoder * decoder,
|
|||
/* *INDENT-OFF* */
|
||||
struct v4l2_ext_control control[] = {
|
||||
{
|
||||
.id = V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER,
|
||||
.id = V4L2_CID_STATELESS_VP8_FRAME,
|
||||
.ptr = &self->frame_header,
|
||||
.size = sizeof(self->frame_header),
|
||||
},
|
||||
|
|
|
@ -1655,6 +1655,201 @@ struct v4l2_ctrl_fwht_params {
|
|||
__u32 quantization;
|
||||
};
|
||||
|
||||
/* Stateless VP8 control */
|
||||
|
||||
#define V4L2_VP8_SEGMENT_FLAG_ENABLED 0x01
|
||||
#define V4L2_VP8_SEGMENT_FLAG_UPDATE_MAP 0x02
|
||||
#define V4L2_VP8_SEGMENT_FLAG_UPDATE_FEATURE_DATA 0x04
|
||||
#define V4L2_VP8_SEGMENT_FLAG_DELTA_VALUE_MODE 0x08
|
||||
|
||||
/**
|
||||
* struct v4l2_vp8_segment - VP8 segment-based adjustments parameters
|
||||
*
|
||||
* @quant_update: update values for the segment quantizer.
|
||||
* @lf_update: update values for the loop filter level.
|
||||
* @segment_probs: branch probabilities of the segment_id decoding tree.
|
||||
* @padding: padding field. Should be zeroed by applications.
|
||||
* @flags: see V4L2_VP8_SEGMENT_FLAG_{}.
|
||||
*
|
||||
* This structure contains segment-based adjustments related parameters.
|
||||
* See the 'update_segmentation()' part of the frame header syntax,
|
||||
* and section '9.3. Segment-Based Adjustments' of the VP8 specification
|
||||
* for more details.
|
||||
*/
|
||||
struct v4l2_vp8_segment {
|
||||
__s8 quant_update[4];
|
||||
__s8 lf_update[4];
|
||||
__u8 segment_probs[3];
|
||||
__u8 padding;
|
||||
__u32 flags;
|
||||
};
|
||||
|
||||
#define V4L2_VP8_LF_ADJ_ENABLE 0x01
|
||||
#define V4L2_VP8_LF_DELTA_UPDATE 0x02
|
||||
#define V4L2_VP8_LF_FILTER_TYPE_SIMPLE 0x04
|
||||
|
||||
/**
|
||||
* struct v4l2_vp8_loop_filter - VP8 loop filter parameters
|
||||
*
|
||||
* @ref_frm_delta: Reference frame signed delta values.
|
||||
* @mb_mode_delta: MB prediction mode signed delta values.
|
||||
* @sharpness_level: matches sharpness_level syntax element.
|
||||
* @level: matches loop_filter_level syntax element.
|
||||
* @padding: padding field. Should be zeroed by applications.
|
||||
* @flags: see V4L2_VP8_LF_FLAG_{}.
|
||||
*
|
||||
* This structure contains loop filter related parameters.
|
||||
* See the 'mb_lf_adjustments()' part of the frame header syntax,
|
||||
* and section '9.4. Loop Filter Type and Levels' of the VP8 specification
|
||||
* for more details.
|
||||
*/
|
||||
struct v4l2_vp8_loop_filter {
|
||||
__s8 ref_frm_delta[4];
|
||||
__s8 mb_mode_delta[4];
|
||||
__u8 sharpness_level;
|
||||
__u8 level;
|
||||
__u16 padding;
|
||||
__u32 flags;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct v4l2_vp8_quantization - VP8 quantizattion indices
|
||||
*
|
||||
* @y_ac_qi: luma AC coefficient table index.
|
||||
* @y_dc_delta: luma DC delta vaue.
|
||||
* @y2_dc_delta: y2 block DC delta value.
|
||||
* @y2_ac_delta: y2 block AC delta value.
|
||||
* @uv_dc_delta: chroma DC delta value.
|
||||
* @uv_ac_delta: chroma AC delta value.
|
||||
* @padding: padding field. Should be zeroed by applications.
|
||||
|
||||
* This structure contains the quantization indices present
|
||||
* in 'quant_indices()' part of the frame header syntax.
|
||||
* See section '9.6. Dequantization Indices' of the VP8 specification
|
||||
* for more details.
|
||||
*/
|
||||
struct v4l2_vp8_quantization {
|
||||
__u8 y_ac_qi;
|
||||
__s8 y_dc_delta;
|
||||
__s8 y2_dc_delta;
|
||||
__s8 y2_ac_delta;
|
||||
__s8 uv_dc_delta;
|
||||
__s8 uv_ac_delta;
|
||||
__u16 padding;
|
||||
};
|
||||
|
||||
#define V4L2_VP8_COEFF_PROB_CNT 11
|
||||
#define V4L2_VP8_MV_PROB_CNT 19
|
||||
|
||||
/**
|
||||
* struct v4l2_vp8_entropy - VP8 update probabilities
|
||||
*
|
||||
* @coeff_probs: coefficient probability update values.
|
||||
* @y_mode_probs: luma intra-prediction probabilities.
|
||||
* @uv_mode_probs: chroma intra-prediction probabilities.
|
||||
* @mv_probs: mv decoding probability.
|
||||
* @padding: padding field. Should be zeroed by applications.
|
||||
*
|
||||
* This structure contains the update probabilities present in
|
||||
* 'token_prob_update()' and 'mv_prob_update()' part of the frame header.
|
||||
* See section '17.2. Probability Updates' of the VP8 specification
|
||||
* for more details.
|
||||
*/
|
||||
struct v4l2_vp8_entropy {
|
||||
__u8 coeff_probs[4][8][3][V4L2_VP8_COEFF_PROB_CNT];
|
||||
__u8 y_mode_probs[4];
|
||||
__u8 uv_mode_probs[3];
|
||||
__u8 mv_probs[2][V4L2_VP8_MV_PROB_CNT];
|
||||
__u8 padding[3];
|
||||
};
|
||||
|
||||
/**
|
||||
* struct v4l2_vp8_entropy_coder_state - VP8 boolean coder state
|
||||
*
|
||||
* @range: coder state value for "Range"
|
||||
* @value: coder state value for "Value"
|
||||
* @bit_count: number of bits left in range "Value".
|
||||
* @padding: padding field. Should be zeroed by applications.
|
||||
*
|
||||
* This structure contains the state for the boolean coder, as
|
||||
* explained in section '7. Boolean Entropy Decoder' of the VP8 specification.
|
||||
*/
|
||||
struct v4l2_vp8_entropy_coder_state {
|
||||
__u8 range;
|
||||
__u8 value;
|
||||
__u8 bit_count;
|
||||
__u8 padding;
|
||||
};
|
||||
|
||||
#define V4L2_VP8_FRAME_FLAG_KEY_FRAME 0x01
|
||||
#define V4L2_VP8_FRAME_FLAG_EXPERIMENTAL 0x02
|
||||
#define V4L2_VP8_FRAME_FLAG_SHOW_FRAME 0x04
|
||||
#define V4L2_VP8_FRAME_FLAG_MB_NO_SKIP_COEFF 0x08
|
||||
#define V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN 0x10
|
||||
#define V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT 0x20
|
||||
|
||||
#define V4L2_VP8_FRAME_IS_KEY_FRAME(hdr) \
|
||||
(!!((hdr)->flags & V4L2_VP8_FRAME_FLAG_KEY_FRAME))
|
||||
|
||||
#define V4L2_CID_STATELESS_VP8_FRAME (V4L2_CID_CODEC_STATELESS_BASE + 200)
|
||||
/**
|
||||
* struct v4l2_vp8_frame - VP8 frame parameters
|
||||
*
|
||||
* @seg: segmentation parameters. See &v4l2_vp8_segment for more details
|
||||
* @lf: loop filter parameters. See &v4l2_vp8_loop_filter for more details
|
||||
* @quant: quantization parameters. See &v4l2_vp8_quantization for more details
|
||||
* @probs: probabilities. See &v4l2_vp9_probabilities for more details
|
||||
* @width: frame width.
|
||||
* @height: frame height.
|
||||
* @horizontal_scale: horizontal scaling factor.
|
||||
* @vertical_scale: vertical scaling factor.
|
||||
* @version: bitstream version.
|
||||
* @prob_skip_false: frame header syntax element.
|
||||
* @prob_intra: frame header syntax element.
|
||||
* @prob_last: frame header syntax element.
|
||||
* @prob_gf: frame header syntax element.
|
||||
* @num_dct_parts: number of DCT coefficients partitions.
|
||||
* @first_part_size: size of the first partition, i.e. the control partition.
|
||||
* @first_part_header_bits: size in bits of the first partition header portion.
|
||||
* @dct_part_sizes: DCT coefficients sizes.
|
||||
* @last_frame_ts: "last" reference buffer timestamp.
|
||||
* The timestamp refers to the timestamp field in struct v4l2_buffer.
|
||||
* Use v4l2_timeval_to_ns() to convert the struct timeval to a __u64.
|
||||
* @golden_frame_ts: "golden" reference buffer timestamp.
|
||||
* @alt_frame_ts: "alt" reference buffer timestamp.
|
||||
* @flags: see V4L2_VP8_FRAME_FLAG_{}.
|
||||
*/
|
||||
struct v4l2_ctrl_vp8_frame {
|
||||
struct v4l2_vp8_segment seg;
|
||||
struct v4l2_vp8_loop_filter lf;
|
||||
struct v4l2_vp8_quantization quant;
|
||||
struct v4l2_vp8_entropy entropy;
|
||||
struct v4l2_vp8_entropy_coder_state coder_state;
|
||||
|
||||
__u16 width;
|
||||
__u16 height;
|
||||
|
||||
__u8 horizontal_scale;
|
||||
__u8 vertical_scale;
|
||||
|
||||
__u8 version;
|
||||
__u8 prob_skip_false;
|
||||
__u8 prob_intra;
|
||||
__u8 prob_last;
|
||||
__u8 prob_gf;
|
||||
__u8 num_dct_parts;
|
||||
|
||||
__u32 first_part_size;
|
||||
__u32 first_part_header_bits;
|
||||
__u32 dct_part_sizes[8];
|
||||
|
||||
__u64 last_frame_ts;
|
||||
__u64 golden_frame_ts;
|
||||
__u64 alt_frame_ts;
|
||||
|
||||
__u64 flags;
|
||||
};
|
||||
|
||||
/* MPEG-compression definitions kept for backwards compatibility */
|
||||
#define V4L2_CTRL_CLASS_MPEG V4L2_CTRL_CLASS_CODEC
|
||||
#define V4L2_CID_MPEG_CLASS V4L2_CID_CODEC_CLASS
|
||||
|
|
|
@ -692,6 +692,7 @@ struct v4l2_pix_format {
|
|||
#define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */
|
||||
#define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M Annex L compliant stream */
|
||||
#define V4L2_PIX_FMT_VP8 v4l2_fourcc('V', 'P', '8', '0') /* VP8 */
|
||||
#define V4L2_PIX_FMT_VP8_FRAME v4l2_fourcc('V', 'P', '8', 'F') /* VP8 parsed frame */
|
||||
#define V4L2_PIX_FMT_VP9 v4l2_fourcc('V', 'P', '9', '0') /* VP9 */
|
||||
#define V4L2_PIX_FMT_HEVC v4l2_fourcc('H', 'E', 'V', 'C') /* HEVC aka H.265 */
|
||||
#define V4L2_PIX_FMT_FWHT v4l2_fourcc('F', 'W', 'H', 'T') /* Fast Walsh Hadamard Transform (vicodec) */
|
||||
|
@ -1763,6 +1764,8 @@ enum v4l2_ctrl_type {
|
|||
V4L2_CTRL_TYPE_H264_PRED_WEIGHTS = 0x0205,
|
||||
|
||||
V4L2_CTRL_TYPE_FWHT_PARAMS = 0x0220,
|
||||
|
||||
V4L2_CTRL_TYPE_VP8_FRAME = 0x0240,
|
||||
};
|
||||
|
||||
/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
|
||||
|
|
|
@ -1,112 +0,0 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* These are the VP8 state controls for use with stateless VP8
|
||||
* codec drivers.
|
||||
*
|
||||
* It turns out that these structs are not stable yet and will undergo
|
||||
* more changes. So keep them private until they are stable and ready to
|
||||
* become part of the official public API.
|
||||
*/
|
||||
|
||||
#ifndef _VP8_CTRLS_H_
|
||||
#define _VP8_CTRLS_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#define V4L2_PIX_FMT_VP8_FRAME v4l2_fourcc('V', 'P', '8', 'F')
|
||||
|
||||
#define V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER (V4L2_CID_MPEG_BASE + 2000)
|
||||
#define V4L2_CTRL_TYPE_VP8_FRAME_HEADER 0x301
|
||||
|
||||
#define V4L2_VP8_SEGMENT_HEADER_FLAG_ENABLED 0x01
|
||||
#define V4L2_VP8_SEGMENT_HEADER_FLAG_UPDATE_MAP 0x02
|
||||
#define V4L2_VP8_SEGMENT_HEADER_FLAG_UPDATE_FEATURE_DATA 0x04
|
||||
#define V4L2_VP8_SEGMENT_HEADER_FLAG_DELTA_VALUE_MODE 0x08
|
||||
|
||||
struct v4l2_vp8_segment_header {
|
||||
__s8 quant_update[4];
|
||||
__s8 lf_update[4];
|
||||
__u8 segment_probs[3];
|
||||
__u8 padding;
|
||||
__u32 flags;
|
||||
};
|
||||
|
||||
#define V4L2_VP8_LF_HEADER_ADJ_ENABLE 0x01
|
||||
#define V4L2_VP8_LF_HEADER_DELTA_UPDATE 0x02
|
||||
#define V4L2_VP8_LF_FILTER_TYPE_SIMPLE 0x04
|
||||
struct v4l2_vp8_loopfilter_header {
|
||||
__s8 ref_frm_delta[4];
|
||||
__s8 mb_mode_delta[4];
|
||||
__u8 sharpness_level;
|
||||
__u8 level;
|
||||
__u16 padding;
|
||||
__u32 flags;
|
||||
};
|
||||
|
||||
struct v4l2_vp8_quantization_header {
|
||||
__u8 y_ac_qi;
|
||||
__s8 y_dc_delta;
|
||||
__s8 y2_dc_delta;
|
||||
__s8 y2_ac_delta;
|
||||
__s8 uv_dc_delta;
|
||||
__s8 uv_ac_delta;
|
||||
__u16 padding;
|
||||
};
|
||||
|
||||
struct v4l2_vp8_entropy_header {
|
||||
__u8 coeff_probs[4][8][3][11];
|
||||
__u8 y_mode_probs[4];
|
||||
__u8 uv_mode_probs[3];
|
||||
__u8 mv_probs[2][19];
|
||||
__u8 padding[3];
|
||||
};
|
||||
|
||||
struct v4l2_vp8_entropy_coder_state {
|
||||
__u8 range;
|
||||
__u8 value;
|
||||
__u8 bit_count;
|
||||
__u8 padding;
|
||||
};
|
||||
|
||||
#define V4L2_VP8_FRAME_HEADER_FLAG_KEY_FRAME 0x01
|
||||
#define V4L2_VP8_FRAME_HEADER_FLAG_EXPERIMENTAL 0x02
|
||||
#define V4L2_VP8_FRAME_HEADER_FLAG_SHOW_FRAME 0x04
|
||||
#define V4L2_VP8_FRAME_HEADER_FLAG_MB_NO_SKIP_COEFF 0x08
|
||||
#define V4L2_VP8_FRAME_HEADER_FLAG_SIGN_BIAS_GOLDEN 0x10
|
||||
#define V4L2_VP8_FRAME_HEADER_FLAG_SIGN_BIAS_ALT 0x20
|
||||
|
||||
#define VP8_FRAME_IS_KEY_FRAME(hdr) \
|
||||
(!!((hdr)->flags & V4L2_VP8_FRAME_HEADER_FLAG_KEY_FRAME))
|
||||
|
||||
struct v4l2_ctrl_vp8_frame_header {
|
||||
struct v4l2_vp8_segment_header segment_header;
|
||||
struct v4l2_vp8_loopfilter_header lf_header;
|
||||
struct v4l2_vp8_quantization_header quant_header;
|
||||
struct v4l2_vp8_entropy_header entropy_header;
|
||||
struct v4l2_vp8_entropy_coder_state coder_state;
|
||||
|
||||
__u16 width;
|
||||
__u16 height;
|
||||
|
||||
__u8 horizontal_scale;
|
||||
__u8 vertical_scale;
|
||||
|
||||
__u8 version;
|
||||
__u8 prob_skip_false;
|
||||
__u8 prob_intra;
|
||||
__u8 prob_last;
|
||||
__u8 prob_gf;
|
||||
__u8 num_dct_parts;
|
||||
|
||||
__u32 first_part_size;
|
||||
__u32 first_part_header_bits;
|
||||
__u32 dct_part_sizes[8];
|
||||
|
||||
__u64 last_frame_ts;
|
||||
__u64 golden_frame_ts;
|
||||
__u64 alt_frame_ts;
|
||||
|
||||
__u64 flags;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -27,7 +27,6 @@
|
|||
#include "gstv4l2codecvp8dec.h"
|
||||
#include "gstv4l2decoder.h"
|
||||
#include "linux/v4l2-controls.h"
|
||||
#include "linux/vp8-ctrls.h"
|
||||
#include "linux/media.h"
|
||||
|
||||
#define GST_CAT_DEFAULT gstv4l2codecs_debug
|
||||
|
|
Loading…
Reference in a new issue