Bug 1660336 Provide libva headers to build Firefox without libva-devel installed, r=jya

Differential Revision: https://phabricator.services.mozilla.com/D97920
This commit is contained in:
Martin Stransky 2020-12-02 10:30:29 +00:00
Родитель d9caf57ec9
Коммит b7046a3cea
6 изменённых файлов: 5331 добавлений и 0 удалений

2
media/ffvpx/va/README Normal file
Просмотреть файл

@ -0,0 +1,2 @@
There are libva headers from libva 1.7.0 used to build vaapi support for in-tree ffvpx.
Apply va.patch when you update it to new versions.

4636
media/ffvpx/va/va.h Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

33
media/ffvpx/va/va.patch Normal file
Просмотреть файл

@ -0,0 +1,33 @@
--- va.h.old 2020-10-22 10:41:57.805112031 +0200
+++ va.h 2020-10-22 10:37:22.597088670 +0200
@@ -4613,18 +4613,18 @@
#define VA_PICTURE_HEVC_RPS_LT_CURR 0x00000040
-#include <va/va_dec_hevc.h>
-#include <va/va_dec_jpeg.h>
+//#include <va/va_dec_hevc.h>
+//#include <va/va_dec_jpeg.h>
#include "va_dec_vp8.h"
#include "va_dec_vp9.h"
-#include <va/va_enc_hevc.h>
-#include <va/va_fei_hevc.h>
-#include <va/va_enc_h264.h>
-#include <va/va_enc_jpeg.h>
-#include <va/va_enc_mpeg2.h>
-#include <va/va_enc_vp8.h>
-#include <va/va_enc_vp9.h>
-#include <va/va_fei.h>
-#include <va/va_fei_h264.h>
-#include <va/va_vpp.h>
+//#include <va/va_enc_hevc.h>
+//#include <va/va_fei_hevc.h>
+//#include <va/va_enc_h264.h>
+//#include <va/va_enc_jpeg.h>
+//#include <va/va_enc_mpeg2.h>
+//#include <va/va_enc_vp8.h>
+//#include <va/va_enc_vp9.h>
+//#include <va/va_fei.h>
+//#include <va/va_fei_h264.h>
+//#include <va/va_vpp.h>
/**@}*/

254
media/ffvpx/va/va_dec_vp8.h Normal file
Просмотреть файл

