summaryrefslogtreecommitdiff
path: root/libavcodec/dnxhddec.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-01-22 22:47:27 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-01-26 13:56:59 +0100
commit10d059bb24eb88157e071a3db102ddd8f4937a00 (patch)
tree4e7e64f3cb8c97c7b96bec39fecdc30b2f155dfe /libavcodec/dnxhddec.c
parent37f76c81d6669033c315354a7d30ef6e605414ae (diff)
avcodec/dnxhd: Make ff_dxnhd_get_cid_table return a pointer, not index
All callers only use the index into ff_dnxhd_cid_table to get a pointer to the desired entry. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/dnxhddec.c')
-rw-r--r--libavcodec/dnxhddec.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 09bc6f9b59..c78d55aee5 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -113,18 +113,19 @@ static av_cold int dnxhd_decode_init(AVCodecContext *avctx)
static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, int bitdepth)
{
if (cid != ctx->cid) {
- int index;
+ const CIDEntry *cid_table = ff_dnxhd_get_cid_table(cid);
- if ((index = ff_dnxhd_get_cid_table(cid)) < 0) {
+ if (!cid_table) {
av_log(ctx->avctx, AV_LOG_ERROR, "unsupported cid %"PRIu32"\n", cid);
return AVERROR(ENOSYS);
}
- if (ff_dnxhd_cid_table[index].bit_depth != bitdepth &&
- ff_dnxhd_cid_table[index].bit_depth != DNXHD_VARIABLE) {
- av_log(ctx->avctx, AV_LOG_ERROR, "bit depth mismatches %d %d\n", ff_dnxhd_cid_table[index].bit_depth, bitdepth);
+ if (cid_table->bit_depth != bitdepth &&
+ cid_table->bit_depth != DNXHD_VARIABLE) {
+ av_log(ctx->avctx, AV_LOG_ERROR, "bit depth mismatches %d %d\n",
+ cid_table->bit_depth, bitdepth);
return AVERROR_INVALIDDATA;
}
- ctx->cid_table = &ff_dnxhd_cid_table[index];
+ ctx->cid_table = cid_table;
av_log(ctx->avctx, AV_LOG_VERBOSE, "Profile cid %"PRIu32".\n", cid);
ff_free_vlc(&ctx->ac_vlc);