[Libva] [PATCH 3/3] JPEG Encode: Added JPEG Encode feature support for gen8
Matt Turner
mattst88 at gmail.com
Tue Nov 11 16:11:20 PST 2014
On Mon, Nov 10, 2014 at 11:03 PM, Sirisha Muppavarapu
<sirisha.muppavarapu at intel.com> wrote:
> ---
> src/gen6_mfc.h | 3 +
> src/gen8_mfc.c | 873 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
> src/i965_encoder.c | 52 +++-
> 3 files changed, 912 insertions(+), 16 deletions(-)
>
> diff --git a/src/gen6_mfc.h b/src/gen6_mfc.h
> index 67c62a4..31d828f 100644
> --- a/src/gen6_mfc.h
> +++ b/src/gen6_mfc.h
> @@ -190,6 +190,9 @@ struct gen6_mfc_context
> int i_dpb_output_delay_length;
> }vui_hrd;
>
> + //"buffered_QMatrix" will be used to buffer the QMatrix if the app sends one.
> + // Or else, we will load a default QMatrix from the driver for JPEG encode.
> + VAQMatrixBufferJPEG buffered_qmatrix;
> struct i965_gpe_context gpe_context;
> struct i965_buffer_surface mfc_batchbuffer_surface;
> struct intel_batchbuffer *aux_batchbuffer;
> diff --git a/src/gen8_mfc.c b/src/gen8_mfc.c
> index fd7ece1..ca37b06 100644
> --- a/src/gen8_mfc.c
> +++ b/src/gen8_mfc.c
> @@ -42,6 +42,7 @@
> #include "gen6_mfc.h"
> #include "gen6_vme.h"
> #include "intel_media.h"
> +#include <va/va_enc_jpeg.h>
>
> #define SURFACE_STATE_PADDED_SIZE SURFACE_STATE_PADDED_SIZE_GEN8
> #define SURFACE_STATE_OFFSET(index) (SURFACE_STATE_PADDED_SIZE * index)
> @@ -52,6 +53,53 @@
> #define B0_STEP_REV 2
> #define IS_STEPPING_BPLUS(i965) ((i965->intel.revision) >= B0_STEP_REV)
>
> +//Zigzag scan order of the the Luma and Chroma components
> +//Note: Jpeg Spec ISO/IEC 10918-1, Figure A.6 shows the zigzag order differently.
> +//The Spec is trying to show the zigzag pattern with number positions. The below
> +//table will use the pattern shown by A.6 and map the position of the elements in the array
> +static const uint32_t zigzag_direct[64] = {
> + 0, 1, 8, 16, 9, 2, 3, 10,
> + 17, 24, 32, 25, 18, 11, 4, 5,
> + 12, 19, 26, 33, 40, 48, 41, 34,
> + 27, 20, 13, 6, 7, 14, 21, 28,
> + 35, 42, 49, 56, 57, 50, 43, 36,
> + 29, 22, 15, 23, 30, 37, 44, 51,
> + 58, 59, 52, 45, 38, 31, 39, 46,
> + 53, 60, 61, 54, 47, 55, 62, 63
> +};
> +
> +//Default Luminance quantization table
> +//Source: Jpeg Spec ISO/IEC 10918-1, Annex K, Table K.1
> +uint8_t jpeg_luma_quant[64] = {
Presumably you want this table and the following one to be static const?
> + 16, 11, 10, 16, 24, 40, 51, 61,
> + 12, 12, 14, 19, 26, 58, 60, 55,
> + 14, 13, 16, 24, 40, 57, 69, 56,
> + 14, 17, 22, 29, 51, 87, 80, 62,
> + 18, 22, 37, 56, 68, 109, 103, 77,
> + 24, 35, 55, 64, 81, 104, 113, 92,
> + 49, 64, 78, 87, 103, 121, 120, 101,
> + 72, 92, 95, 98, 112, 100, 103, 99
> +};
> +
> +//Default Chroma quantization table
> +//Source: Jpeg Spec ISO/IEC 10918-1, Annex K, Table K.2
> +uint8_t jpeg_chroma_quant[64] = {
> + 17, 18, 24, 47, 99, 99, 99, 99,
> + 18, 21, 26, 66, 99, 99, 99, 99,
> + 24, 26, 56, 99, 99, 99, 99, 99,
> + 47, 66, 99, 99, 99, 99, 99, 99,
> + 99, 99, 99, 99, 99, 99, 99, 99,
> + 99, 99, 99, 99, 99, 99, 99, 99,
> + 99, 99, 99, 99, 99, 99, 99, 99,
> + 99, 99, 99, 99, 99, 99, 99, 99
> +};
More information about the Libva
mailing list