History

avcodec/nvdec: Constify bitstream pointee

Andreas Rheinhardt committed 2 years ago

Commit 9ae40f21 parent cd31eac5 files · +8 −8Browse files

Unified · Split

5 files
  1. libavcodec/nvdec.c +1 −1
  2. libavcodec/nvdec.h +1 −1
  3. libavcodec/nvdec_av1.c +2 −2
  4. libavcodec/nvdec_h264.c +2 −2
  5. libavcodec/nvdec_hevc.c +2 −2
libavcodec/nvdec.c+1−1
@@ -680,7 +680,7 @@ int ff_nvdec_simple_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, · 679 unmodified lines
680680 ctx->slice_offsets = tmp;
681681
682682 if (!ctx->bitstream)
683− ctx->bitstream = (uint8_t*)buffer;
683+ ctx->bitstream = buffer;
684684
685685 ctx->slice_offsets[ctx->nb_slices] = buffer - ctx->bitstream;
686686 ctx->bitstream_len += size;
libavcodec/nvdec.h+1−1
@@ -56,7 +56,7 @@ typedef struct NVDECContext { · 55 unmodified lines
5656
5757 struct NVDECDecoder *decoder; ///< RefStruct reference
5858
59− uint8_t *bitstream;
59+ const uint8_t *bitstream;
6060 int bitstream_len;
6161 unsigned int bitstream_allocated;
6262 uint8_t *bitstream_internal;
libavcodec/nvdec_av1.c+2−2
@@ -303,7 +303,7 @@ static int nvdec_av1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, · 302 unmodified lines
303303
304304 /* Shortcut if all tiles are in the same buffer */
305305 if (ctx->nb_slices == s->tg_end - s->tg_start + 1) {
306− ctx->bitstream = (uint8_t*)buffer;
306+ ctx->bitstream = buffer;
307307 ctx->bitstream_len = size;
308308
309309 for (int i = 0; i < ctx->nb_slices; ++i) {
@@ -321,7 +321,7 @@ static int nvdec_av1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, · 11 unmodified lines
321321 }
322322 ctx->bitstream = ctx->bitstream_internal = tmp;
323323
324− memcpy(ctx->bitstream + ctx->bitstream_len, buffer, size);
324+ memcpy(ctx->bitstream_internal + ctx->bitstream_len, buffer, size);
325325
326326 for (uint32_t tile_num = s->tg_start; tile_num <= s->tg_end; ++tile_num) {
327327 ctx->slice_offsets[tile_num*2 ] = ctx->bitstream_len + s->tile_group_info[tile_num].tile_offset;
libavcodec/nvdec_h264.c+2−2
@@ -150,8 +150,8 @@ static int nvdec_h264_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, · 149 unmodified lines
150150 return AVERROR(ENOMEM);
151151 ctx->slice_offsets = tmp;
152152
153− AV_WB24(ctx->bitstream + ctx->bitstream_len, 1);
154− memcpy(ctx->bitstream + ctx->bitstream_len + 3, buffer, size);
153+ AV_WB24(ctx->bitstream_internal + ctx->bitstream_len, 1);
154+ memcpy(ctx->bitstream_internal + ctx->bitstream_len + 3, buffer, size);
155155 ctx->slice_offsets[ctx->nb_slices] = ctx->bitstream_len ;
156156 ctx->bitstream_len += size + 3;
157157 ctx->nb_slices++;
libavcodec/nvdec_hevc.c+2−2
@@ -286,8 +286,8 @@ static int nvdec_hevc_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, · 285 unmodified lines
286286 return AVERROR(ENOMEM);
287287 ctx->slice_offsets = tmp;
288288
289− AV_WB24(ctx->bitstream + ctx->bitstream_len, 1);
290− memcpy(ctx->bitstream + ctx->bitstream_len + 3, buffer, size);
289+ AV_WB24(ctx->bitstream_internal + ctx->bitstream_len, 1);
290+ memcpy(ctx->bitstream_internal + ctx->bitstream_len + 3, buffer, size);
291291 ctx->slice_offsets[ctx->nb_slices] = ctx->bitstream_len ;
292292 ctx->bitstream_len += size + 3;
293293 ctx->nb_slices++;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t