jpeg: update to the latest VA-API changes (0.32.1+).
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Tue, 31 Jul 2012 09:51:57 +0000 (11:51 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Tue, 31 Jul 2012 09:51:57 +0000 (11:51 +0200)
configure.ac
gst-libs/gst/vaapi/gstvaapicodec_objects.h
gst-libs/gst/vaapi/gstvaapicompat.h
gst-libs/gst/vaapi/gstvaapidecoder_jpeg.c

index f6b07d5..ebcf69b 100644 (file)
@@ -380,7 +380,7 @@ if test $USE_GLX -eq 1; then
 fi
 AC_SUBST(LIBVA_GLX_PKGNAME)
 
-dnl Check for JPEG decoding API (0.33+)
+dnl Check for JPEG decoding API (0.32.1+)
 USE_JPEG_DECODER=0
 AC_CACHE_CHECK([for JPEG decoding API],
     ac_cv_have_jpeg_decoding_api, [
@@ -390,12 +390,11 @@ AC_CACHE_CHECK([for JPEG decoding API],
     LIBS="$CFLAGS $LIBVA_LIBS"
     AC_COMPILE_IFELSE(
         [AC_LANG_PROGRAM(
-            [[#include <va/va.h>
-              #include <va/va_dec_jpeg.h>]],
-            [[VAPictureParameterBufferJPEG pic_param;
-              VASliceParameterBufferJPEG slice_param;
-              VAHuffmanTableBufferJPEG huffman_table;
-              VAIQMatrixBufferJPEG iq_matrix;]])],
+            [[#include <va/va.h>]],
+            [[VAPictureParameterBufferJPEGBaseline pic_param;
+              VASliceParameterBufferJPEGBaseline slice_param;
+              VAHuffmanTableBufferJPEGBaseline huffman_table;
+              VAIQMatrixBufferJPEGBaseline iq_matrix;]])],
         [ac_cv_have_jpeg_decoding_api="yes" USE_JPEG_DECODER=1],
         [ac_cv_have_jpeg_decoding_api="no"]
     )
index c70f34f..a064c15 100644 (file)
@@ -390,9 +390,9 @@ prefix##_class_init(type##Class *klass)                                 \
 
 #define GST_VAAPI_BITPLANE_NEW(decoder, size) \
     gst_vaapi_bitplane_new(GST_VAAPI_DECODER_CAST(decoder), NULL, size)
-    
-#define GST_VAAPI_HUFFMAN_TABLE_NEW(codec, decoder)              \
-      gst_vaapi_huffman_table_new(GST_VAAPI_DECODER_CAST(decoder),    \
+
+#define GST_VAAPI_HUFFMAN_TABLE_NEW(codec, decoder)                     \
+      gst_vaapi_huffman_table_new(GST_VAAPI_DECODER_CAST(decoder),      \
                             NULL, sizeof(VAHuffmanTableBuffer##codec))
 
 G_END_DECLS
index 47cd7a3..4a1f93d 100644 (file)
@@ -49,7 +49,6 @@
 /* Compatibility glue with VA-API 0.34 */
 #if VA_CHECK_VERSION(0,34,0)
 # include <va/va_compat.h>
-# include <va/va_dec_jpeg.h>
 #endif
 
 #endif /* GST_VAAPI_COMPAT_H */
index ac19b3d..5cfbe4d 100644 (file)
@@ -173,18 +173,15 @@ fill_picture(
     GstJpegFrameHdr     *jpeg_frame_hdr
 )
 {
-    VAPictureParameterBufferJPEG *pic_param = picture->param;
+    VAPictureParameterBufferJPEGBaseline *pic_param = picture->param;
     guint i;
 
     g_assert(pic_param);
 
-    memset(pic_param, 0, sizeof(VAPictureParameterBufferJPEG));
-    pic_param->sample_precision = jpeg_frame_hdr->sample_precision;
+    memset(pic_param, 0, sizeof(VAPictureParameterBufferJPEGBaseline));
     pic_param->picture_width    = jpeg_frame_hdr->width;
     pic_param->picture_height   = jpeg_frame_hdr->height;
 
-    /* XXX: ROI + rotation */
-
     pic_param->num_components   = jpeg_frame_hdr->num_components;
     if (jpeg_frame_hdr->num_components > 4)
         return FALSE;
@@ -208,13 +205,13 @@ fill_quantization_table(
 )
 {
     GstVaapiDecoderJpegPrivate * const priv = decoder->priv;
-    VAIQMatrixBufferJPEG *iq_matrix;
+    VAIQMatrixBufferJPEGBaseline *iq_matrix;
     guint i, j, num_tables;
 
     if (!priv->has_quant_table)
         gst_jpeg_get_default_quantization_tables(&priv->quant_tables);
     
-    picture->iq_matrix = GST_VAAPI_IQ_MATRIX_NEW(JPEG, decoder);
+    picture->iq_matrix = GST_VAAPI_IQ_MATRIX_NEW(JPEGBaseline, decoder);
     g_assert(picture->iq_matrix);
     iq_matrix = picture->iq_matrix->param;
 
@@ -246,13 +243,13 @@ fill_huffman_table(
 {
     GstVaapiDecoderJpegPrivate * const priv = decoder->priv;
     GstJpegHuffmanTables * const huf_tables = &priv->huf_tables;
-    VAHuffmanTableBufferJPEG *huffman_table;
+    VAHuffmanTableBufferJPEGBaseline *huffman_table;
     guint i, num_tables;
 
     if (!priv->has_huf_table)
         gst_jpeg_get_default_huffman_tables(&priv->huf_tables);
     
-    picture->huf_table = GST_VAAPI_HUFFMAN_TABLE_NEW(JPEG, decoder);
+    picture->huf_table = GST_VAAPI_HUFFMAN_TABLE_NEW(JPEGBaseline, decoder);
     g_assert(picture->huf_table);
     huffman_table = picture->huf_table->param;
 
@@ -277,6 +274,9 @@ fill_huffman_table(
         memcpy(huffman_table->huffman_table[i].ac_values,
                huf_tables->ac_tables[i].huf_values,
                sizeof(huffman_table->huffman_table[i].ac_values));
+        memset(huffman_table->huffman_table[i].pad,
+               0,
+               sizeof(huffman_table->huffman_table[i].pad));
     }
     return TRUE;
 }
@@ -345,7 +345,7 @@ decode_picture(
     if (priv->current_picture && !decode_current_picture(decoder))
         return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
 
-    picture = GST_VAAPI_PICTURE_NEW(JPEG, decoder);
+    picture = GST_VAAPI_PICTURE_NEW(JPEGBaseline, decoder);
     if (!picture) {
         GST_ERROR("failed to allocate picture");
         return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
@@ -421,7 +421,7 @@ decode_scan(
 {
     GstVaapiDecoderJpegPrivate * const priv = decoder->priv;
     GstVaapiPicture *picture = priv->current_picture;
-    VASliceParameterBufferJPEG *slice_param;
+    VASliceParameterBufferJPEGBaseline *slice_param;
     GstVaapiSlice *gst_slice;
     guint total_h_samples, total_v_samples;
     GstJpegScanHdr  scan_hdr;
@@ -448,7 +448,7 @@ decode_scan(
         return GST_VAAPI_DECODER_STATUS_ERROR_BITSTREAM_PARSER;
     }
 
-    gst_slice = GST_VAAPI_SLICE_NEW(JPEG, decoder, scan_data, scan_data_size);
+    gst_slice = GST_VAAPI_SLICE_NEW(JPEGBaseline, decoder, scan_data, scan_data_size);
     gst_vaapi_picture_add_slice(picture, gst_slice);
 
     slice_param = gst_slice->param;