History

avcodec/nvdec: Constify bitstream pointee

Andreas Rheinhardt committed 2 years ago

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

Showing the changes to libavcodec (5 of 5 files). Show all

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
680 ctx->slice_offsets = tmp;680 ctx->slice_offsets = tmp;
681 681
682 if (!ctx->bitstream)682 if (!ctx->bitstream)
683 ctx->bitstream = (uint8_t*)buffer;683 ctx->bitstream = buffer;
684 684
685 ctx->slice_offsets[ctx->nb_slices] = buffer - ctx->bitstream;685 ctx->slice_offsets[ctx->nb_slices] = buffer - ctx->bitstream;
686 ctx->bitstream_len += size;686 ctx->bitstream_len += size;
libavcodec/nvdec.h+1−1
@@ -56,7 +56,7 @@ typedef struct NVDECContext { · 55 unmodified lines
56 56
57 struct NVDECDecoder *decoder; ///< RefStruct reference57 struct NVDECDecoder *decoder; ///< RefStruct reference
58 58
59 uint8_t *bitstream;59 const uint8_t *bitstream;
60 int bitstream_len;60 int bitstream_len;
61 unsigned int bitstream_allocated;61 unsigned int bitstream_allocated;
62 uint8_t *bitstream_internal;62 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
303 303
304 /* Shortcut if all tiles are in the same buffer */304 /* Shortcut if all tiles are in the same buffer */
305 if (ctx->nb_slices == s->tg_end - s->tg_start + 1) {305 if (ctx->nb_slices == s->tg_end - s->tg_start + 1) {
306 ctx->bitstream = (uint8_t*)buffer;306 ctx->bitstream = buffer;
307 ctx->bitstream_len = size;307 ctx->bitstream_len = size;
308 308
309 for (int i = 0; i < ctx->nb_slices; ++i) {309 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
321 }321 }
322 ctx->bitstream = ctx->bitstream_internal = tmp;322 ctx->bitstream = ctx->bitstream_internal = tmp;
323 323
324 memcpy(ctx->bitstream + ctx->bitstream_len, buffer, size);324 memcpy(ctx->bitstream_internal + ctx->bitstream_len, buffer, size);
325 325
326 for (uint32_t tile_num = s->tg_start; tile_num <= s->tg_end; ++tile_num) {326 for (uint32_t tile_num = s->tg_start; tile_num <= s->tg_end; ++tile_num) {
327 ctx->slice_offsets[tile_num*2 ] = ctx->bitstream_len + s->tile_group_info[tile_num].tile_offset;327 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
150 return AVERROR(ENOMEM);150 return AVERROR(ENOMEM);
151 ctx->slice_offsets = tmp;151 ctx->slice_offsets = tmp;
152 152
153 AV_WB24(ctx->bitstream + ctx->bitstream_len, 1);153 AV_WB24(ctx->bitstream_internal + ctx->bitstream_len, 1);
154 memcpy(ctx->bitstream + ctx->bitstream_len + 3, buffer, size);154 memcpy(ctx->bitstream_internal + ctx->bitstream_len + 3, buffer, size);
155 ctx->slice_offsets[ctx->nb_slices] = ctx->bitstream_len ;155 ctx->slice_offsets[ctx->nb_slices] = ctx->bitstream_len ;
156 ctx->bitstream_len += size + 3;156 ctx->bitstream_len += size + 3;
157 ctx->nb_slices++;157 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
286 return AVERROR(ENOMEM);286 return AVERROR(ENOMEM);
287 ctx->slice_offsets = tmp;287 ctx->slice_offsets = tmp;
288 288
289 AV_WB24(ctx->bitstream + ctx->bitstream_len, 1);289 AV_WB24(ctx->bitstream_internal + ctx->bitstream_len, 1);
290 memcpy(ctx->bitstream + ctx->bitstream_len + 3, buffer, size);290 memcpy(ctx->bitstream_internal + ctx->bitstream_len + 3, buffer, size);
291 ctx->slice_offsets[ctx->nb_slices] = ctx->bitstream_len ;291 ctx->slice_offsets[ctx->nb_slices] = ctx->bitstream_len ;
292 ctx->bitstream_len += size + 3;292 ctx->bitstream_len += size + 3;
293 ctx->nb_slices++;293 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