@ -0,0 +1,254 @@
/*
* Copyright (c) 2007-2012 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file va_dec_vp.h
* \brief VP8 decoding API
*
* This file contains the \ref api_dec_vp8 "VP8 decoding API".
*/
#ifndef VA_DEC_VP8_H
#define VA_DEC_VP8_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup api_dec_vp8 VP8 decoding API
*
* @{
*/
/**
* \brief VPX Bool Coder Context structure
*
* This common structure is defined for potential sharing by other VP formats
*
*/
typedef struct _VABoolCoderContextVPX
{
/* partition 0 "range" */
uint8_t range;
/* partition 0 "value" */
uint8_t value;
/*
* 'partition 0 number of shifts before an output byte is available'
* it is the number of remaining bits in 'value' for decoding, range [0, 7].
*/
uint8_t count;
} VABoolCoderContextVPX;
/**
* \brief VP8 Decoding Picture Parameter Buffer Structure
*
* This structure conveys frame level parameters and should be sent once
* per frame.
*
*/
typedef struct _VAPictureParameterBufferVP8
{
/* frame width in pixels */
uint32_t frame_width;
/* frame height in pixels */
uint32_t frame_height;
/* specifies the "last" reference frame */
VASurfaceID last_ref_frame;
/* specifies the "golden" reference frame */
VASurfaceID golden_ref_frame;
/* specifies the "alternate" referrence frame */
VASurfaceID alt_ref_frame;
/* specifies the out-of-loop deblocked frame, not used currently */
VASurfaceID out_of_loop_frame;
union {
struct {
/* same as key_frame in bitstream syntax, 0 means a key frame */
uint32_t key_frame : 1;
/* same as version in bitstream syntax */
uint32_t version : 3;
/* same as segmentation_enabled in bitstream syntax */
uint32_t segmentation_enabled : 1;
/* same as update_mb_segmentation_map in bitstream syntax */
uint32_t update_mb_segmentation_map : 1;
/* same as update_segment_feature_data in bitstream syntax */
uint32_t update_segment_feature_data : 1;
/* same as filter_type in bitstream syntax */
uint32_t filter_type : 1;
/* same as sharpness_level in bitstream syntax */
uint32_t sharpness_level : 3;
/* same as loop_filter_adj_enable in bitstream syntax */
uint32_t loop_filter_adj_enable : 1;
/* same as mode_ref_lf_delta_update in bitstream syntax */
uint32_t mode_ref_lf_delta_update : 1;
/* same as sign_bias_golden in bitstream syntax */
uint32_t sign_bias_golden : 1;
/* same as sign_bias_alternate in bitstream syntax */
uint32_t sign_bias_alternate : 1;
/* same as mb_no_coeff_skip in bitstream syntax */
uint32_t mb_no_coeff_skip : 1;
/* flag to indicate that loop filter should be disabled */
uint32_t loop_filter_disable : 1;
} bits;
uint32_t value;
} pic_fields;
/*
* probabilities of the segment_id decoding tree and same as
* mb_segment_tree_probs in the spec.
*/
uint8_t mb_segment_tree_probs[3];
/* Post-adjustment loop filter levels for the 4 segments */
uint8_t loop_filter_level[4];
/* loop filter deltas for reference frame based MB level adjustment */
int8_t loop_filter_deltas_ref_frame[4];
/* loop filter deltas for coding mode based MB level adjustment */
int8_t loop_filter_deltas_mode[4];
/* same as prob_skip_false in bitstream syntax */
uint8_t prob_skip_false;
/* same as prob_intra in bitstream syntax */
uint8_t prob_intra;
/* same as prob_last in bitstream syntax */
uint8_t prob_last;
/* same as prob_gf in bitstream syntax */
uint8_t prob_gf;
/*
* list of 4 probabilities of the luma intra prediction mode decoding
* tree and same as y_mode_probs in frame header
*/
uint8_t y_mode_probs[4];
/*
* list of 3 probabilities of the chroma intra prediction mode decoding
* tree and same as uv_mode_probs in frame header
*/
uint8_t uv_mode_probs[3];
/*
* updated mv decoding probabilities and same as mv_probs in
* frame header
*/
uint8_t mv_probs[2][19];
VABoolCoderContextVPX bool_coder_ctx;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAPictureParameterBufferVP8;
/**
* \brief VP8 Slice Parameter Buffer Structure
*
* This structure conveys parameters related to data partitions and should be
* sent once per frame. Slice data buffer of VASliceDataBufferType is used
* to send the partition data.
*
*/
typedef struct _VASliceParameterBufferVP8
{
/*
* number of bytes in the slice data buffer for the partitions
*/
uint32_t slice_data_size;
/*
* offset to the first byte of partition data (control partition)
*/
uint32_t slice_data_offset;
/*
* see VA_SLICE_DATA_FLAG_XXX definitions
*/
uint32_t slice_data_flag;
/*
* offset to the first bit of MB from the first byte of partition data(slice_data_offset)
*/
uint32_t macroblock_offset;
/*
* Partitions
* (1<<log2_nbr_of_dct_partitions)+1, count both control partition (frame header) and toke partition
*/
uint8_t num_of_partitions;
/*
* partition_size[0] is remaining bytes of control partition after parsed by application.
* exclude current byte for the remaining bits in bool_coder_ctx.
* exclude the uncompress data chunk since first_part_size 'excluding the uncompressed data chunk'
*/
uint32_t partition_size[9];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VASliceParameterBufferVP8;
/**
* \brief VP8 Coefficient Probability Data Buffer Structure
*
* Contains the contents of the token probability table, which may be
* incrementally modified in the frame header. There are four dimensions to
* the token probability array. The outermost dimension is indexed by the
* type of plane being decoded; the next dimension is selected by the
* position of the coefficient being decoded; the third dimension, * roughly
* speaking, measures the "local complexity" or extent to which nearby
* coefficients are non-zero; the fourth, and final, dimension of the token
* probability array is indexed by the position in the token tree structure,
* as are all tree probability arrays. This structure is sent once per frame.
*
*/
typedef struct _VAProbabilityDataBufferVP8
{
uint8_t dct_coeff_probs[4][8][3][11];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAProbabilityDataBufferVP8;
/**
* \brief VP8 Inverse Quantization Matrix Buffer Structure
*
* Contains quantization indices for yac(0),ydc(1),y2dc(2),y2ac(3),uvdc(4),
* uvac(5) for each segment (0-3). When segmentation is disabled, only
* quantization_index[0][] will be used. This structure is sent once per frame.
*/
typedef struct _VAIQMatrixBufferVP8
{
/*
* array first dimensional is segment and 2nd dimensional is Q index
* all Q indexs should be clipped to be range [0, 127]
*/
uint16_t quantization_index[4][6];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAIQMatrixBufferVP8;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_DEC_VP8_H */

319
media/ffvpx/va/va_dec_vp9.h Normal file
Просмотреть файл

@ -0,0 +1,319 @@
/*
* Copyright (c) 2014 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* \file va_dec_vp9.h
* \brief The VP9 decoding API
*
* This file contains the \ref api_dec_vp9 "VP9 decoding API".
*/
#ifndef VA_DEC_VP9_H
#define VA_DEC_VP9_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup api_dec_vp9 VP9 decoding API
*
* This VP9 decoding API supports 8-bit 420 format only.
*
* @{
*/
/**
* \brief VP9 Decoding Picture Parameter Buffer Structure
*
* This structure conveys picture level parameters.
* App should send a surface with this data structure down to VAAPI once
* per frame.
*
*/
typedef struct _VADecPictureParameterBufferVP9
{
/** \brief picture width
* Picture original resolution. The value may not be multiple of 8.
*/
uint16_t frame_width;
/** \brief picture height
* Picture original resolution. The value may not be multiple of 8.
*/
uint16_t frame_height;
/** \brief Surface indices of reference frames in DPB.
*
* Each entry of the list specifies the surface index of the picture
* that is referred by current picture or will be referred by any future
* picture.
* Application who calls this API should update this list based on the
* refreshing information from VP9 bitstream.
*/
VASurfaceID reference_frames[8];
union
{
struct
{
/** \brief flags for current picture
* same syntax and semantic as those in VP9 code
*/
uint32_t subsampling_x : 1;
uint32_t subsampling_y : 1;
uint32_t frame_type : 1;
uint32_t show_frame : 1;
uint32_t error_resilient_mode : 1;
uint32_t intra_only : 1;
uint32_t allow_high_precision_mv : 1;
uint32_t mcomp_filter_type : 3;
uint32_t frame_parallel_decoding_mode : 1;
uint32_t reset_frame_context : 2;
uint32_t refresh_frame_context : 1;
uint32_t frame_context_idx : 2;
uint32_t segmentation_enabled : 1;
/** \brief corresponds to variable temporal_update in VP9 code.
*/
uint32_t segmentation_temporal_update : 1;
/** \brief corresponds to variable update_mb_segmentation_map
* in VP9 code.
*/
uint32_t segmentation_update_map : 1;
/** \brief Index of reference_frames[] and points to the
* LAST reference frame.
* It corresponds to active_ref_idx[0] in VP9 code.
*/
uint32_t last_ref_frame : 3;
/** \brief Sign Bias of the LAST reference frame.
* It corresponds to ref_frame_sign_bias[LAST_FRAME] in VP9 code.
*/
uint32_t last_ref_frame_sign_bias : 1;
/** \brief Index of reference_frames[] and points to the
* GOLDERN reference frame.
* It corresponds to active_ref_idx[1] in VP9 code.
*/
uint32_t golden_ref_frame : 3;
/** \brief Sign Bias of the GOLDERN reference frame.
* Corresponds to ref_frame_sign_bias[GOLDERN_FRAME] in VP9 code.
*/
uint32_t golden_ref_frame_sign_bias : 1;
/** \brief Index of reference_frames[] and points to the
* ALTERNATE reference frame.
* Corresponds to active_ref_idx[2] in VP9 code.
*/
uint32_t alt_ref_frame : 3;
/** \brief Sign Bias of the ALTERNATE reference frame.
* Corresponds to ref_frame_sign_bias[ALTREF_FRAME] in VP9 code.
*/
uint32_t alt_ref_frame_sign_bias : 1;
/** \brief Lossless Mode
* LosslessFlag = base_qindex == 0 &&
* y_dc_delta_q == 0 &&
* uv_dc_delta_q == 0 &&
* uv_ac_delta_q == 0;
* Where base_qindex, y_dc_delta_q, uv_dc_delta_q and uv_ac_delta_q
* are all variables in VP9 code.
*/
uint32_t lossless_flag : 1;
} bits;
uint32_t value;
} pic_fields;
/* following parameters have same syntax with those in VP9 code */
uint8_t filter_level;
uint8_t sharpness_level;
/** \brief number of tile rows specified by (1 << log2_tile_rows).
* It corresponds the variable with same name in VP9 code.
*/
uint8_t log2_tile_rows;
/** \brief number of tile columns specified by (1 << log2_tile_columns).
* It corresponds the variable with same name in VP9 code.
*/
uint8_t log2_tile_columns;
/** \brief Number of bytes taken up by the uncompressed frame header,
* which corresponds to byte length of function
* read_uncompressed_header() in VP9 code.
* Specifically, it is the byte count from bit stream buffer start to
* the last byte of uncompressed frame header.
* If there are other meta data in the buffer before uncompressed header,
* its size should be also included here.
*/
uint8_t frame_header_length_in_bytes;
/** \brief The byte count of compressed header the bitstream buffer,
* which corresponds to syntax first_partition_size in code.
*/
uint16_t first_partition_size;
/** These values are segment probabilities with same names in VP9
* function setup_segmentation(). They should be parsed directly from
* bitstream by application.
*/
uint8_t mb_segment_tree_probs[7];
uint8_t segment_pred_probs[3];
/** \brief VP9 Profile definition
* value range [0..3].
*/
uint8_t profile;
/** \brief VP9 bit depth per sample
* same for both luma and chroma samples.
*/
uint8_t bit_depth;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_MEDIUM];
} VADecPictureParameterBufferVP9;
/**
* \brief VP9 Segmentation Parameter Data Structure
*
* This structure conveys per segment parameters.
* 8 of this data structure will be included in VASegmentationParameterBufferVP9
* and sent to API in a single buffer.
*
*/
typedef struct _VASegmentParameterVP9
{
union
{
struct
{
/** \brief Indicates if per segment reference frame indicator
* is enabled.
* Corresponding to variable feature_enabled when
* j == SEG_LVL_REF_FRAME in function setup_segmentation() VP9 code.
*/
uint16_t segment_reference_enabled : 1;
/** \brief Specifies per segment reference indication.
* 0: reserved
* 1: Last ref
* 2: golden
* 3: altref
* Value can be derived from variable data when
* j == SEG_LVL_REF_FRAME in function setup_segmentation() VP9 code.
*/
uint16_t segment_reference : 2;
/** \brief Indicates if per segment skip feature is enabled.
* Corresponding to variable feature_enabled when
* j == SEG_LVL_SKIP in function setup_segmentation() VP9 code.
*/
uint16_t segment_reference_skipped : 1;
} fields;
uint16_t value;
} segment_flags;
/** \brief Specifies the filter level information per segment.
* The value corresponds to variable lfi->lvl[seg][ref][mode] in VP9 code,
* where m is [ref], and n is [mode] in FilterLevel[m][n].
*/
uint8_t filter_level[4][2];
/** \brief Specifies per segment Luma AC quantization scale.
* Corresponding to y_dequant[qindex][1] in vp9_mb_init_quantizer()
* function of VP9 code.
*/
int16_t luma_ac_quant_scale;
/** \brief Specifies per segment Luma DC quantization scale.
* Corresponding to y_dequant[qindex][0] in vp9_mb_init_quantizer()
* function of VP9 code.
*/
int16_t luma_dc_quant_scale;
/** \brief Specifies per segment Chroma AC quantization scale.
* Corresponding to uv_dequant[qindex][1] in vp9_mb_init_quantizer()
* function of VP9 code.
*/
int16_t chroma_ac_quant_scale;
/** \brief Specifies per segment Chroma DC quantization scale.
* Corresponding to uv_dequant[qindex][0] in vp9_mb_init_quantizer()
* function of VP9 code.
*/
int16_t chroma_dc_quant_scale;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VASegmentParameterVP9;
/**
* \brief VP9 Slice Parameter Buffer Structure
*
* This structure conveys parameters related to segmentation data and should be
* sent once per frame.
*
* When segmentation is disabled, only SegParam[0] has valid values,
* all other entries should be populated with 0.
* Otherwise, all eight entries should be valid.
*
* Slice data buffer of VASliceDataBufferType is used
* to send the bitstream which should include whole or part of partition 0
* (at least compressed header) to the end of frame.
*
*/
typedef struct _VASliceParameterBufferVP9
{
/** \brief The byte count of current frame in the bitstream buffer,
* starting from first byte of the buffer.
* It uses the name slice_data_size to be consitent with other codec,
* but actually means frame_data_size.
*/
uint32_t slice_data_size;
/**
* offset to the first byte of partition data (control partition)
*/
uint32_t slice_data_offset;
/**
* see VA_SLICE_DATA_FLAG_XXX definitions
*/
uint32_t slice_data_flag;
/**
* \brief per segment information
*/
VASegmentParameterVP9 seg_param[8];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VASliceParameterBufferVP9;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_DEC_VP9_H */

Просмотреть файл

@ -0,0 +1,87 @@
/*
* Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VA_VERSION_H
#define VA_VERSION_H
/**
* VA_MAJOR_VERSION:
*
* The major version of VA-API (1, if %VA_VERSION is 1.2.3)
*/
#define VA_MAJOR_VERSION 1
/**
* VA_MINOR_VERSION:
*
* The minor version of VA-API (2, if %VA_VERSION is 1.2.3)
*/
#define VA_MINOR_VERSION 7
/**
* VA_MICRO_VERSION:
*
* The micro version of VA-API (3, if %VA_VERSION is 1.2.3)
*/
#define VA_MICRO_VERSION 0
/**
* VA_VERSION:
*
* The full version of VA-API, like 1.2.3
*/
#define VA_VERSION 1.7.0
/**
* VA_VERSION_S:
*
* The full version of VA-API, in string form (suited for string
* concatenation)
*/
#define VA_VERSION_S "1.7.0"
/**
* VA_VERSION_HEX:
*
* Numerically encoded version of VA-API, like 0x010203
*/
#define VA_VERSION_HEX ((VA_MAJOR_VERSION << 24) | \
(VA_MINOR_VERSION << 16) | \
(VA_MICRO_VERSION << 8))
/**
* VA_CHECK_VERSION:
* @major: major version, like 1 in 1.2.3
* @minor: minor version, like 2 in 1.2.3
* @micro: micro version, like 3 in 1.2.3
*
* Evaluates to %TRUE if the version of VA-API is greater than
* @major, @minor and @micro
*/
#define VA_CHECK_VERSION(major,minor,micro) \
(VA_MAJOR_VERSION > (major) || \
(VA_MAJOR_VERSION == (major) && VA_MINOR_VERSION > (minor)) || \
(VA_MAJOR_VERSION == (major) && VA_MINOR_VERSION == (minor) && VA_MICRO_VERSION >= (micro)))
#endif /* VA_VERSION_H */