Map JPEG component id to Y, Cb, Cr
authorXiang, Haihao <haihao.xiang@intel.com>
Thu, 19 Jan 2012 01:00:48 +0000 (09:00 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Thu, 19 Jan 2012 01:00:48 +0000 (09:00 +0800)
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
src/gen7_mfd.c

index 09c327f..a50d04e 100644 (file)
@@ -2204,14 +2204,12 @@ gen7_mfd_jpeg_qm_state(VADriverContextP ctx,
     assert(pic_param->num_components <= 3);
 
     for (index = 0; index < pic_param->num_components; index++) {
-        int qm_type = va_to_gen7_jpeg_qm[pic_param->components[index].component_id];
+        int qm_type = va_to_gen7_jpeg_qm[pic_param->components[index].component_id - pic_param->components[0].component_id + VA_JPEG_COMPONENT_ID_Y];
         unsigned char *qm = iq_matrix->quantiser_matrix[pic_param->components[index].quantiser_table_selector];
         int precision = iq_matrix->precision[pic_param->components[index].quantiser_table_selector];
         unsigned char raster_qm[64];
         int j;
 
-        assert(pic_param->components[index].component_id >= VA_JPEG_COMPONENT_ID_Y &&
-               pic_param->components[index].component_id <= VA_JPEG_COMPONENT_ID_A);
         assert(precision == 0);
 
         for (j = 0; j < 64; j++)
@@ -2238,7 +2236,7 @@ gen7_mfd_jpeg_bsd_object(VADriverContextP ctx,
     assert(slice_param->num_components <= pic_param->num_components);
 
     for (i = 0; i < slice_param->num_components; i++) {
-        switch (slice_param->components[i].component_id) {
+        switch (slice_param->components[i].component_id - pic_param->components[0].component_id + VA_JPEG_COMPONENT_ID_Y) {
         case VA_JPEG_COMPONENT_ID_Y:
             scan_component_mask |= (1 << 0);
             break;