Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JPEG decoding of an oddly encoded files on gen7/8 #530

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/gen75_mfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2844,7 +2844,7 @@ gen75_mfd_jpeg_qm_state(VADriverContextP ctx,
assert(pic_param->num_components <= 3);

for (index = 0; index < pic_param->num_components; index++) {
int id = pic_param->components[index].component_id - pic_param->components[0].component_id + 1;
unsigned char id = pic_param->components[index].component_id - pic_param->components[0].component_id + 1;
int qm_type;
unsigned char *qm = iq_matrix->quantiser_table[pic_param->components[index].quantiser_table_selector];
unsigned char raster_qm[64];
Expand Down Expand Up @@ -2875,14 +2875,16 @@ gen75_mfd_jpeg_bsd_object(VADriverContextP ctx,
{
struct intel_batchbuffer *batch = gen7_mfd_context->base.batch;
int scan_component_mask = 0;
unsigned char id;
int i;

assert(slice_param->num_components > 0);
assert(slice_param->num_components < 4);
assert(slice_param->num_components <= pic_param->num_components);

for (i = 0; i < slice_param->num_components; i++) {
switch (slice_param->components[i].component_selector - pic_param->components[0].component_id + 1) {
id = slice_param->components[i].component_selector - pic_param->components[0].component_id + 1;
switch (id) {
case 1:
scan_component_mask |= (1 << 0);
break;
Expand Down
6 changes: 4 additions & 2 deletions src/gen7_mfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2497,7 +2497,7 @@ gen7_mfd_jpeg_qm_state(VADriverContextP ctx,
assert(pic_param->num_components <= 3);

for (index = 0; index < pic_param->num_components; index++) {
int id = pic_param->components[index].component_id - pic_param->components[0].component_id + 1;
unsigned char id = pic_param->components[index].component_id - pic_param->components[0].component_id + 1;
int qm_type;
unsigned char *qm = iq_matrix->quantiser_table[pic_param->components[index].quantiser_table_selector];
unsigned char raster_qm[64];
Expand Down Expand Up @@ -2528,14 +2528,16 @@ gen7_mfd_jpeg_bsd_object(VADriverContextP ctx,
{
struct intel_batchbuffer *batch = gen7_mfd_context->base.batch;
int scan_component_mask = 0;
unsigned char id;
int i;

assert(slice_param->num_components > 0);
assert(slice_param->num_components < 4);
assert(slice_param->num_components <= pic_param->num_components);

for (i = 0; i < slice_param->num_components; i++) {
switch (slice_param->components[i].component_selector - pic_param->components[0].component_id + 1) {
id = slice_param->components[i].component_selector - pic_param->components[0].component_id + 1;
switch (id) {
case 1:
scan_component_mask |= (1 << 0);
break;
Expand Down
6 changes: 4 additions & 2 deletions src/gen8_mfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2550,7 +2550,7 @@ gen8_mfd_jpeg_qm_state(VADriverContextP ctx,
assert(pic_param->num_components <= 3);

for (index = 0; index < pic_param->num_components; index++) {
int id = pic_param->components[index].component_id - pic_param->components[0].component_id + 1;
unsigned char id = pic_param->components[index].component_id - pic_param->components[0].component_id + 1;
int qm_type;
unsigned char *qm = iq_matrix->quantiser_table[pic_param->components[index].quantiser_table_selector];
unsigned char raster_qm[64];
Expand Down Expand Up @@ -2581,14 +2581,16 @@ gen8_mfd_jpeg_bsd_object(VADriverContextP ctx,
{
struct intel_batchbuffer *batch = gen7_mfd_context->base.batch;
int scan_component_mask = 0;
unsigned char id;
int i;

assert(slice_param->num_components > 0);
assert(slice_param->num_components < 4);
assert(slice_param->num_components <= pic_param->num_components);

for (i = 0; i < slice_param->num_components; i++) {
switch (slice_param->components[i].component_selector - pic_param->components[0].component_id + 1) {
id = slice_param->components[i].component_selector - pic_param->components[0].component_id + 1;
switch (id) {
case 1:
scan_component_mask |= (1 << 0);
break;
Expand Down