-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
media: hantro: Avoid global variable for jpeg quantization tables
On a system with multiple encoders present, it's possible for two encoders to write to the global luma and chroma quantization tables at the same time if they both submit a JPEG frame to be encoded. Avoid this race by moving the tables into the `jpeg_ctx` structure which is stored on the stack. Signed-off-by: James Cowgill <james.cowgill@blaize.com> Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
- Loading branch information
James Cowgill
authored and
Mauro Carvalho Chehab
committed
Nov 30, 2021
1 parent
615c6f2
commit 41479ad
Showing
4 changed files
with
16 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
/* SPDX-License-Identifier: GPL-2.0+ */ | ||
|
||
#define JPEG_HEADER_SIZE 601 | ||
#define JPEG_QUANT_SIZE 64 | ||
|
||
struct hantro_jpeg_ctx { | ||
int width; | ||
int height; | ||
int quality; | ||
unsigned char *buffer; | ||
unsigned char hw_luma_qtable[JPEG_QUANT_SIZE]; | ||
unsigned char hw_chroma_qtable[JPEG_QUANT_SIZE]; | ||
}; | ||
|
||
unsigned char *hantro_jpeg_get_qtable(int index); | ||
void hantro_jpeg_header_assemble(struct hantro_jpeg_ctx *ctx); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters