提交 819f3ea5 编写于 作者: M Mirela Rabulea 提交者: Mauro Carvalho Chehab

media: Avoid parsing quantization and huffman tables

These are optional in struct v4l2_jpeg_header, so skip DHT/DQT segment
parsing if huffman_tables/quantization_tables were not requested by user,
to save time.
However, do count them (num_dht/num_dqt).
Signed-off-by: NMirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: NPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
上级 ccbea178
...@@ -537,6 +537,10 @@ int v4l2_jpeg_parse_header(void *buf, size_t len, struct v4l2_jpeg_header *out) ...@@ -537,6 +537,10 @@ int v4l2_jpeg_parse_header(void *buf, size_t len, struct v4l2_jpeg_header *out)
&out->dht[out->num_dht++ % 4]); &out->dht[out->num_dht++ % 4]);
if (ret < 0) if (ret < 0)
return ret; return ret;
if (!out->huffman_tables) {
ret = jpeg_skip_segment(&stream);
break;
}
ret = jpeg_parse_huffman_tables(&stream, ret = jpeg_parse_huffman_tables(&stream,
out->huffman_tables); out->huffman_tables);
break; break;
...@@ -545,6 +549,10 @@ int v4l2_jpeg_parse_header(void *buf, size_t len, struct v4l2_jpeg_header *out) ...@@ -545,6 +549,10 @@ int v4l2_jpeg_parse_header(void *buf, size_t len, struct v4l2_jpeg_header *out)
&out->dqt[out->num_dqt++ % 4]); &out->dqt[out->num_dqt++ % 4]);
if (ret < 0) if (ret < 0)
return ret; return ret;
if (!out->quantization_tables) {
ret = jpeg_skip_segment(&stream);
break;
}
ret = jpeg_parse_quantization_tables(&stream, ret = jpeg_parse_quantization_tables(&stream,
out->frame.precision, out->frame.precision,
out->quantization_tables); out->quantization_tables);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册