Browse code

Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'

* commit '059a934806d61f7af9ab3fd9f74994b838ea5eba':
lavc: Consistently prefix input buffer defines

Conflicts:
doc/examples/decoding_encoding.c
libavcodec/4xm.c
libavcodec/aac_adtstoasc_bsf.c
libavcodec/aacdec.c
libavcodec/aacenc.c
libavcodec/ac3dec.h
libavcodec/asvenc.c
libavcodec/avcodec.h
libavcodec/avpacket.c
libavcodec/dvdec.c
libavcodec/ffv1enc.c
libavcodec/g2meet.c
libavcodec/gif.c
libavcodec/h264.c
libavcodec/h264_mp4toannexb_bsf.c
libavcodec/huffyuvdec.c
libavcodec/huffyuvenc.c
libavcodec/jpeglsenc.c
libavcodec/libxvid.c
libavcodec/mdec.c
libavcodec/motionpixels.c
libavcodec/mpeg4videodec.c
libavcodec/mpegvideo.c
libavcodec/noise_bsf.c
libavcodec/nuv.c
libavcodec/nvenc.c
libavcodec/options.c
libavcodec/parser.c
libavcodec/pngenc.c
libavcodec/proresenc_kostya.c
libavcodec/qsvdec.c
libavcodec/svq1enc.c
libavcodec/tiffenc.c
libavcodec/truemotion2.c
libavcodec/utils.c
libavcodec/utvideoenc.c
libavcodec/vc1dec.c
libavcodec/wmalosslessdec.c
libavformat/adxdec.c
libavformat/aiffdec.c
libavformat/apc.c
libavformat/apetag.c
libavformat/avidec.c
libavformat/bink.c
libavformat/cafdec.c
libavformat/flvdec.c
libavformat/id3v2.c
libavformat/isom.c
libavformat/matroskadec.c
libavformat/mov.c
libavformat/mpc.c
libavformat/mpc8.c
libavformat/mpegts.c
libavformat/mvi.c
libavformat/mxfdec.c
libavformat/mxg.c
libavformat/nutdec.c
libavformat/oggdec.c
libavformat/oggparsecelt.c
libavformat/oggparseflac.c
libavformat/oggparseopus.c
libavformat/oggparsespeex.c
libavformat/omadec.c
libavformat/rawdec.c
libavformat/riffdec.c
libavformat/rl2.c
libavformat/rmdec.c
libavformat/rtpdec_latm.c
libavformat/rtpdec_mpeg4.c
libavformat/rtpdec_qdm2.c
libavformat/rtpdec_svq3.c
libavformat/sierravmd.c
libavformat/smacker.c
libavformat/smush.c
libavformat/spdifenc.c
libavformat/takdec.c
libavformat/tta.c
libavformat/utils.c
libavformat/vqf.c
libavformat/westwood_vqa.c
libavformat/xmv.c
libavformat/xwma.c
libavformat/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>

Michael Niedermayer authored on 2015/07/28 05:53:16
Showing 153 changed files
... ...
@@ -245,7 +245,7 @@ static void audio_decode_example(const char *outfilename, const char *filename)
245 245
     AVCodecContext *c= NULL;
246 246
     int len;
247 247
     FILE *f, *outfile;
248
-    uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
248
+    uint8_t inbuf[AUDIO_INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
249 249
     AVPacket avpkt;
250 250
     AVFrame *decoded_frame = NULL;
251 251
 
... ...
@@ -538,13 +538,13 @@ static void video_decode_example(const char *outfilename, const char *filename)
538 538
     int frame_count;
539 539
     FILE *f;
540 540
     AVFrame *frame;
541
-    uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
541
+    uint8_t inbuf[INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
542 542
     AVPacket avpkt;
543 543
 
544 544
     av_init_packet(&avpkt);
545 545
 
546 546
     /* set end of buffer to 0 (this ensures that no overreading happens for damaged mpeg streams) */
547
-    memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE);
547
+    memset(inbuf + INBUF_SIZE, 0, AV_INPUT_BUFFER_PADDING_SIZE);
548 548
 
549 549
     printf("Decode video file %s to %s\n", filename, outfilename);
550 550
 
... ...
@@ -405,7 +405,7 @@ int main(int argc, char **argv)
405 405
     decoder_ctx->codec_id = AV_CODEC_ID_H264;
406 406
     if (video_st->codec->extradata_size) {
407 407
         decoder_ctx->extradata = av_mallocz(video_st->codec->extradata_size +
408
-                                            FF_INPUT_BUFFER_PADDING_SIZE);
408
+                                            AV_INPUT_BUFFER_PADDING_SIZE);
409 409
         if (!decoder_ctx->extradata) {
410 410
             ret = AVERROR(ENOMEM);
411 411
             goto finish;
... ...
@@ -643,7 +643,7 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
643 643
     int ret;
644 644
 
645 645
     if (!ost->st->codec->extradata_size && ost->enc_ctx->extradata_size) {
646
-        ost->st->codec->extradata = av_mallocz(ost->enc_ctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
646
+        ost->st->codec->extradata = av_mallocz(ost->enc_ctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
647 647
         if (ost->st->codec->extradata) {
648 648
             memcpy(ost->st->codec->extradata, ost->enc_ctx->extradata, ost->enc_ctx->extradata_size);
649 649
             ost->st->codec->extradata_size = ost->enc_ctx->extradata_size;
... ...
@@ -688,10 +688,10 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
688 688
                                            pkt->data, pkt->size,
689 689
                                            pkt->flags & AV_PKT_FLAG_KEY);
690 690
         if(a == 0 && new_pkt.data != pkt->data && new_pkt.destruct) {
691
-            uint8_t *t = av_malloc(new_pkt.size + FF_INPUT_BUFFER_PADDING_SIZE); //the new should be a subset of the old so cannot overflow
691
+            uint8_t *t = av_malloc(new_pkt.size + AV_INPUT_BUFFER_PADDING_SIZE); //the new should be a subset of the old so cannot overflow
692 692
             if(t) {
693 693
                 memcpy(t, new_pkt.data, new_pkt.size);
694
-                memset(t + new_pkt.size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
694
+                memset(t + new_pkt.size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
695 695
                 new_pkt.data = t;
696 696
                 new_pkt.buf = NULL;
697 697
                 a = 1;
... ...
@@ -2811,7 +2811,7 @@ static int transcode_init(void)
2811 2811
 
2812 2812
             av_assert0(ist && !ost->filter);
2813 2813
 
2814
-            extra_size = (uint64_t)dec_ctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE;
2814
+            extra_size = (uint64_t)dec_ctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE;
2815 2815
 
2816 2816
             if (extra_size > INT_MAX) {
2817 2817
                 return AVERROR(EINVAL);
... ...
@@ -3510,7 +3510,7 @@ static void extract_mpeg4_header(AVFormatContext *infile)
3510 3510
                 if (p[0] == 0x00 && p[1] == 0x00 &&
3511 3511
                     p[2] == 0x01 && p[3] == 0xb6) {
3512 3512
                     size = p - pkt.data;
3513
-                    st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
3513
+                    st->codec->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
3514 3514
                     st->codec->extradata_size = size;
3515 3515
                     memcpy(st->codec->extradata, pkt.data, size);
3516 3516
                     break;
... ...
@@ -883,11 +883,11 @@ static int decode_frame(AVCodecContext *avctx, void *data,
883 883
         }
884 884
         cfrm = &f->cfrm[i];
885 885
 
886
-        if (data_size > UINT_MAX -  cfrm->size - FF_INPUT_BUFFER_PADDING_SIZE)
886
+        if (data_size > UINT_MAX -  cfrm->size - AV_INPUT_BUFFER_PADDING_SIZE)
887 887
             return AVERROR_INVALIDDATA;
888 888
 
889 889
         cfrm->data = av_fast_realloc(cfrm->data, &cfrm->allocated_size,
890
-                                     cfrm->size + data_size + FF_INPUT_BUFFER_PADDING_SIZE);
890
+                                     cfrm->size + data_size + AV_INPUT_BUFFER_PADDING_SIZE);
891 891
         // explicit check needed as memcpy below might not catch a NULL
892 892
         if (!cfrm->data) {
893 893
             av_log(f->avctx, AV_LOG_ERROR, "realloc failure\n");
... ...
@@ -235,7 +235,7 @@ static av_cold int a64multi_encode_init(AVCodecContext *avctx)
235 235
     }
236 236
 
237 237
     /* set up extradata */
238
-    if (!(avctx->extradata = av_mallocz(8 * 4 + FF_INPUT_BUFFER_PADDING_SIZE))) {
238
+    if (!(avctx->extradata = av_mallocz(8 * 4 + AV_INPUT_BUFFER_PADDING_SIZE))) {
239 239
         av_log(avctx, AV_LOG_ERROR, "Failed to allocate memory for extradata.\n");
240 240
         return AVERROR(ENOMEM);
241 241
     }
... ...
@@ -89,7 +89,7 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc,
89 89
         }
90 90
         av_free(avctx->extradata);
91 91
         avctx->extradata_size = 2 + pce_size;
92
-        avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
92
+        avctx->extradata = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
93 93
         if (!avctx->extradata) {
94 94
             avctx->extradata_size = 0;
95 95
             return AVERROR(ENOMEM);
... ...
@@ -34,7 +34,7 @@ static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info,
34 34
     int size;
35 35
     union {
36 36
         uint64_t u64;
37
-        uint8_t  u8[8 + FF_INPUT_BUFFER_PADDING_SIZE];
37
+        uint8_t  u8[8 + AV_INPUT_BUFFER_PADDING_SIZE];
38 38
     } tmp;
39 39
 
40 40
     tmp.u64 = av_be2ne64(state);
... ...
@@ -322,14 +322,14 @@ static int latm_decode_audio_specific_config(struct LATMContext *latmctx,
322 322
 
323 323
         if (avctx->extradata_size < esize) {
324 324
             av_free(avctx->extradata);
325
-            avctx->extradata = av_malloc(esize + FF_INPUT_BUFFER_PADDING_SIZE);
325
+            avctx->extradata = av_malloc(esize + AV_INPUT_BUFFER_PADDING_SIZE);
326 326
             if (!avctx->extradata)
327 327
                 return AVERROR(ENOMEM);
328 328
         }
329 329
 
330 330
         avctx->extradata_size = esize;
331 331
         memcpy(avctx->extradata, gb->buffer + (config_start_bit/8), esize);
332
-        memset(avctx->extradata+esize, 0, FF_INPUT_BUFFER_PADDING_SIZE);
332
+        memset(avctx->extradata+esize, 0, AV_INPUT_BUFFER_PADDING_SIZE);
333 333
     }
334 334
     skip_bits_long(gb, bits_consumed);
335 335
 
... ...
@@ -3098,7 +3098,7 @@ static int aac_decode_frame(AVCodecContext *avctx, void *data,
3098 3098
     if (new_extradata && 0) {
3099 3099
         av_free(avctx->extradata);
3100 3100
         avctx->extradata = av_mallocz(new_extradata_size +
3101
-                                      FF_INPUT_BUFFER_PADDING_SIZE);
3101
+                                      AV_INPUT_BUFFER_PADDING_SIZE);
3102 3102
         if (!avctx->extradata)
3103 3103
             return AVERROR(ENOMEM);
3104 3104
         avctx->extradata_size = new_extradata_size;
... ...
@@ -817,7 +817,7 @@ static av_cold int alloc_buffers(AVCodecContext *avctx, AACEncContext *s)
817 817
     int ch;
818 818
     FF_ALLOCZ_ARRAY_OR_GOTO(avctx, s->buffer.samples, s->channels, 3 * 1024 * sizeof(s->buffer.samples[0]), alloc_fail);
819 819
     FF_ALLOCZ_ARRAY_OR_GOTO(avctx, s->cpe, s->chan_map[0], sizeof(ChannelElement), alloc_fail);
820
-    FF_ALLOCZ_OR_GOTO(avctx, avctx->extradata, 5 + FF_INPUT_BUFFER_PADDING_SIZE, alloc_fail);
820
+    FF_ALLOCZ_OR_GOTO(avctx, avctx->extradata, 5 + AV_INPUT_BUFFER_PADDING_SIZE, alloc_fail);
821 821
 
822 822
     for(ch = 0; ch < s->channels; ch++)
823 823
         s->planar_samples[ch] = s->buffer.samples + 3 * 1024 * ch;
... ...
@@ -166,7 +166,7 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
166 166
     int err;
167 167
     union {
168 168
         uint64_t u64;
169
-        uint8_t  u8[8 + FF_INPUT_BUFFER_PADDING_SIZE];
169
+        uint8_t  u8[8 + AV_INPUT_BUFFER_PADDING_SIZE];
170 170
     } tmp = { av_be2ne64(state) };
171 171
     AC3HeaderInfo hdr, *phdr = &hdr;
172 172
     GetBitContext gbc;
... ...
@@ -235,7 +235,7 @@ typedef struct AC3DecodeContext {
235 235
     DECLARE_ALIGNED(32, INTFLOAT, window)[AC3_BLOCK_SIZE];                              ///< window coefficients
236 236
     DECLARE_ALIGNED(32, INTFLOAT, tmp_output)[AC3_BLOCK_SIZE];                          ///< temporary storage for output before windowing
237 237
     DECLARE_ALIGNED(32, SHORTFLOAT, output)[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE];            ///< output after imdct transform and windowing
238
-    DECLARE_ALIGNED(32, uint8_t, input_buffer)[AC3_FRAME_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; ///< temp buffer to prevent overread
238
+    DECLARE_ALIGNED(32, uint8_t, input_buffer)[AC3_FRAME_BUFFER_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; ///< temp buffer to prevent overread
239 239
 ///@}
240 240
 } AC3DecodeContext;
241 241
 
... ...
@@ -113,7 +113,7 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
113 113
         avctx->frame_size = (BLKSIZE - 7 * avctx->channels) * 2 / avctx->channels + 2;
114 114
         avctx->bits_per_coded_sample = 4;
115 115
         avctx->block_align    = BLKSIZE;
116
-        if (!(avctx->extradata = av_malloc(32 + FF_INPUT_BUFFER_PADDING_SIZE)))
116
+        if (!(avctx->extradata = av_malloc(32 + AV_INPUT_BUFFER_PADDING_SIZE)))
117 117
             goto error;
118 118
         avctx->extradata_size = 32;
119 119
         extradata = avctx->extradata;
... ...
@@ -531,7 +531,7 @@ static av_cold int alac_encode_init(AVCodecContext *avctx)
531 531
                                                  avctx->channels,
532 532
                                                  avctx->bits_per_raw_sample);
533 533
 
534
-    avctx->extradata = av_mallocz(ALAC_EXTRADATA_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
534
+    avctx->extradata = av_mallocz(ALAC_EXTRADATA_SIZE + AV_INPUT_BUFFER_PADDING_SIZE);
535 535
     if (!avctx->extradata) {
536 536
         ret = AVERROR(ENOMEM);
537 537
         goto error;
... ...
@@ -265,7 +265,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
265 265
     }
266 266
 
267 267
     if ((ret = ff_alloc_packet2(avctx, pkt, a->mb_height * a->mb_width * MAX_MB_SIZE +
268
-                                FF_MIN_BUFFER_SIZE, 0)) < 0)
268
+                                AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0)
269 269
         return ret;
270 270
 
271 271
     init_put_bits(&a->pb, pkt->data, pkt->size);
... ...
@@ -886,7 +886,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
886 886
         return AVERROR(EINVAL);
887 887
 
888 888
     q->decoded_bytes_buffer = av_mallocz(FFALIGN(avctx->block_align, 4) +
889
-                                         FF_INPUT_BUFFER_PADDING_SIZE);
889
+                                         AV_INPUT_BUFFER_PADDING_SIZE);
890 890
     if (!q->decoded_bytes_buffer)
891 891
         return AVERROR(ENOMEM);
892 892
 
... ...
@@ -632,15 +632,24 @@ typedef struct AVCodecDescriptor {
632 632
  * Note: If the first 23 bits of the additional bytes are not 0, then damaged
633 633
  * MPEG bitstreams could cause overread and segfault.
634 634
  */
635
-#define FF_INPUT_BUFFER_PADDING_SIZE 32
635
+#define AV_INPUT_BUFFER_PADDING_SIZE 32
636 636
 
637 637
 /**
638 638
  * @ingroup lavc_encoding
639 639
  * minimum encoding buffer size
640 640
  * Used to avoid some checks during header writing.
641 641
  */
642
-#define FF_MIN_BUFFER_SIZE 16384
642
+#define AV_INPUT_BUFFER_MIN_SIZE 16384
643
+
644
+/**
645
+ * @deprecated use AV_INPUT_BUFFER_PADDING_SIZE instead
646
+ */
647
+#define FF_INPUT_BUFFER_PADDING_SIZE 32
643 648
 
649
+/**
650
+ * @deprecated use AV_INPUT_BUFFER_MIN_SIZE instead
651
+ */
652
+#define FF_MIN_BUFFER_SIZE 16384
644 653
 
645 654
 /**
646 655
  * @ingroup lavc_encoding
... ...
@@ -1595,7 +1604,7 @@ typedef struct AVCodecContext {
1595 1595
      * mjpeg: Huffman tables
1596 1596
      * rv10: additional flags
1597 1597
      * mpeg4: global headers (they can be in the bitstream or here)
1598
-     * The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger
1598
+     * The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes larger
1599 1599
      * than extradata_size to avoid problems if it is read with the bitstream reader.
1600 1600
      * The bytewise contents of extradata must not depend on the architecture or CPU endianness.
1601 1601
      * - encoding: Set/allocated/freed by libavcodec.
... ...
@@ -4062,7 +4071,7 @@ int av_grow_packet(AVPacket *pkt, int grow_by);
4062 4062
  *        function returns successfully, the data is owned by the underlying AVBuffer.
4063 4063
  *        The caller may not access the data through other means.
4064 4064
  * @param size size of data in bytes, without the padding. I.e. the full buffer
4065
- *        size is assumed to be size + FF_INPUT_BUFFER_PADDING_SIZE.
4065
+ *        size is assumed to be size + AV_INPUT_BUFFER_PADDING_SIZE.
4066 4066
  *
4067 4067
  * @return 0 on success, a negative AVERROR on error
4068 4068
  */
... ...
@@ -4399,7 +4408,7 @@ attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *s
4399 4399
  * returning samples. It is safe to flush even those decoders that are not
4400 4400
  * marked with AV_CODEC_CAP_DELAY, then no samples will be returned.
4401 4401
  *
4402
- * @warning The input buffer, avpkt->data must be FF_INPUT_BUFFER_PADDING_SIZE
4402
+ * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE
4403 4403
  *          larger than the actual read bytes because some optimized bitstream
4404 4404
  *          readers read 32 or 64 bits at once and could read over the end.
4405 4405
  *
... ...
@@ -4439,7 +4448,7 @@ int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
4439 4439
  * Some decoders may support multiple frames in a single AVPacket, such
4440 4440
  * decoders would then just decode the first frame.
4441 4441
  *
4442
- * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than
4442
+ * @warning The input buffer must be AV_INPUT_BUFFER_PADDING_SIZE larger than
4443 4443
  * the actual read bytes because some optimized bitstream readers read 32 or 64
4444 4444
  * bits at once and could read over the end.
4445 4445
  *
... ...
@@ -5447,7 +5456,7 @@ AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f);
5447 5447
 
5448 5448
 /**
5449 5449
  * Same behaviour av_fast_malloc but the buffer has additional
5450
- * FF_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0.
5450
+ * AV_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0.
5451 5451
  *
5452 5452
  * In addition the whole buffer will initially and after resizes
5453 5453
  * be 0-initialized so that no uninitialized data will ever appear.
... ...
@@ -68,14 +68,14 @@ FF_ENABLE_DEPRECATION_WARNINGS
68 68
 static int packet_alloc(AVBufferRef **buf, int size)
69 69
 {
70 70
     int ret;
71
-    if ((unsigned)size >= (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
71
+    if ((unsigned)size >= (unsigned)size + AV_INPUT_BUFFER_PADDING_SIZE)
72 72
         return AVERROR(EINVAL);
73 73
 
74
-    ret = av_buffer_realloc(buf, size + FF_INPUT_BUFFER_PADDING_SIZE);
74
+    ret = av_buffer_realloc(buf, size + AV_INPUT_BUFFER_PADDING_SIZE);
75 75
     if (ret < 0)
76 76
         return ret;
77 77
 
78
-    memset((*buf)->data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
78
+    memset((*buf)->data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
79 79
 
80 80
     return 0;
81 81
 }
... ...
@@ -105,20 +105,20 @@ void av_shrink_packet(AVPacket *pkt, int size)
105 105
     if (pkt->size <= size)
106 106
         return;
107 107
     pkt->size = size;
108
-    memset(pkt->data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
108
+    memset(pkt->data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
109 109
 }
110 110
 
111 111
 int av_grow_packet(AVPacket *pkt, int grow_by)
112 112
 {
113 113
     int new_size;
114
-    av_assert0((unsigned)pkt->size <= INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE);
114
+    av_assert0((unsigned)pkt->size <= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE);
115 115
     if (!pkt->size)
116 116
         return av_new_packet(pkt, grow_by);
117 117
     if ((unsigned)grow_by >
118
-        INT_MAX - (pkt->size + FF_INPUT_BUFFER_PADDING_SIZE))
118
+        INT_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE))
119 119
         return -1;
120 120
 
121
-    new_size = pkt->size + grow_by + FF_INPUT_BUFFER_PADDING_SIZE;
121
+    new_size = pkt->size + grow_by + AV_INPUT_BUFFER_PADDING_SIZE;
122 122
     if (pkt->buf) {
123 123
         int ret = av_buffer_realloc(&pkt->buf, new_size);
124 124
         if (ret < 0)
... ...
@@ -136,17 +136,17 @@ FF_ENABLE_DEPRECATION_WARNINGS
136 136
     }
137 137
     pkt->data  = pkt->buf->data;
138 138
     pkt->size += grow_by;
139
-    memset(pkt->data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
139
+    memset(pkt->data + pkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
140 140
 
141 141
     return 0;
142 142
 }
143 143
 
144 144
 int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size)
145 145
 {
146
-    if (size >= INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE)
146
+    if (size >= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
147 147
         return AVERROR(EINVAL);
148 148
 
149
-    pkt->buf = av_buffer_create(data, size + FF_INPUT_BUFFER_PADDING_SIZE,
149
+    pkt->buf = av_buffer_create(data, size + AV_INPUT_BUFFER_PADDING_SIZE,
150 150
                                 av_buffer_default_free, NULL, 0);
151 151
     if (!pkt->buf)
152 152
         return AVERROR(ENOMEM);
... ...
@@ -174,9 +174,9 @@ do {                                         \
174 174
         void *data;                                                     \
175 175
         if (padding) {                                                  \
176 176
             if ((unsigned)(size) >                                      \
177
-                (unsigned)(size) + FF_INPUT_BUFFER_PADDING_SIZE)        \
177
+                (unsigned)(size) + AV_INPUT_BUFFER_PADDING_SIZE)        \
178 178
                 goto failed_alloc;                                      \
179
-            ALLOC(data, size + FF_INPUT_BUFFER_PADDING_SIZE);           \
179
+            ALLOC(data, size + AV_INPUT_BUFFER_PADDING_SIZE);           \
180 180
         } else {                                                        \
181 181
             ALLOC(data, size);                                          \
182 182
         }                                                               \
... ...
@@ -185,7 +185,7 @@ do {                                         \
185 185
         memcpy(data, src, size);                                        \
186 186
         if (padding)                                                    \
187 187
             memset((uint8_t *)data + size, 0,                           \
188
-                   FF_INPUT_BUFFER_PADDING_SIZE);                       \
188
+                   AV_INPUT_BUFFER_PADDING_SIZE);                       \
189 189
         dst = data;                                                     \
190 190
     } while (0)
191 191
 
... ...
@@ -303,7 +303,7 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
303 303
 
304 304
     if ((unsigned)elems + 1 > INT_MAX / sizeof(*pkt->side_data))
305 305
         return NULL;
306
-    if ((unsigned)size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE)
306
+    if ((unsigned)size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
307 307
         return NULL;
308 308
 
309 309
     pkt->side_data = av_realloc(pkt->side_data,
... ...
@@ -311,7 +311,7 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
311 311
     if (!pkt->side_data)
312 312
         return NULL;
313 313
 
314
-    pkt->side_data[elems].data = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
314
+    pkt->side_data[elems].data = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
315 315
     if (!pkt->side_data[elems].data)
316 316
         return NULL;
317 317
     pkt->side_data[elems].size = size;
... ...
@@ -366,7 +366,7 @@ int av_packet_merge_side_data(AVPacket *pkt){
366 366
         AVBufferRef *buf;
367 367
         int i;
368 368
         uint8_t *p;
369
-        uint64_t size= pkt->size + 8LL + FF_INPUT_BUFFER_PADDING_SIZE;
369
+        uint64_t size= pkt->size + 8LL + AV_INPUT_BUFFER_PADDING_SIZE;
370 370
         AVPacket old= *pkt;
371 371
         for (i=0; i<old.side_data_elems; i++) {
372 372
             size += old.side_data[i].size + 5LL;
... ...
@@ -383,7 +383,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
383 383
         pkt->destruct = dummy_destruct_packet;
384 384
 FF_ENABLE_DEPRECATION_WARNINGS
385 385
 #endif
386
-        pkt->size = size - FF_INPUT_BUFFER_PADDING_SIZE;
386
+        pkt->size = size - AV_INPUT_BUFFER_PADDING_SIZE;
387 387
         bytestream_put_buffer(&p, old.data, old.size);
388 388
         for (i=old.side_data_elems-1; i>=0; i--) {
389 389
             bytestream_put_buffer(&p, old.side_data[i].data, old.side_data[i].size);
... ...
@@ -392,7 +392,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
392 392
         }
393 393
         bytestream_put_be64(&p, FF_MERGE_MARKER);
394 394
         av_assert0(p-pkt->data == pkt->size);
395
-        memset(p, 0, FF_INPUT_BUFFER_PADDING_SIZE);
395
+        memset(p, 0, AV_INPUT_BUFFER_PADDING_SIZE);
396 396
         av_free_packet(&old);
397 397
         pkt->side_data_elems = 0;
398 398
         pkt->side_data = NULL;
... ...
@@ -425,7 +425,7 @@ int av_packet_split_side_data(AVPacket *pkt){
425 425
         for (i=0; ; i++){
426 426
             size= AV_RB32(p);
427 427
             av_assert0(size<=INT_MAX && p - pkt->data >= size);
428
-            pkt->side_data[i].data = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
428
+            pkt->side_data[i].data = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
429 429
             pkt->side_data[i].size = size;
430 430
             pkt->side_data[i].type = p[4]&127;
431 431
             if (!pkt->side_data[i].data)
... ...
@@ -30,7 +30,7 @@ static av_cold int avui_encode_init(AVCodecContext *avctx)
30 30
         av_log(avctx, AV_LOG_ERROR, "Only 720x486 and 720x576 are supported.\n");
31 31
         return AVERROR(EINVAL);
32 32
     }
33
-    if (!(avctx->extradata = av_mallocz(144 + FF_INPUT_BUFFER_PADDING_SIZE)))
33
+    if (!(avctx->extradata = av_mallocz(144 + AV_INPUT_BUFFER_PADDING_SIZE)))
34 34
         return AVERROR(ENOMEM);
35 35
     avctx->extradata_size = 144;
36 36
     memcpy(avctx->extradata, "\0\0\0\x18""APRGAPRG0001", 16);
... ...
@@ -302,10 +302,10 @@ static int decode_frame(AVCodecContext *avctx, void *data,
302 302
             av_log(avctx, AV_LOG_ERROR, "Packet is too small\n");
303 303
             return AVERROR_INVALIDDATA;
304 304
         }
305
-        buf = av_realloc(s->packet_buffer, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
305
+        buf = av_realloc(s->packet_buffer, avpkt->size + AV_INPUT_BUFFER_PADDING_SIZE);
306 306
         if (!buf)
307 307
             return AVERROR(ENOMEM);
308
-        memset(buf + avpkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
308
+        memset(buf + avpkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
309 309
         s->packet_buffer = buf;
310 310
         memcpy(s->packet_buffer, avpkt->data, avpkt->size);
311 311
         if ((ret = init_get_bits8(gb, s->packet_buffer, avpkt->size)) < 0)
... ...
@@ -272,7 +272,7 @@ static int cdxl_decode_frame(AVCodecContext *avctx, void *data,
272 272
 
273 273
     if (encoding) {
274 274
         av_fast_padded_malloc(&c->new_video, &c->new_video_size,
275
-                              h * w + FF_INPUT_BUFFER_PADDING_SIZE);
275
+                              h * w + AV_INPUT_BUFFER_PADDING_SIZE);
276 276
         if (!c->new_video)
277 277
             return AVERROR(ENOMEM);
278 278
         if (c->bpp == 8)
... ...
@@ -1232,11 +1232,11 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
1232 1232
 
1233 1233
     /* Pad the databuffer with:
1234 1234
        DECODE_BYTES_PAD1 or DECODE_BYTES_PAD2 for decode_bytes(),
1235
-       FF_INPUT_BUFFER_PADDING_SIZE, for the bitstreamreader. */
1235
+       AV_INPUT_BUFFER_PADDING_SIZE, for the bitstreamreader. */
1236 1236
     q->decoded_bytes_buffer =
1237 1237
         av_mallocz(avctx->block_align
1238 1238
                    + DECODE_BYTES_PAD1(avctx->block_align)
1239
-                   + FF_INPUT_BUFFER_PADDING_SIZE);
1239
+                   + AV_INPUT_BUFFER_PADDING_SIZE);
1240 1240
     if (!q->decoded_bytes_buffer)
1241 1241
         return AVERROR(ENOMEM);
1242 1242
 
... ...
@@ -422,7 +422,7 @@ static av_cold int init(AVCodecContext *avctx)
422 422
             int dummy_int;
423 423
 
424 424
             /* Back up the extradata so it can be restored at close time. */
425
-            priv->orig_extradata = av_malloc(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
425
+            priv->orig_extradata = av_malloc(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
426 426
             if (!priv->orig_extradata) {
427 427
                 av_log(avctx, AV_LOG_ERROR,
428 428
                        "Failed to allocate copy of extradata\n");
... ...
@@ -113,7 +113,7 @@ static int dca_parse_params(const uint8_t *buf, int buf_size, int *duration,
113 113
                             int *sample_rate, int *framesize)
114 114
 {
115 115
     GetBitContext gb;
116
-    uint8_t hdr[12 + FF_INPUT_BUFFER_PADDING_SIZE] = { 0 };
116
+    uint8_t hdr[12 + AV_INPUT_BUFFER_PADDING_SIZE] = { 0 };
117 117
     int ret, sample_blocks, sr_code;
118 118
 
119 119
     if (buf_size < 12)
... ...
@@ -66,7 +66,7 @@ typedef struct DssSpContext {
66 66
     int pulse_dec_mode;
67 67
 
68 68
     DECLARE_ALIGNED(16, uint8_t, bits)[DSS_SP_FRAME_SIZE +
69
-                                       FF_INPUT_BUFFER_PADDING_SIZE];
69
+                                       AV_INPUT_BUFFER_PADDING_SIZE];
70 70
 } DssSpContext;
71 71
 
72 72
 /*
... ...
@@ -36,12 +36,12 @@ static int dump_extradata(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx,
36 36
             /*||(? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN)*/){
37 37
             int size= buf_size + avctx->extradata_size;
38 38
             *poutbuf_size= size;
39
-            *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
39
+            *poutbuf= av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
40 40
             if (!*poutbuf)
41 41
                 return AVERROR(ENOMEM);
42 42
 
43 43
             memcpy(*poutbuf, avctx->extradata, avctx->extradata_size);
44
-            memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
44
+            memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size + AV_INPUT_BUFFER_PADDING_SIZE);
45 45
             return 1;
46 46
         }
47 47
     }
... ...
@@ -287,8 +287,8 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
287 287
     GetBitContext gb;
288 288
     BlockInfo mb_data[5 * DV_MAX_BPM], *mb, *mb1;
289 289
     LOCAL_ALIGNED_16(int16_t, sblock, [5 * DV_MAX_BPM], [64]);
290
-    LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [80     + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */
291
-    LOCAL_ALIGNED_16(uint8_t, vs_bit_buffer, [80 * 5 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */
290
+    LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [80     + AV_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */
291
+    LOCAL_ALIGNED_16(uint8_t, vs_bit_buffer, [80 * 5 + AV_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */
292 292
     const int log2_blocksize = 3-s->avctx->lowres;
293 293
     int is_field_mode[5];
294 294
     int vs_bit_buffer_damaged = 0;
... ...
@@ -312,7 +312,7 @@ static int decode_frame(AVCodecContext *avctx,
312 312
         return AVERROR(ENOMEM);
313 313
     s->bbdsp.bswap16_buf(s->bitstream_buf, (const uint16_t *)(buf + bytestream2_tell(&gb)),
314 314
                          bytestream2_get_bytes_left(&gb) / 2);
315
-    memset((uint8_t*)s->bitstream_buf + bytestream2_get_bytes_left(&gb), 0, FF_INPUT_BUFFER_PADDING_SIZE);
315
+    memset((uint8_t*)s->bitstream_buf + bytestream2_get_bytes_left(&gb), 0, AV_INPUT_BUFFER_PADDING_SIZE);
316 316
     init_get_bits(&s->gb, s->bitstream_buf, 8*(bytestream2_get_bytes_left(&gb)));
317 317
 
318 318
     for (s->mb_y=0; s->mb_y < (avctx->height+15)/16; s->mb_y++)
... ...
@@ -550,7 +550,7 @@ static int write_extradata(FFV1Context *f)
550 550
 
551 551
     f->avctx->extradata_size = 10000 + 4 +
552 552
                                     (11 * 11 * 5 * 5 * 5 + 11 * 11 * 11) * 32;
553
-    f->avctx->extradata = av_malloc(f->avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
553
+    f->avctx->extradata = av_malloc(f->avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
554 554
     if (!f->avctx->extradata)
555 555
         return AVERROR(ENOMEM);
556 556
     ff_init_range_encoder(c, f->avctx->extradata, f->avctx->extradata_size);
... ...
@@ -1197,7 +1197,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
1197 1197
     uint8_t keystate    = 128;
1198 1198
     uint8_t *buf_p;
1199 1199
     int i, ret;
1200
-    int64_t maxsize =   FF_MIN_BUFFER_SIZE
1200
+    int64_t maxsize =   AV_INPUT_BUFFER_MIN_SIZE
1201 1201
                       + avctx->width*avctx->height*35LL*4;
1202 1202
 
1203 1203
     if(!pict) {
... ...
@@ -1246,7 +1246,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
1246 1246
     }
1247 1247
 
1248 1248
     if (f->version > 3)
1249
-        maxsize = FF_MIN_BUFFER_SIZE + avctx->width*avctx->height*3LL*4;
1249
+        maxsize = AV_INPUT_BUFFER_MIN_SIZE + avctx->width*avctx->height*3LL*4;
1250 1250
 
1251 1251
     if ((ret = ff_alloc_packet2(avctx, pkt, maxsize, 0)) < 0)
1252 1252
         return ret;
... ...
@@ -854,7 +854,7 @@ static int flashsv2_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
854 854
     int res;
855 855
     int keyframe = 0;
856 856
 
857
-    if ((res = ff_alloc_packet2(avctx, pkt, s->frame_size + FF_MIN_BUFFER_SIZE, 0)) < 0)
857
+    if ((res = ff_alloc_packet2(avctx, pkt, s->frame_size + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0)
858 858
         return res;
859 859
 
860 860
     /* First frame needs to be a keyframe */
... ...
@@ -193,7 +193,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
193 193
 
194 194
     pixels = s->frame->data[0];
195 195
     pixel_limit = s->avctx->height * s->frame->linesize[0];
196
-    if (buf_size < 16 || buf_size > INT_MAX - (3 * 256 + FF_INPUT_BUFFER_PADDING_SIZE))
196
+    if (buf_size < 16 || buf_size > INT_MAX - (3 * 256 + AV_INPUT_BUFFER_PADDING_SIZE))
197 197
         return AVERROR_INVALIDDATA;
198 198
     frame_size = bytestream2_get_le32(&g2);
199 199
     if (frame_size > buf_size)
... ...
@@ -294,10 +294,10 @@ static int jpg_decode_data(JPGContext *c, int width, int height,
294 294
     const int ridx = swapuv ? 2 : 0;
295 295
 
296 296
     if ((ret = av_reallocp(&c->buf,
297
-                           src_size + FF_INPUT_BUFFER_PADDING_SIZE)) < 0)
297
+                           src_size + AV_INPUT_BUFFER_PADDING_SIZE)) < 0)
298 298
         return ret;
299 299
     jpg_unescape(src, src_size, c->buf, &unesc_size);
300
-    memset(c->buf + unesc_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
300
+    memset(c->buf + unesc_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
301 301
     if((ret = init_get_bits8(&gb, c->buf, unesc_size)) < 0)
302 302
         return ret;
303 303
 
... ...
@@ -1185,7 +1185,7 @@ static int g2m_init_buffers(G2MContext *c)
1185 1185
         c->synth_tile  = av_mallocz(c->tile_stride      * aligned_height);
1186 1186
         c->jpeg_tile   = av_mallocz(c->tile_stride      * aligned_height);
1187 1187
         c->kempf_buf   = av_mallocz((c->tile_width + 1) * aligned_height +
1188
-                                    FF_INPUT_BUFFER_PADDING_SIZE);
1188
+                                    AV_INPUT_BUFFER_PADDING_SIZE);
1189 1189
         c->kempf_flags = av_mallocz(c->tile_width       * aligned_height);
1190 1190
         if (!c->synth_tile || !c->jpeg_tile ||
1191 1191
             !c->kempf_buf || !c->kempf_flags)
... ...
@@ -401,7 +401,7 @@ static inline int check_marker(GetBitContext *s, const char *msg)
401 401
 
402 402
 /**
403 403
  * Initialize GetBitContext.
404
- * @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes
404
+ * @param buffer bitstream buffer, must be AV_INPUT_BUFFER_PADDING_SIZE bytes
405 405
  *        larger than the actual read bits because some optimized bitstream
406 406
  *        readers read 32 or 64 bit at once and could read over the end
407 407
  * @param bit_size the size of the buffer in bits
... ...
@@ -432,7 +432,7 @@ static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
432 432
 
433 433
 /**
434 434
  * Initialize GetBitContext.
435
- * @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes
435
+ * @param buffer bitstream buffer, must be AV_INPUT_BUFFER_PADDING_SIZE bytes
436 436
  *        larger than the actual read bits because some optimized bitstream
437 437
  *        readers read 32 or 64 bit at once and could read over the end
438 438
  * @param byte_size the size of the buffer in bytes
... ...
@@ -269,7 +269,7 @@ static int gif_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
269 269
     const uint32_t *palette = NULL;
270 270
     int ret;
271 271
 
272
-    if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*7/5 + FF_MIN_BUFFER_SIZE, 0)) < 0)
272
+    if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*7/5 + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0)
273 273
         return ret;
274 274
     outbuf_ptr = pkt->data;
275 275
     end        = pkt->data + pkt->size;
... ...
@@ -324,7 +324,7 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, H264SliceContext *sl,
324 324
         dst[di++] = src[si++];
325 325
 
326 326
 nsc:
327
-    memset(dst + di, 0, FF_INPUT_BUFFER_PADDING_SIZE);
327
+    memset(dst + di, 0, AV_INPUT_BUFFER_PADDING_SIZE);
328 328
 
329 329
     *dst_length = di;
330 330
     *consumed   = si + 1; // +1 for the header
... ...
@@ -57,7 +57,7 @@ static int alloc_and_copy(uint8_t **poutbuf, int *poutbuf_size,
57 57
 
58 58
     *poutbuf_size += sps_pps_size + in_size + nal_header_size;
59 59
     if ((err = av_reallocp(poutbuf,
60
-                           *poutbuf_size + FF_INPUT_BUFFER_PADDING_SIZE)) < 0) {
60
+                           *poutbuf_size + AV_INPUT_BUFFER_PADDING_SIZE)) < 0) {
61 61
         *poutbuf_size = 0;
62 62
         return err;
63 63
     }
... ...
@@ -178,7 +178,7 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
178 178
         if (args && strstr(args, "private_spspps_buf"))
179 179
             ctx->private_spspps = 1;
180 180
 
181
-        ret = h264_extradata_to_annexb(ctx, avctx, FF_INPUT_BUFFER_PADDING_SIZE);
181
+        ret = h264_extradata_to_annexb(ctx, avctx, AV_INPUT_BUFFER_PADDING_SIZE);
182 182
         if (ret < 0)
183 183
             return ret;
184 184
         ctx->length_size      = ret;
... ...
@@ -349,8 +349,8 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y)
349 349
             int sh = s->ps.sps->pixel_shift;
350 350
             int left_pixels, right_pixels;
351 351
 
352
-            stride_dst = 2*MAX_PB_SIZE + FF_INPUT_BUFFER_PADDING_SIZE;
353
-            dst = lc->edge_emu_buffer + stride_dst + FF_INPUT_BUFFER_PADDING_SIZE;
352
+            stride_dst = 2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE;
353
+            dst = lc->edge_emu_buffer + stride_dst + AV_INPUT_BUFFER_PADDING_SIZE;
354 354
 
355 355
             if (!top_edge) {
356 356
                 int left = 1 - left_edge;
... ...
@@ -67,18 +67,18 @@ static int hevc_extradata_to_annexb(AVCodecContext *avctx)
67 67
         for (j = 0; j < cnt; j++) {
68 68
             int nalu_len = bytestream2_get_be16(&gb);
69 69
 
70
-            if (4 + FF_INPUT_BUFFER_PADDING_SIZE + nalu_len > SIZE_MAX - new_extradata_size) {
70
+            if (4 + AV_INPUT_BUFFER_PADDING_SIZE + nalu_len > SIZE_MAX - new_extradata_size) {
71 71
                 ret = AVERROR_INVALIDDATA;
72 72
                 goto fail;
73 73
             }
74
-            ret = av_reallocp(&new_extradata, new_extradata_size + nalu_len + 4 + FF_INPUT_BUFFER_PADDING_SIZE);
74
+            ret = av_reallocp(&new_extradata, new_extradata_size + nalu_len + 4 + AV_INPUT_BUFFER_PADDING_SIZE);
75 75
             if (ret < 0)
76 76
                 goto fail;
77 77
 
78 78
             AV_WB32(new_extradata + new_extradata_size, 1); // add the startcode
79 79
             bytestream2_get_buffer(&gb, new_extradata + new_extradata_size + 4, nalu_len);
80 80
             new_extradata_size += 4 + nalu_len;
81
-            memset(new_extradata + new_extradata_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
81
+            memset(new_extradata + new_extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
82 82
         }
83 83
     }
84 84
 
... ...
@@ -91,7 +91,7 @@ int ff_hevc_extract_rbsp(HEVCContext *s, const uint8_t *src, int length,
91 91
     }
92 92
 
93 93
     av_fast_malloc(&nal->rbsp_buffer, &nal->rbsp_buffer_size,
94
-                   length + FF_INPUT_BUFFER_PADDING_SIZE);
94
+                   length + AV_INPUT_BUFFER_PADDING_SIZE);
95 95
     if (!nal->rbsp_buffer)
96 96
         return AVERROR(ENOMEM);
97 97
 
... ...
@@ -137,7 +137,7 @@ int ff_hevc_extract_rbsp(HEVCContext *s, const uint8_t *src, int length,
137 137
         dst[di++] = src[si++];
138 138
 
139 139
 nsc:
140
-    memset(dst + di, 0, FF_INPUT_BUFFER_PADDING_SIZE);
140
+    memset(dst + di, 0, AV_INPUT_BUFFER_PADDING_SIZE);
141 141
 
142 142
     nal->data = dst;
143 143
     nal->size = di;
... ...
@@ -61,7 +61,7 @@ typedef struct HEVCDSPContext {
61 61
     void (*sao_band_filter[5])(uint8_t *_dst, uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src,
62 62
                                int16_t *sao_offset_val, int sao_left_class, int width, int height);
63 63
 
64
-    /* implicit stride_src parameter has value of 2 * MAX_PB_SIZE + FF_INPUT_BUFFER_PADDING_SIZE */
64
+    /* implicit stride_src parameter has value of 2 * MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE */
65 65
     void (*sao_edge_filter[5])(uint8_t *_dst /* align 16 */, uint8_t *_src /* align 32 */, ptrdiff_t stride_dst,
66 66
                                int16_t *sao_offset_val, int sao_eo_class, int width, int height);
67 67
 
... ...
@@ -341,7 +341,7 @@ static void FUNC(sao_edge_filter)(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride
341 341
     pixel *src = (pixel *)_src;
342 342
     int a_stride, b_stride;
343 343
     int x, y;
344
-    ptrdiff_t stride_src = (2*MAX_PB_SIZE + FF_INPUT_BUFFER_PADDING_SIZE) / sizeof(pixel);
344
+    ptrdiff_t stride_src = (2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE) / sizeof(pixel);
345 345
     stride_dst /= sizeof(pixel);
346 346
 
347 347
     a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src;
... ...
@@ -41,7 +41,7 @@
41 41
 #include "libavutil/pixdesc.h"
42 42
 
43 43
 #define classic_shift_luma_table_size 42
44
-static const unsigned char classic_shift_luma[classic_shift_luma_table_size + FF_INPUT_BUFFER_PADDING_SIZE] = {
44
+static const unsigned char classic_shift_luma[classic_shift_luma_table_size + AV_INPUT_BUFFER_PADDING_SIZE] = {
45 45
     34, 36, 35, 69, 135, 232,   9, 16, 10, 24,  11,  23,  12,  16, 13, 10,
46 46
     14,  8, 15,  8,  16,   8,  17, 20, 16, 10, 207, 206, 205, 236, 11,  8,
47 47
     10, 21,  9, 23,   8,   8, 199, 70, 69, 68,   0,
... ...
@@ -49,7 +49,7 @@ static const unsigned char classic_shift_luma[classic_shift_luma_table_size + FF
49 49
 };
50 50
 
51 51
 #define classic_shift_chroma_table_size 59
52
-static const unsigned char classic_shift_chroma[classic_shift_chroma_table_size + FF_INPUT_BUFFER_PADDING_SIZE] = {
52
+static const unsigned char classic_shift_chroma[classic_shift_chroma_table_size + AV_INPUT_BUFFER_PADDING_SIZE] = {
53 53
     66, 36,  37,  38, 39, 40,  41,  75,  76,  77, 110, 239, 144, 81, 82,  83,
54 54
     84, 85, 118, 183, 56, 57,  88,  89,  56,  89, 154,  57,  58, 57, 26, 141,
55 55
     57, 56,  58,  57, 58, 57, 184, 119, 214, 245, 116,  83,  82, 49, 80,  79,
... ...
@@ -760,7 +760,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
760 760
     const AVFrame * const p = pict;
761 761
     int i, j, size = 0, ret;
762 762
 
763
-    if ((ret = ff_alloc_packet2(avctx, pkt, width * height * 3 * 4 + FF_MIN_BUFFER_SIZE, 0)) < 0)
763
+    if ((ret = ff_alloc_packet2(avctx, pkt, width * height * 3 * 4 + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0)
764 764
         return ret;
765 765
 
766 766
     if (s->context) {
... ...
@@ -240,7 +240,7 @@ static int extract_header(AVCodecContext *const avctx,
240 240
                 avctx->pix_fmt = AV_PIX_FMT_RGB32;
241 241
                 av_freep(&s->mask_buf);
242 242
                 av_freep(&s->mask_palbuf);
243
-                s->mask_buf = av_malloc((s->planesize * 32) + FF_INPUT_BUFFER_PADDING_SIZE);
243
+                s->mask_buf = av_malloc((s->planesize * 32) + AV_INPUT_BUFFER_PADDING_SIZE);
244 244
                 if (!s->mask_buf)
245 245
                     return AVERROR(ENOMEM);
246 246
                 if (s->bpp > 16) {
... ...
@@ -248,7 +248,7 @@ static int extract_header(AVCodecContext *const avctx,
248 248
                     av_freep(&s->mask_buf);
249 249
                     return AVERROR(ENOMEM);
250 250
                 }
251
-                s->mask_palbuf = av_malloc((2 << s->bpp) * sizeof(uint32_t) + FF_INPUT_BUFFER_PADDING_SIZE);
251
+                s->mask_palbuf = av_malloc((2 << s->bpp) * sizeof(uint32_t) + AV_INPUT_BUFFER_PADDING_SIZE);
252 252
                 if (!s->mask_palbuf) {
253 253
                     av_freep(&s->mask_buf);
254 254
                     return AVERROR(ENOMEM);
... ...
@@ -275,12 +275,12 @@ static int extract_header(AVCodecContext *const avctx,
275 275
             int ham_count;
276 276
             const uint8_t *const palette = avctx->extradata + AV_RB16(avctx->extradata);
277 277
 
278
-            s->ham_buf = av_malloc((s->planesize * 8) + FF_INPUT_BUFFER_PADDING_SIZE);
278
+            s->ham_buf = av_malloc((s->planesize * 8) + AV_INPUT_BUFFER_PADDING_SIZE);
279 279
             if (!s->ham_buf)
280 280
                 return AVERROR(ENOMEM);
281 281
 
282 282
             ham_count = 8 * (1 << s->ham);
283
-            s->ham_palbuf = av_malloc((ham_count << !!(s->masking == MASK_HAS_MASK)) * sizeof (uint32_t) + FF_INPUT_BUFFER_PADDING_SIZE);
283
+            s->ham_palbuf = av_malloc((ham_count << !!(s->masking == MASK_HAS_MASK)) * sizeof (uint32_t) + AV_INPUT_BUFFER_PADDING_SIZE);
284 284
             if (!s->ham_palbuf) {
285 285
                 av_freep(&s->ham_buf);
286 286
                 return AVERROR(ENOMEM);
... ...
@@ -366,7 +366,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
366 366
     if ((err = av_image_check_size(avctx->width, avctx->height, 0, avctx)))
367 367
         return err;
368 368
     s->planesize = FFALIGN(avctx->width, 16) >> 3; // Align plane size in bits to word-boundary
369
-    s->planebuf  = av_malloc(s->planesize + FF_INPUT_BUFFER_PADDING_SIZE);
369
+    s->planebuf  = av_malloc(s->planesize + AV_INPUT_BUFFER_PADDING_SIZE);
370 370
     if (!s->planebuf)
371 371
         return AVERROR(ENOMEM);
372 372
 
... ...
@@ -1021,7 +1021,7 @@ static int imc_decode_frame(AVCodecContext *avctx, void *data,
1021 1021
 
1022 1022
     IMCContext *q = avctx->priv_data;
1023 1023
 
1024
-    LOCAL_ALIGNED_16(uint16_t, buf16, [(IMC_BLOCK_SIZE + FF_INPUT_BUFFER_PADDING_SIZE) / 2]);
1024
+    LOCAL_ALIGNED_16(uint16_t, buf16, [(IMC_BLOCK_SIZE + AV_INPUT_BUFFER_PADDING_SIZE) / 2]);
1025 1025
 
1026 1026
     if (buf_size < IMC_BLOCK_SIZE * avctx->channels) {
1027 1027
         av_log(avctx, AV_LOG_ERROR, "frame too small!\n");
... ...
@@ -42,7 +42,7 @@ static int imx_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx
42 42
         return 0;
43 43
     }
44 44
 
45
-    *poutbuf = av_malloc(buf_size + 20 + FF_INPUT_BUFFER_PADDING_SIZE);
45
+    *poutbuf = av_malloc(buf_size + 20 + AV_INPUT_BUFFER_PADDING_SIZE);
46 46
     if (!*poutbuf)
47 47
         return AVERROR(ENOMEM);
48 48
     poutbufp = *poutbuf;
... ...
@@ -200,7 +200,7 @@ int avpriv_unlock_avformat(void);
200 200
  * This value was chosen such that every bit of the buffer is
201 201
  * addressable by a 32-bit signed integer as used by get_bits.
202 202
  */
203
-#define FF_MAX_EXTRADATA_SIZE ((1 << 28) - FF_INPUT_BUFFER_PADDING_SIZE)
203
+#define FF_MAX_EXTRADATA_SIZE ((1 << 28) - AV_INPUT_BUFFER_PADDING_SIZE)
204 204
 
205 205
 /**
206 206
  * Check AVPacket size and/or allocate data.
... ...
@@ -955,7 +955,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
955 955
     Jpeg2000EncoderContext *s = avctx->priv_data;
956 956
     uint8_t *chunkstart, *jp2cstart, *jp2hstart;
957 957
 
958
-    if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*9 + FF_MIN_BUFFER_SIZE, 0)) < 0)
958
+    if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*9 + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0)
959 959
         return ret;
960 960
 
961 961
     // init:
... ...
@@ -215,13 +215,13 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
215 215
             (comp->coord[1][1] - comp->coord[1][0]);
216 216
 
217 217
     if (codsty->transform == FF_DWT97) {
218
-        csize += FF_INPUT_BUFFER_PADDING_SIZE / sizeof(*comp->f_data);
218
+        csize += AV_INPUT_BUFFER_PADDING_SIZE / sizeof(*comp->f_data);
219 219
         comp->i_data = NULL;
220 220
         comp->f_data = av_mallocz_array(csize, sizeof(*comp->f_data));
221 221
         if (!comp->f_data)
222 222
             return AVERROR(ENOMEM);
223 223
     } else {
224
-        csize += FF_INPUT_BUFFER_PADDING_SIZE / sizeof(*comp->i_data);
224
+        csize += AV_INPUT_BUFFER_PADDING_SIZE / sizeof(*comp->i_data);
225 225
         comp->f_data = NULL;
226 226
         comp->i_data = av_mallocz_array(csize, sizeof(*comp->i_data));
227 227
         if (!comp->i_data)
... ...
@@ -269,7 +269,7 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
269 269
         comps = 3;
270 270
 
271 271
     if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width  *avctx->height * comps * 4 +
272
-                                FF_MIN_BUFFER_SIZE, 0)) < 0)
272
+                                AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0)
273 273
         return ret;
274 274
 
275 275
     buf2 = av_malloc(pkt->size);
... ...
@@ -131,7 +131,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
131 131
 
132 132
     av_assert0(avctx->width && avctx->height);
133 133
 
134
-    avctx->extradata = av_mallocz(8 + FF_INPUT_BUFFER_PADDING_SIZE);
134
+    avctx->extradata = av_mallocz(8 + AV_INPUT_BUFFER_PADDING_SIZE);
135 135
     if (!avctx->extradata)
136 136
         return AVERROR(ENOMEM);
137 137
 
... ...
@@ -81,7 +81,7 @@ static av_cold int aacPlus_encode_init(AVCodecContext *avctx)
81 81
 
82 82
         if (aacplusEncGetDecoderSpecificInfo(s->aacplus_handle, &buffer,
83 83
                                            &decoder_specific_info_size) == 1) {
84
-            avctx->extradata = av_malloc(decoder_specific_info_size + FF_INPUT_BUFFER_PADDING_SIZE);
84
+            avctx->extradata = av_malloc(decoder_specific_info_size + AV_INPUT_BUFFER_PADDING_SIZE);
85 85
             if (!avctx->extradata) {
86 86
                 free(buffer);
87 87
                 return AVERROR(ENOMEM);
... ...
@@ -56,7 +56,7 @@ static int dcadec_decode_frame(AVCodecContext *avctx, void *data,
56 56
     }
57 57
     mrk = AV_RB32(input);
58 58
     if (mrk != DCA_SYNCWORD_CORE_BE && mrk != DCA_SYNCWORD_SUBSTREAM) {
59
-        s->buffer = av_fast_realloc(s->buffer, &s->buffer_size, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
59
+        s->buffer = av_fast_realloc(s->buffer, &s->buffer_size, avpkt->size + AV_INPUT_BUFFER_PADDING_SIZE);
60 60
         if (!s->buffer)
61 61
             return AVERROR(ENOMEM);
62 62
 
... ...
@@ -138,7 +138,7 @@ static av_cold int Faac_encode_init(AVCodecContext *avctx)
138 138
 
139 139
         if (!faacEncGetDecoderSpecificInfo(s->faac_handle, &buffer,
140 140
                                            &decoder_specific_info_size)) {
141
-            avctx->extradata = av_malloc(decoder_specific_info_size + FF_INPUT_BUFFER_PADDING_SIZE);
141
+            avctx->extradata = av_malloc(decoder_specific_info_size + AV_INPUT_BUFFER_PADDING_SIZE);
142 142
             if (!avctx->extradata) {
143 143
                 ret = AVERROR(ENOMEM);
144 144
                 goto error;
... ...
@@ -292,7 +292,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
292 292
     if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
293 293
         avctx->extradata_size = info.confSize;
294 294
         avctx->extradata      = av_mallocz(avctx->extradata_size +
295
-                                           FF_INPUT_BUFFER_PADDING_SIZE);
295
+                                           AV_INPUT_BUFFER_PADDING_SIZE);
296 296
         if (!avctx->extradata) {
297 297
             ret = AVERROR(ENOMEM);
298 298
             goto error;
... ...
@@ -143,7 +143,7 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
143 143
         (*s->encoder)->EncodeParameterSets(s->encoder, &fbi);
144 144
         for (i = 0; i < fbi.sLayerInfo[0].iNalCount; i++)
145 145
             size += fbi.sLayerInfo[0].pNalLengthInByte[i];
146
-        avctx->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
146
+        avctx->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
147 147
         if (!avctx->extradata) {
148 148
             err = AVERROR(ENOMEM);
149 149
             goto fail;
... ...
@@ -269,7 +269,7 @@ static av_cold int libopus_encode_init(AVCodecContext *avctx)
269 269
     }
270 270
 
271 271
     header_size = 19 + (avctx->channels > 2 ? 2 + avctx->channels : 0);
272
-    avctx->extradata = av_malloc(header_size + FF_INPUT_BUFFER_PADDING_SIZE);
272
+    avctx->extradata = av_malloc(header_size + AV_INPUT_BUFFER_PADDING_SIZE);
273 273
     if (!avctx->extradata) {
274 274
         av_log(avctx, AV_LOG_ERROR, "Failed to allocate extradata.\n");
275 275
         ret = AVERROR(ENOMEM);
... ...
@@ -245,7 +245,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
245 245
     header_data = speex_header_to_packet(&s->header, &header_size);
246 246
 
247 247
     /* allocate extradata */
248
-    avctx->extradata = av_malloc(header_size + FF_INPUT_BUFFER_PADDING_SIZE);
248
+    avctx->extradata = av_malloc(header_size + AV_INPUT_BUFFER_PADDING_SIZE);
249 249
     if (!avctx->extradata) {
250 250
         speex_header_free(header_data);
251 251
         speex_encoder_destroy(s->enc_state);
... ...
@@ -272,7 +272,7 @@ static av_cold int Stagefright_init(AVCodecContext *avctx)
272 272
 
273 273
     s->orig_extradata_size = avctx->extradata_size;
274 274
     s->orig_extradata = (uint8_t*) av_mallocz(avctx->extradata_size +
275
-                                              FF_INPUT_BUFFER_PADDING_SIZE);
275
+                                              AV_INPUT_BUFFER_PADDING_SIZE);
276 276
     if (!s->orig_extradata) {
277 277
         ret = AVERROR(ENOMEM);
278 278
         goto fail;
... ...
@@ -105,7 +105,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
105 105
     if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
106 106
         avctx->extradata_size = 2;
107 107
         avctx->extradata      = av_mallocz(avctx->extradata_size +
108
-                                           FF_INPUT_BUFFER_PADDING_SIZE);
108
+                                           AV_INPUT_BUFFER_PADDING_SIZE);
109 109
         if (!avctx->extradata) {
110 110
             ret = AVERROR(ENOMEM);
111 111
             goto error;
... ...
@@ -231,7 +231,7 @@ static av_cold int libvorbis_encode_init(AVCodecContext *avctx)
231 231
                                 xiph_len(header_comm.bytes) +
232 232
                                 header_code.bytes;
233 233
     p = avctx->extradata = av_malloc(avctx->extradata_size +
234
-                                     FF_INPUT_BUFFER_PADDING_SIZE);
234
+                                     AV_INPUT_BUFFER_PADDING_SIZE);
235 235
     if (!p) {
236 236
         ret = AVERROR(ENOMEM);
237 237
         goto error;
... ...
@@ -225,7 +225,7 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
225 225
             return AVERROR_INVALIDDATA;
226 226
         }
227 227
 
228
-        avctx->extradata = av_malloc(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
228
+        avctx->extradata = av_malloc(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
229 229
         if (!avctx->extradata) {
230 230
             av_log(avctx, AV_LOG_ERROR,
231 231
                    "Cannot allocate HEVC header of size %d.\n", avctx->extradata_size);
... ...
@@ -81,7 +81,7 @@ static int encode_nals(AVCodecContext *ctx, AVPacket *pkt,
81 81
 {
82 82
     XavsContext *x4 = ctx->priv_data;
83 83
     uint8_t *p;
84
-    int i, s, ret, size = x4->sei_size + FF_MIN_BUFFER_SIZE;
84
+    int i, s, ret, size = x4->sei_size + AV_INPUT_BUFFER_MIN_SIZE;
85 85
 
86 86
     if (!nnal)
87 87
         return 0;
... ...
@@ -716,7 +716,7 @@ static int xvid_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
716 716
     xvid_enc_frame_t xvid_enc_frame = { 0 };
717 717
     xvid_enc_stats_t xvid_enc_stats = { 0 };
718 718
 
719
-    if ((ret = ff_alloc_packet2(avctx, pkt, mb_width*(int64_t)mb_height*MAX_MB_BYTES + FF_MIN_BUFFER_SIZE, 0)) < 0)
719
+    if ((ret = ff_alloc_packet2(avctx, pkt, mb_width*(int64_t)mb_height*MAX_MB_BYTES + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0)
720 720
         return ret;
721 721
 
722 722
     /* Start setting up the frame */
... ...
@@ -217,7 +217,7 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
217 217
     const int height = avctx->height;
218 218
     const int mb_width  = (width  + s->hsample[0] - 1) / s->hsample[0];
219 219
     const int mb_height = (height + s->vsample[0] - 1) / s->vsample[0];
220
-    int max_pkt_size = FF_MIN_BUFFER_SIZE;
220
+    int max_pkt_size = AV_INPUT_BUFFER_MIN_SIZE;
221 221
     int ret, header_bits;
222 222
 
223 223
     if(    avctx->pix_fmt == AV_PIX_FMT_BGR0
... ...
@@ -44,7 +44,7 @@ static int mjpega_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *av
44 44
     }
45 45
 
46 46
     *poutbuf_size = 0;
47
-    *poutbuf = av_malloc(buf_size + 44 + FF_INPUT_BUFFER_PADDING_SIZE);
47
+    *poutbuf = av_malloc(buf_size + 44 + AV_INPUT_BUFFER_PADDING_SIZE);
48 48
     if (!*poutbuf)
49 49
         return AVERROR(ENOMEM);
50 50
     poutbufp = *poutbuf;
... ...
@@ -1905,7 +1905,7 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
1905 1905
         *unescaped_buf_ptr  = s->buffer;
1906 1906
         *unescaped_buf_size = dst - s->buffer;
1907 1907
         memset(s->buffer + *unescaped_buf_size, 0,
1908
-               FF_INPUT_BUFFER_PADDING_SIZE);
1908
+               AV_INPUT_BUFFER_PADDING_SIZE);
1909 1909
 
1910 1910
         av_log(s->avctx, AV_LOG_DEBUG, "escaping removed %"PTRDIFF_SPECIFIER" bytes\n",
1911 1911
                (buf_end - *buf_ptr) - (dst - s->buffer));
... ...
@@ -1950,7 +1950,7 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
1950 1950
         *unescaped_buf_ptr  = dst;
1951 1951
         *unescaped_buf_size = (bit_count + 7) >> 3;
1952 1952
         memset(s->buffer + *unescaped_buf_size, 0,
1953
-               FF_INPUT_BUFFER_PADDING_SIZE);
1953
+               AV_INPUT_BUFFER_PADDING_SIZE);
1954 1954
     } else {
1955 1955
         *unescaped_buf_ptr  = *buf_ptr;
1956 1956
         *unescaped_buf_size = buf_end - *buf_ptr;
... ...
@@ -28,7 +28,7 @@ static int text2movsub(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, co
28 28
                      const uint8_t *buf, int buf_size, int keyframe){
29 29
     if (buf_size > 0xffff) return 0;
30 30
     *poutbuf_size = buf_size + 2;
31
-    *poutbuf = av_malloc(*poutbuf_size + FF_INPUT_BUFFER_PADDING_SIZE);
31
+    *poutbuf = av_malloc(*poutbuf_size + AV_INPUT_BUFFER_PADDING_SIZE);
32 32
     if (!*poutbuf)
33 33
         return AVERROR(ENOMEM);
34 34
     AV_WB16(*poutbuf, buf_size);
... ...
@@ -46,7 +46,7 @@ static int mov2textsub(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, co
46 46
                      const uint8_t *buf, int buf_size, int keyframe){
47 47
     if (buf_size < 2) return 0;
48 48
     *poutbuf_size = FFMIN(buf_size - 2, AV_RB16(buf));
49
-    *poutbuf = av_malloc(*poutbuf_size + FF_INPUT_BUFFER_PADDING_SIZE);
49
+    *poutbuf = av_malloc(*poutbuf_size + AV_INPUT_BUFFER_PADDING_SIZE);
50 50
     if (!*poutbuf)
51 51
         return AVERROR(ENOMEM);
52 52
     memcpy(*poutbuf, buf + 2, *poutbuf_size);
... ...
@@ -189,7 +189,7 @@ static av_cold int mov_text_encode_init(AVCodecContext *avctx)
189 189
     MovTextContext *s = avctx->priv_data;
190 190
 
191 191
     avctx->extradata_size = sizeof text_sample_entry;
192
-    avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
192
+    avctx->extradata = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
193 193
     if (!avctx->extradata)
194 194
         return AVERROR(ENOMEM);
195 195
 
... ...
@@ -71,8 +71,8 @@ static int mp3_header_decompress(AVBitStreamFilterContext *bsfc, AVCodecContext
71 71
     header |= (frame_size == buf_size + 4)<<16; //FIXME actually set a correct crc instead of 0
72 72
 
73 73
     *poutbuf_size= frame_size;
74
-    *poutbuf= av_malloc(frame_size + FF_INPUT_BUFFER_PADDING_SIZE);
75
-    memcpy(*poutbuf + frame_size - buf_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
74
+    *poutbuf= av_malloc(frame_size + AV_INPUT_BUFFER_PADDING_SIZE);
75
+    memcpy(*poutbuf + frame_size - buf_size, buf, buf_size + AV_INPUT_BUFFER_PADDING_SIZE);
76 76
 
77 77
     if(avctx->channels==2){
78 78
         uint8_t *p= *poutbuf + frame_size - buf_size;
... ...
@@ -73,11 +73,11 @@ static void scan_buffer(const uint8_t *buf, int buf_size,
73 73
 
74 74
 /* allocate new buffer and copy size bytes from src */
75 75
 static uint8_t *create_new_buffer(const uint8_t *src, int size) {
76
-    uint8_t *dst = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
76
+    uint8_t *dst = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
77 77
 
78 78
     if (dst) {
79 79
         memcpy(dst, src, size);
80
-        memset(dst + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
80
+        memset(dst + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
81 81
     }
82 82
 
83 83
     return dst;
... ...
@@ -573,7 +573,7 @@ do {\
573 573
 
574 574
     if (s1->bitstream_buffer) {
575 575
         if (s1->bitstream_buffer_size +
576
-            FF_INPUT_BUFFER_PADDING_SIZE > s->allocated_bitstream_buffer_size) {
576
+            AV_INPUT_BUFFER_PADDING_SIZE > s->allocated_bitstream_buffer_size) {
577 577
             av_fast_malloc(&s->bitstream_buffer,
578 578
                            &s->allocated_bitstream_buffer_size,
579 579
                            s1->allocated_bitstream_buffer_size);
... ...
@@ -586,7 +586,7 @@ do {\
586 586
         memcpy(s->bitstream_buffer, s1->bitstream_buffer,
587 587
                s1->bitstream_buffer_size);
588 588
         memset(s->bitstream_buffer + s->bitstream_buffer_size, 0,
589
-               FF_INPUT_BUFFER_PADDING_SIZE);
589
+               AV_INPUT_BUFFER_PADDING_SIZE);
590 590
     }
591 591
 
592 592
     // linesize dependend scratch buffer allocation
... ...
@@ -1740,7 +1740,7 @@ int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
1740 1740
     /* output? */
1741 1741
     if (s->new_picture.f->data[0]) {
1742 1742
         int growing_buffer = context_count == 1 && !pkt->data && !s->data_partitioning;
1743
-        int pkt_size = growing_buffer ? FFMAX(s->mb_width*s->mb_height*64+10000, avctx->internal->byte_buffer_size) - FF_INPUT_BUFFER_PADDING_SIZE
1743
+        int pkt_size = growing_buffer ? FFMAX(s->mb_width*s->mb_height*64+10000, avctx->internal->byte_buffer_size) - AV_INPUT_BUFFER_PADDING_SIZE
1744 1744
                                               :
1745 1745
                                               s->mb_width*s->mb_height*(MAX_MB_BYTES+100)+10000;
1746 1746
         if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size, 0)) < 0)
... ...
@@ -477,7 +477,7 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
477 477
     Rectangle wmv9rects[MAX_WMV9_RECTANGLES], *r;
478 478
     int used_rects = 0, i, implicit_rect = 0, av_uninit(wmv9_mask);
479 479
 
480
-    av_assert0(FF_INPUT_BUFFER_PADDING_SIZE >=
480
+    av_assert0(AV_INPUT_BUFFER_PADDING_SIZE >=
481 481
                ARITH2_PADDING + (MIN_CACHE_BITS + 7) / 8);
482 482
 
483 483
     if ((ret = init_get_bits8(&gb, buf, buf_size)) < 0)
... ...
@@ -76,7 +76,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
76 76
     int skips = 0;
77 77
     int quality = 24;
78 78
 
79
-    if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*9 + FF_MIN_BUFFER_SIZE, 0)) < 0)
79
+    if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*9 + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0)
80 80
         return ret;
81 81
     dst= buf= pkt->data;
82 82
 
... ...
@@ -35,11 +35,11 @@ static int noise(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const ch
35 35
     if(amount <= 0)
36 36
         return AVERROR(EINVAL);
37 37
 
38
-    *poutbuf= av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
38
+    *poutbuf= av_malloc(buf_size + AV_INPUT_BUFFER_PADDING_SIZE);
39 39
     if (!*poutbuf)
40 40
         return AVERROR(ENOMEM);
41 41
 
42
-    memcpy(*poutbuf, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
42
+    memcpy(*poutbuf, buf, buf_size + AV_INPUT_BUFFER_PADDING_SIZE);
43 43
     for(i=0; i<buf_size; i++){
44 44
         (*state) += (*poutbuf)[i] + 1;
45 45
         if(*state % amount == 0)
... ...
@@ -124,7 +124,7 @@ static int codec_reinit(AVCodecContext *avctx, int width, int height,
124 124
     if (width != c->width || height != c->height) {
125 125
         // also reserve space for a possible additional header
126 126
         int buf_size = height * width * 3 / 2
127
-                     + FFMAX(AV_LZO_OUTPUT_PADDING, FF_INPUT_BUFFER_PADDING_SIZE)
127
+                     + FFMAX(AV_LZO_OUTPUT_PADDING, AV_INPUT_BUFFER_PADDING_SIZE)
128 128
                      + RTJPEG_HEADER_SIZE;
129 129
         if (buf_size > INT_MAX/8)
130 130
             return -1;
... ...
@@ -208,15 +208,15 @@ retry:
208 208
     buf       = &buf[12];
209 209
     buf_size -= 12;
210 210
     if (comptype == NUV_RTJPEG_IN_LZO || comptype == NUV_LZO) {
211
-        int outlen = c->decomp_size - FFMAX(FF_INPUT_BUFFER_PADDING_SIZE, AV_LZO_OUTPUT_PADDING);
211
+        int outlen = c->decomp_size - FFMAX(AV_INPUT_BUFFER_PADDING_SIZE, AV_LZO_OUTPUT_PADDING);
212 212
         int inlen  = buf_size;
213 213
         if (av_lzo1x_decode(c->decomp_buf, &outlen, buf, &inlen)) {
214 214
             av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
215 215
             return AVERROR_INVALIDDATA;
216 216
         }
217 217
         buf      = c->decomp_buf;
218
-        buf_size = c->decomp_size - FFMAX(FF_INPUT_BUFFER_PADDING_SIZE, AV_LZO_OUTPUT_PADDING) - outlen;
219
-        memset(c->decomp_buf + buf_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
218
+        buf_size = c->decomp_size - FFMAX(AV_INPUT_BUFFER_PADDING_SIZE, AV_LZO_OUTPUT_PADDING) - outlen;
219
+        memset(c->decomp_buf + buf_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
220 220
     }
221 221
     if (c->codec_frameheader) {
222 222
         int w, h, q;
... ...
@@ -1014,7 +1014,7 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
1014 1014
         }
1015 1015
 
1016 1016
         avctx->extradata_size = outSize;
1017
-        avctx->extradata = av_mallocz(outSize + FF_INPUT_BUFFER_PADDING_SIZE);
1017
+        avctx->extradata = av_mallocz(outSize + AV_INPUT_BUFFER_PADDING_SIZE);
1018 1018
 
1019 1019
         if (!avctx->extradata) {
1020 1020
             res = AVERROR(ENOMEM);
... ...
@@ -232,7 +232,7 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
232 232
             memset(((uint8_t *) dest->obj) + size, 0, pad); \
233 233
     }
234 234
     alloc_and_copy_or_fail(extradata,    src->extradata_size,
235
-                           FF_INPUT_BUFFER_PADDING_SIZE);
235
+                           AV_INPUT_BUFFER_PADDING_SIZE);
236 236
     dest->extradata_size  = src->extradata_size;
237 237
     alloc_and_copy_or_fail(intra_matrix, 64 * sizeof(int16_t), 0);
238 238
     alloc_and_copy_or_fail(inter_matrix, 64 * sizeof(int16_t), 0);
... ...
@@ -134,7 +134,7 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx,
134 134
                      int64_t pts, int64_t dts, int64_t pos)
135 135
 {
136 136
     int index, i;
137
-    uint8_t dummy_buf[FF_INPUT_BUFFER_PADDING_SIZE];
137
+    uint8_t dummy_buf[AV_INPUT_BUFFER_PADDING_SIZE];
138 138
 
139 139
     if (!(s->flags & PARSER_FLAG_FETCHED_OFFSET)) {
140 140
         s->next_frame_offset =
... ...
@@ -204,13 +204,13 @@ int av_parser_change(AVCodecParserContext *s, AVCodecContext *avctx,
204 204
             int size = buf_size + avctx->extradata_size;
205 205
 
206 206
             *poutbuf_size = size;
207
-            *poutbuf      = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
207
+            *poutbuf      = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
208 208
             if (!*poutbuf)
209 209
                 return AVERROR(ENOMEM);
210 210
 
211 211
             memcpy(*poutbuf, avctx->extradata, avctx->extradata_size);
212 212
             memcpy(*poutbuf + avctx->extradata_size, buf,
213
-                   buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
213
+                   buf_size + AV_INPUT_BUFFER_PADDING_SIZE);
214 214
             return 1;
215 215
         }
216 216
     }
... ...
@@ -252,10 +252,10 @@ int ff_combine_frame(ParseContext *pc, int next,
252 252
     if (next == END_NOT_FOUND) {
253 253
         void *new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size,
254 254
                                            *buf_size + pc->index +
255
-                                           FF_INPUT_BUFFER_PADDING_SIZE);
255
+                                           AV_INPUT_BUFFER_PADDING_SIZE);
256 256
 
257 257
         if (!new_buffer) {
258
-            av_log(NULL, AV_LOG_ERROR, "Failed to reallocate parser buffer to %d\n", *buf_size + pc->index + FF_INPUT_BUFFER_PADDING_SIZE);
258
+            av_log(NULL, AV_LOG_ERROR, "Failed to reallocate parser buffer to %d\n", *buf_size + pc->index + AV_INPUT_BUFFER_PADDING_SIZE);
259 259
             pc->index = 0;
260 260
             return AVERROR(ENOMEM);
261 261
         }
... ...
@@ -272,17 +272,17 @@ int ff_combine_frame(ParseContext *pc, int next,
272 272
     if (pc->index) {
273 273
         void *new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size,
274 274
                                            next + pc->index +
275
-                                           FF_INPUT_BUFFER_PADDING_SIZE);
275
+                                           AV_INPUT_BUFFER_PADDING_SIZE);
276 276
         if (!new_buffer) {
277
-            av_log(NULL, AV_LOG_ERROR, "Failed to reallocate parser buffer to %d\n", next + pc->index + FF_INPUT_BUFFER_PADDING_SIZE);
277
+            av_log(NULL, AV_LOG_ERROR, "Failed to reallocate parser buffer to %d\n", next + pc->index + AV_INPUT_BUFFER_PADDING_SIZE);
278 278
             pc->overread_index =
279 279
             pc->index = 0;
280 280
             return AVERROR(ENOMEM);
281 281
         }
282 282
         pc->buffer = new_buffer;
283
-        if (next > -FF_INPUT_BUFFER_PADDING_SIZE)
283
+        if (next > -AV_INPUT_BUFFER_PADDING_SIZE)
284 284
             memcpy(&pc->buffer[pc->index], *buf,
285
-                   next + FF_INPUT_BUFFER_PADDING_SIZE);
285
+                   next + AV_INPUT_BUFFER_PADDING_SIZE);
286 286
         pc->index = 0;
287 287
         *buf      = pc->buffer;
288 288
     }
... ...
@@ -143,7 +143,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
143 143
     ptr    = p->data[0];
144 144
     stride = p->linesize[0];
145 145
 
146
-    scanline = av_malloc(bytes_per_scanline + FF_INPUT_BUFFER_PADDING_SIZE);
146
+    scanline = av_malloc(bytes_per_scanline + AV_INPUT_BUFFER_PADDING_SIZE);
147 147
     if (!scanline)
148 148
         return AVERROR(ENOMEM);
149 149
 
... ...
@@ -495,7 +495,7 @@ static int encode_png(AVCodecContext *avctx, AVPacket *pkt,
495 495
 
496 496
     enc_row_size    = deflateBound(&s->zstream, (avctx->width * s->bits_per_pixel + 7) >> 3);
497 497
     max_packet_size =
498
-        FF_MIN_BUFFER_SIZE + // headers
498
+        AV_INPUT_BUFFER_MIN_SIZE + // headers
499 499
         avctx->height * (
500 500
             enc_row_size +
501 501
             12 * (((int64_t)enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) // IDAT * ceil(enc_row_size / IOBUF_SIZE)
... ...
@@ -553,7 +553,7 @@ static int encode_apng(AVCodecContext *avctx, AVPacket *pkt,
553 553
 
554 554
     enc_row_size    = deflateBound(&s->zstream, (avctx->width * s->bits_per_pixel + 7) >> 3);
555 555
     max_packet_size =
556
-        FF_MIN_BUFFER_SIZE + // headers
556
+        AV_INPUT_BUFFER_MIN_SIZE + // headers
557 557
         avctx->height * (
558 558
             enc_row_size +
559 559
             (4 + 12) * (((int64_t)enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) // fdAT * ceil(enc_row_size / IOBUF_SIZE)
... ...
@@ -55,7 +55,7 @@ retry:
55 55
             goto retry;
56 56
         }
57 57
 #if 0
58
-        if (pc->index && pc->index * 2 + FF_INPUT_BUFFER_PADDING_SIZE < pc->buffer_size && buf_size > pc->index) {
58
+        if (pc->index && pc->index * 2 + AV_INPUT_BUFFER_PADDING_SIZE < pc->buffer_size && buf_size > pc->index) {
59 59
             memcpy(pc->buffer + pc->index, buf, pc->index);
60 60
             pc->index += pc->index;
61 61
             buf       += pc->index;
... ...
@@ -491,10 +491,10 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
491 491
     int header_size = 148;
492 492
     uint8_t *buf;
493 493
     int pic_size, ret;
494
-    int frame_size = FFALIGN(avctx->width, 16) * FFALIGN(avctx->height, 16)*16 + 500 + FF_MIN_BUFFER_SIZE; //FIXME choose tighter limit
494
+    int frame_size = FFALIGN(avctx->width, 16) * FFALIGN(avctx->height, 16)*16 + 500 + AV_INPUT_BUFFER_MIN_SIZE; //FIXME choose tighter limit
495 495
 
496 496
 
497
-    if ((ret = ff_alloc_packet2(avctx, pkt, frame_size + FF_MIN_BUFFER_SIZE, 0)) < 0)
497
+    if ((ret = ff_alloc_packet2(avctx, pkt, frame_size + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0)
498 498
         return ret;
499 499
 
500 500
     buf = pkt->data;
... ...
@@ -944,7 +944,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
944 944
     ctx->pic = pic;
945 945
     pkt_size = ctx->frame_size_upper_bound;
946 946
 
947
-    if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size + FF_MIN_BUFFER_SIZE, 0)) < 0)
947
+    if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0)
948 948
         return ret;
949 949
 
950 950
     orig_buf = pkt->data;
... ...
@@ -189,7 +189,7 @@ static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q)
189 189
     }
190 190
 
191 191
     avctx->extradata = av_malloc(extradata.SPSBufSize + need_pps * extradata.PPSBufSize +
192
-                                 FF_INPUT_BUFFER_PADDING_SIZE);
192
+                                 AV_INPUT_BUFFER_PADDING_SIZE);
193 193
     if (!avctx->extradata)
194 194
         return AVERROR(ENOMEM);
195 195
 
... ...
@@ -197,7 +197,7 @@ static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q)
197 197
     if (need_pps)
198 198
         memcpy(avctx->extradata + extradata.SPSBufSize, pps_buf, extradata.PPSBufSize);
199 199
     avctx->extradata_size = extradata.SPSBufSize + need_pps * extradata.PPSBufSize;
200
-    memset(avctx->extradata + avctx->extradata_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
200
+    memset(avctx->extradata + avctx->extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
201 201
 
202 202
     return 0;
203 203
 }
... ...
@@ -140,7 +140,7 @@ static int generate_fake_vps(QSVEncContext *q, AVCodecContext *avctx)
140 140
     }
141 141
 
142 142
     vps_size = bytestream2_tell_p(&pbc);
143
-    new_extradata = av_mallocz(vps_size + avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
143
+    new_extradata = av_mallocz(vps_size + avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
144 144
     if (!new_extradata)
145 145
         return AVERROR(ENOMEM);
146 146
     memcpy(new_extradata, vps_buf, vps_size);
... ...
@@ -431,7 +431,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
431 431
         void *tmp_ptr;
432 432
         s->max_framesize = 8192; // should hopefully be enough for the first header
433 433
         tmp_ptr = av_fast_realloc(s->bitstream, &s->allocated_bitstream_size,
434
-                                  s->max_framesize + FF_INPUT_BUFFER_PADDING_SIZE);
434
+                                  s->max_framesize + AV_INPUT_BUFFER_PADDING_SIZE);
435 435
         if (!tmp_ptr) {
436 436
             av_log(avctx, AV_LOG_ERROR, "error allocating bitstream buffer\n");
437 437
             return AVERROR(ENOMEM);
... ...
@@ -445,7 +445,7 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
445 445
         buf_size       = FFMIN(buf_size, s->max_framesize - s->bitstream_size);
446 446
         input_buf_size = buf_size;
447 447
 
448
-        if (s->bitstream_index + s->bitstream_size + buf_size + FF_INPUT_BUFFER_PADDING_SIZE >
448
+        if (s->bitstream_index + s->bitstream_size + buf_size + AV_INPUT_BUFFER_PADDING_SIZE >
449 449
             s->allocated_bitstream_size) {
450 450
             memmove(s->bitstream, &s->bitstream[s->bitstream_index],
451 451
                     s->bitstream_size);
... ...
@@ -1555,7 +1555,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
1555 1555
     uint8_t rc_header_bak[sizeof(s->header_state)];
1556 1556
     uint8_t rc_block_bak[sizeof(s->block_state)];
1557 1557
 
1558
-    if ((ret = ff_alloc_packet2(avctx, pkt, s->b_width*s->b_height*MB_SIZE*MB_SIZE*3 + FF_MIN_BUFFER_SIZE, 0)) < 0)
1558
+    if ((ret = ff_alloc_packet2(avctx, pkt, s->b_width*s->b_height*MB_SIZE*MB_SIZE*3 + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0)
1559 1559
         return ret;
1560 1560
 
1561 1561
     ff_init_range_encoder(c, pkt->data, pkt->size);
... ...
@@ -33,7 +33,7 @@ int ff_startcode_find_candidate_c(const uint8_t *buf, int size)
33 33
     int i = 0;
34 34
 #if HAVE_FAST_UNALIGNED
35 35
     /* we check i < size instead of i + 3 / 7 because it is
36
-     * simpler and there must be FF_INPUT_BUFFER_PADDING_SIZE
36
+     * simpler and there must be AV_INPUT_BUFFER_PADDING_SIZE
37 37
      * bytes at the end.
38 38
      */
39 39
 #if HAVE_FAST_64BIT
... ...
@@ -589,7 +589,7 @@ static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
589 589
     int i, ret;
590 590
 
591 591
     if ((ret = ff_alloc_packet2(avctx, pkt, s->y_block_width * s->y_block_height *
592
-                             MAX_MB_BYTES*3 + FF_MIN_BUFFER_SIZE, 0)) < 0)
592
+                             MAX_MB_BYTES*3 + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0)
593 593
         return ret;
594 594
 
595 595
     if (avctx->pix_fmt != AV_PIX_FMT_YUV410P) {
... ...
@@ -453,7 +453,7 @@ static int tiff_unpack_fax(TiffContext *s, uint8_t *dst, int stride,
453 453
     int i, ret = 0;
454 454
     int line;
455 455
     uint8_t *src2 = av_malloc((unsigned)size +
456
-                              FF_INPUT_BUFFER_PADDING_SIZE);
456
+                              AV_INPUT_BUFFER_PADDING_SIZE);
457 457
 
458 458
     if (!src2) {
459 459
         av_log(s->avctx, AV_LOG_ERROR,
... ...
@@ -471,7 +471,7 @@ static int tiff_unpack_fax(TiffContext *s, uint8_t *dst, int stride,
471 471
         for (i = 0; i < size; i++)
472 472
             src2[i] = ff_reverse[src[i]];
473 473
     }
474
-    memset(src2 + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
474
+    memset(src2 + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
475 475
     ret = ff_ccitt_unpack(s->avctx, src2, size, dst, lines, stride,
476 476
                           s->compr, s->fax_opts);
477 477
     if (s->bpp < 8 && s->avctx->pix_fmt == AV_PIX_FMT_PAL8)
... ...
@@ -329,7 +329,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
329 329
     bytes_per_row = (((s->width - 1) / s->subsampling[0] + 1) * s->bpp *
330 330
                      s->subsampling[0] * s->subsampling[1] + 7) >> 3;
331 331
     packet_size = avctx->height * bytes_per_row * 2 +
332
-                  avctx->height * 4 + FF_MIN_BUFFER_SIZE;
332
+                  avctx->height * 4 + AV_INPUT_BUFFER_MIN_SIZE;
333 333
 
334 334
     if ((ret = ff_alloc_packet2(avctx, pkt, packet_size, 0)) < 0)
335 335
         return ret;
... ...
@@ -126,25 +126,25 @@ static void *avformat_mutex;
126 126
 void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
127 127
 {
128 128
     uint8_t **p = ptr;
129
-    if (min_size > SIZE_MAX - FF_INPUT_BUFFER_PADDING_SIZE) {
129
+    if (min_size > SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
130 130
         av_freep(p);
131 131
         *size = 0;
132 132
         return;
133 133
     }
134
-    if (!ff_fast_malloc(p, size, min_size + FF_INPUT_BUFFER_PADDING_SIZE, 1))
135
-        memset(*p + min_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
134
+    if (!ff_fast_malloc(p, size, min_size + AV_INPUT_BUFFER_PADDING_SIZE, 1))
135
+        memset(*p + min_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
136 136
 }
137 137
 
138 138
 void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size)
139 139
 {
140 140
     uint8_t **p = ptr;
141
-    if (min_size > SIZE_MAX - FF_INPUT_BUFFER_PADDING_SIZE) {
141
+    if (min_size > SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
142 142
         av_freep(p);
143 143
         *size = 0;
144 144
         return;
145 145
     }
146
-    if (!ff_fast_malloc(p, size, min_size + FF_INPUT_BUFFER_PADDING_SIZE, 1))
147
-        memset(*p, 0, min_size + FF_INPUT_BUFFER_PADDING_SIZE);
146
+    if (!ff_fast_malloc(p, size, min_size + AV_INPUT_BUFFER_PADDING_SIZE, 1))
147
+        memset(*p, 0, min_size + AV_INPUT_BUFFER_PADDING_SIZE);
148 148
 }
149 149
 
150 150
 /* encoder management */
... ...
@@ -1783,9 +1783,9 @@ int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64
1783 1783
         av_log(avctx, AV_LOG_ERROR, "Invalid negative user packet size %d\n", avpkt->size);
1784 1784
         return AVERROR(EINVAL);
1785 1785
     }
1786
-    if (size < 0 || size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) {
1786
+    if (size < 0 || size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
1787 1787
         av_log(avctx, AV_LOG_ERROR, "Invalid minimum required packet size %"PRId64" (max allowed is %d)\n",
1788
-               size, INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE);
1788
+               size, INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE);
1789 1789
         return AVERROR(EINVAL);
1790 1790
     }
1791 1791
 
... ...
@@ -1992,7 +1992,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
1992 1992
 
1993 1993
     if (!ret) {
1994 1994
         if (needs_realloc && avpkt->data) {
1995
-            ret = av_buffer_realloc(&avpkt->buf, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
1995
+            ret = av_buffer_realloc(&avpkt->buf, avpkt->size + AV_INPUT_BUFFER_PADDING_SIZE);
1996 1996
             if (ret >= 0)
1997 1997
                 avpkt->data = avpkt->buf->data;
1998 1998
         }
... ...
@@ -2118,7 +2118,7 @@ int attribute_align_arg avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf
2118 2118
     AVPacket pkt;
2119 2119
     int ret, got_packet = 0;
2120 2120
 
2121
-    if (buf_size < FF_MIN_BUFFER_SIZE) {
2121
+    if (buf_size < AV_INPUT_BUFFER_MIN_SIZE) {
2122 2122
         av_log(avctx, AV_LOG_ERROR, "buffer smaller than minimum size\n");
2123 2123
         return -1;
2124 2124
     }
... ...
@@ -2220,7 +2220,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
2220 2220
             avpkt->pts = avpkt->dts = frame->pts;
2221 2221
 
2222 2222
         if (needs_realloc && avpkt->data) {
2223
-            ret = av_buffer_realloc(&avpkt->buf, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
2223
+            ret = av_buffer_realloc(&avpkt->buf, avpkt->size + AV_INPUT_BUFFER_PADDING_SIZE);
2224 2224
             if (ret >= 0)
2225 2225
                 avpkt->data = avpkt->buf->data;
2226 2226
         }
... ...
@@ -2724,7 +2724,7 @@ static int recode_subtitle(AVCodecContext *avctx,
2724 2724
     inb = inpkt->data;
2725 2725
     inl = inpkt->size;
2726 2726
 
2727
-    if (inl >= INT_MAX / UTF8_MAX_BYTES - FF_INPUT_BUFFER_PADDING_SIZE) {
2727
+    if (inl >= INT_MAX / UTF8_MAX_BYTES - AV_INPUT_BUFFER_PADDING_SIZE) {
2728 2728
         av_log(avctx, AV_LOG_ERROR, "Subtitles packet is too big for recoding\n");
2729 2729
         ret = AVERROR(ENOMEM);
2730 2730
         goto end;
... ...
@@ -2813,7 +2813,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
2813 2813
              * remaining bytes should have already been filled with zeros by the
2814 2814
              * original packet allocation anyway. */
2815 2815
             memset(tmp.data + tmp.size, 0,
2816
-                   FFMIN(avpkt->size - tmp.size, FF_INPUT_BUFFER_PADDING_SIZE));
2816
+                   FFMIN(avpkt->size - tmp.size, AV_INPUT_BUFFER_PADDING_SIZE));
2817 2817
         }
2818 2818
 
2819 2819
         pkt_recoded = tmp;
... ...
@@ -3869,7 +3869,7 @@ int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf)
3869 3869
     /* Note: the string is NUL terminated (so extradata can be read as a
3870 3870
      * string), but the ending character is not accounted in the size (in
3871 3871
      * binary formats you are likely not supposed to mux that character). When
3872
-     * extradata is copied, it is also padded with FF_INPUT_BUFFER_PADDING_SIZE
3872
+     * extradata is copied, it is also padded with AV_INPUT_BUFFER_PADDING_SIZE
3873 3873
      * zeros. */
3874 3874
     avctx->extradata_size = buf->len;
3875 3875
     return 0;
... ...
@@ -143,7 +143,7 @@ static int decode_plane(UtvideoContext *c, int plane_no,
143 143
 
144 144
         memcpy(c->slice_bits, src + slice_data_start + c->slices * 4,
145 145
                slice_size);
146
-        memset(c->slice_bits + slice_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
146
+        memset(c->slice_bits + slice_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
147 147
         c->bdsp.bswap_buf((uint32_t *) c->slice_bits,
148 148
                           (uint32_t *) c->slice_bits,
149 149
                           (slice_data_end - slice_data_start + 3) >> 2);
... ...
@@ -385,7 +385,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
385 385
     }
386 386
 
387 387
     av_fast_malloc(&c->slice_bits, &c->slice_bits_size,
388
-                   max_slice_size + FF_INPUT_BUFFER_PADDING_SIZE);
388
+                   max_slice_size + AV_INPUT_BUFFER_PADDING_SIZE);
389 389
 
390 390
     if (!c->slice_bits) {
391 391
         av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n");
... ...
@@ -157,7 +157,7 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx)
157 157
     avctx->extradata_size = 16;
158 158
 
159 159
     avctx->extradata = av_mallocz(avctx->extradata_size +
160
-                                  FF_INPUT_BUFFER_PADDING_SIZE);
160
+                                  AV_INPUT_BUFFER_PADDING_SIZE);
161 161
 
162 162
     if (!avctx->extradata) {
163 163
         av_log(avctx, AV_LOG_ERROR, "Could not allocate extradata.\n");
... ...
@@ -167,7 +167,7 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx)
167 167
 
168 168
     for (i = 0; i < c->planes; i++) {
169 169
         c->slice_buffer[i] = av_malloc(c->slice_stride * (avctx->height + 2) +
170
-                                       FF_INPUT_BUFFER_PADDING_SIZE);
170
+                                       AV_INPUT_BUFFER_PADDING_SIZE);
171 171
         if (!c->slice_buffer[i]) {
172 172
             av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer 1.\n");
173 173
             utvideo_encode_close(avctx);
... ...
@@ -486,7 +486,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
486 486
             return -1;
487 487
         }
488 488
 
489
-        buf2  = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
489
+        buf2  = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
490 490
         if (!buf2)
491 491
             return AVERROR(ENOMEM);
492 492
 
... ...
@@ -657,7 +657,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
657 657
     //for advanced profile we may need to parse and unescape data
658 658
     if (avctx->codec_id == AV_CODEC_ID_VC1 || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) {
659 659
         int buf_size2 = 0;
660
-        buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
660
+        buf2 = av_mallocz(buf_size + AV_INPUT_BUFFER_PADDING_SIZE);
661 661
         if (!buf2)
662 662
             return AVERROR(ENOMEM);
663 663
 
... ...
@@ -686,7 +686,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
686 686
                     if (!tmp)
687 687
                         goto err;
688 688
                     slices = tmp;
689
-                    slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
689
+                    slices[n_slices].buf = av_mallocz(buf_size + AV_INPUT_BUFFER_PADDING_SIZE);
690 690
                     if (!slices[n_slices].buf)
691 691
                         goto err;
692 692
                     buf_size3 = vc1_unescape_buffer(start + 4, size,
... ...
@@ -711,7 +711,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
711 711
                     if (!tmp)
712 712
                         goto err;
713 713
                     slices = tmp;
714
-                    slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
714
+                    slices[n_slices].buf = av_mallocz(buf_size + AV_INPUT_BUFFER_PADDING_SIZE);
715 715
                     if (!slices[n_slices].buf)
716 716
                         goto err;
717 717
                     buf_size3 = vc1_unescape_buffer(start + 4, size,
... ...
@@ -740,7 +740,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
740 740
                 if (!tmp)
741 741
                     goto err;
742 742
                 slices = tmp;
743
-                slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
743
+                slices[n_slices].buf = av_mallocz(buf_size + AV_INPUT_BUFFER_PADDING_SIZE);
744 744
                 if (!slices[n_slices].buf)
745 745
                     goto err;
746 746
                 buf_size3 = vc1_unescape_buffer(divider + 4, buf + buf_size - divider - 4, slices[n_slices].buf);
... ...
@@ -299,7 +299,7 @@ static float wv_get_value_float(WavpackFrameContext *s, uint32_t *crc, int S)
299 299
         const int max_bits  = 1 + 23 + 8 + 1;
300 300
         const int left_bits = get_bits_left(&s->gb_extra_bits);
301 301
 
302
-        if (left_bits + 8 * FF_INPUT_BUFFER_PADDING_SIZE < max_bits)
302
+        if (left_bits + 8 * AV_INPUT_BUFFER_PADDING_SIZE < max_bits)
303 303
             return 0.0;
304 304
     }
305 305
 
... ...
@@ -120,7 +120,7 @@ typedef struct WMACodecContext {
120 120
     /* output buffer for one frame and the last for IMDCT windowing */
121 121
     DECLARE_ALIGNED(32, float, frame_out)[MAX_CHANNELS][BLOCK_MAX_SIZE * 2];
122 122
     /* last frame info */
123
-    uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; /* padding added */
123
+    uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; /* padding added */
124 124
     int last_bitoffset;
125 125
     int last_superframe_len;
126 126
     float noise_table[NOISE_TAB_SIZE];
... ...
@@ -854,7 +854,7 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data,
854 854
                 *q++ = get_bits (&s->gb, 8);
855 855
                 len --;
856 856
             }
857
-            memset(q, 0, FF_INPUT_BUFFER_PADDING_SIZE);
857
+            memset(q, 0, AV_INPUT_BUFFER_PADDING_SIZE);
858 858
 
859 859
             s->last_superframe_len += 8*buf_size - 8;
860 860
 //             s->reset_block_lengths = 1; //XXX is this needed ?
... ...
@@ -893,7 +893,7 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data,
893 893
             }
894 894
             if (len > 0)
895 895
                 *q++ = (get_bits) (&s->gb, len) << (8 - len);
896
-            memset(q, 0, FF_INPUT_BUFFER_PADDING_SIZE);
896
+            memset(q, 0, AV_INPUT_BUFFER_PADDING_SIZE);
897 897
 
898 898
             /* XXX: bit_offset bits into last frame */
899 899
             init_get_bits(&s->gb, s->last_superframe,
... ...
@@ -72,7 +72,7 @@ typedef struct WmallDecodeCtx {
72 72
     AVCodecContext  *avctx;
73 73
     AVFrame         *frame;
74 74
     LLAudDSPContext dsp;                           ///< accelerated DSP functions
75
-    uint8_t         frame_data[MAX_FRAMESIZE + FF_INPUT_BUFFER_PADDING_SIZE];  ///< compressed frame data
75
+    uint8_t         frame_data[MAX_FRAMESIZE + AV_INPUT_BUFFER_PADDING_SIZE];  ///< compressed frame data
76 76
     PutBitContext   pb;                             ///< context for filling the frame_data buffer
77 77
 
78 78
     /* frame size dependent frame information (set during initialization) */
... ...
@@ -173,7 +173,7 @@ typedef struct WMAProDecodeCtx {
173 173
     AVCodecContext*  avctx;                         ///< codec context for av_log
174 174
     AVFloatDSPContext *fdsp;
175 175
     uint8_t          frame_data[MAX_FRAMESIZE +
176
-                      FF_INPUT_BUFFER_PADDING_SIZE];///< compressed frame data
176
+                      AV_INPUT_BUFFER_PADDING_SIZE];///< compressed frame data
177 177
     PutBitContext    pb;                            ///< context for filling the frame_data buffer
178 178
     FFTContext       mdct_ctx[WMAPRO_BLOCK_SIZES];  ///< MDCT context per block size
179 179
     DECLARE_ALIGNED(32, float, tmp)[WMAPRO_BLOCK_MAX_SIZE]; ///< IMDCT output buffer
... ...
@@ -203,7 +203,7 @@ typedef struct WMAVoiceContext {
203 203
                                   ///< to #wmavoice_decode_packet() (since
204 204
                                   ///< they're part of the previous superframe)
205 205
 
206
-    uint8_t sframe_cache[SFRAME_CACHE_MAXSIZE + FF_INPUT_BUFFER_PADDING_SIZE];
206
+    uint8_t sframe_cache[SFRAME_CACHE_MAXSIZE + AV_INPUT_BUFFER_PADDING_SIZE];
207 207
                                   ///< cache for superframe data split over
208 208
                                   ///< multiple packets
209 209
     int sframe_cache_size;        ///< set to >0 if we have data from an
... ...
@@ -62,7 +62,7 @@ static av_cold int wmv2_encode_init(AVCodecContext *avctx)
62 62
     ff_wmv2_common_init(w);
63 63
 
64 64
     avctx->extradata_size = 4;
65
-    avctx->extradata      = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
65
+    avctx->extradata      = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
66 66
     if (!avctx->extradata)
67 67
         return AVERROR(ENOMEM);
68 68
 
... ...
@@ -73,12 +73,12 @@ static int decode_frame(AVCodecContext *avctx,
73 73
         return AVERROR_INVALIDDATA;
74 74
     }
75 75
 
76
-    rbuf = av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
76
+    rbuf = av_malloc(buf_size + AV_INPUT_BUFFER_PADDING_SIZE);
77 77
     if (!rbuf) {
78 78
         av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n");
79 79
         return AVERROR(ENOMEM);
80 80
     }
81
-    memset(rbuf + buf_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
81
+    memset(rbuf + buf_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
82 82
 
83 83
     if ((ret = ff_get_buffer(avctx, p, 0)) < 0) {
84 84
         av_free(rbuf);
... ...
@@ -39,7 +39,7 @@ cextern pb_2
39 39
 SECTION_TEXT
40 40
 
41 41
 %define MAX_PB_SIZE  64
42
-%define PADDING_SIZE 32 ; FF_INPUT_BUFFER_PADDING_SIZE
42
+%define PADDING_SIZE 32 ; AV_INPUT_BUFFER_PADDING_SIZE
43 43
 
44 44
 ;******************************************************************************
45 45
 ;SAO Band Filter
... ...
@@ -975,7 +975,7 @@ dshow_add_device(AVFormatContext *avctx,
975 975
             codec->codec_id = AV_CODEC_ID_RAWVIDEO;
976 976
             if (bih->biCompression == BI_RGB || bih->biCompression == BI_BITFIELDS) {
977 977
                 codec->bits_per_coded_sample = bih->biBitCount;
978
-                codec->extradata = av_malloc(9 + FF_INPUT_BUFFER_PADDING_SIZE);
978
+                codec->extradata = av_malloc(9 + AV_INPUT_BUFFER_PADDING_SIZE);
979 979
                 if (codec->extradata) {
980 980
                     codec->extradata_size = 9;
981 981
                     memcpy(codec->extradata, "BottomUp", 9);
... ...
@@ -396,7 +396,7 @@ static int vfw_read_header(AVFormatContext *s)
396 396
         codec->codec_id = AV_CODEC_ID_RAWVIDEO;
397 397
         if(biCompression == BI_RGB) {
398 398
             codec->bits_per_coded_sample = biBitCount;
399
-            codec->extradata = av_malloc(9 + FF_INPUT_BUFFER_PADDING_SIZE);
399
+            codec->extradata = av_malloc(9 + AV_INPUT_BUFFER_PADDING_SIZE);
400 400
             if (codec->extradata) {
401 401
                 codec->extradata_size = 9;
402 402
                 memcpy(codec->extradata, "BottomUp", 9);
... ...
@@ -231,7 +231,7 @@ static int xcbgrab_frame_shm(AVFormatContext *s, AVPacket *pkt)
231 231
     xcb_shm_get_image_reply_t *img;
232 232
     xcb_drawable_t drawable = c->screen->root;
233 233
     uint8_t *data;
234
-    int size = c->frame_size + FF_INPUT_BUFFER_PADDING_SIZE;
234
+    int size = c->frame_size + AV_INPUT_BUFFER_PADDING_SIZE;
235 235
     int id   = shmget(IPC_PRIVATE, size, IPC_CREAT | 0777);
236 236
     xcb_generic_error_t *e = NULL;
237 237
 
... ...
@@ -111,7 +111,7 @@ static int parse_vtrk(AVFormatContext *s,
111 111
     st->codec->codec_type     = AVMEDIA_TYPE_VIDEO;
112 112
     st->codec->codec_id       = AV_CODEC_ID_4XM;
113 113
 
114
-    st->codec->extradata      = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE);
114
+    st->codec->extradata      = av_mallocz(4 + AV_INPUT_BUFFER_PADDING_SIZE);
115 115
     if (!st->codec->extradata)
116 116
         return AVERROR(ENOMEM);
117 117
     st->codec->extradata_size = 4;
... ...
@@ -133,7 +133,7 @@ static int read_header(AVFormatContext *s)
133 133
 
134 134
     /* color cycling and palette data */
135 135
     st->codec->extradata_size = 16*8 + 4*256;
136
-    st->codec->extradata      = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
136
+    st->codec->extradata      = av_mallocz(st->codec->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
137 137
     if (!st->codec->extradata) {
138 138
         return AVERROR(ENOMEM);
139 139
     }
... ...
@@ -55,7 +55,7 @@ static int ape_tag_read_field(AVFormatContext *s)
55 55
         av_log(s, AV_LOG_WARNING, "Invalid APE tag key '%s'.\n", key);
56 56
         return -1;
57 57
     }
58
-    if (size > INT32_MAX - FF_INPUT_BUFFER_PADDING_SIZE) {
58
+    if (size > INT32_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
59 59
         av_log(s, AV_LOG_ERROR, "APE tag size too large.\n");
60 60
         return AVERROR_INVALIDDATA;
61 61
     }
... ...
@@ -132,7 +132,7 @@ static int append_extradata(AVCodecContext *s, AVIOContext *pb, int len)
132 132
         return AVERROR_INVALIDDATA;
133 133
 
134 134
     new_size = previous_size + len;
135
-    new_extradata = av_realloc(s->extradata, new_size + FF_INPUT_BUFFER_PADDING_SIZE);
135
+    new_extradata = av_realloc(s->extradata, new_size + AV_INPUT_BUFFER_PADDING_SIZE);
136 136
     if (!new_extradata)
137 137
         return AVERROR(ENOMEM);
138 138
     s->extradata = new_extradata;
... ...
@@ -178,7 +178,7 @@ static int apng_read_header(AVFormatContext *s)
178 178
         return ret;
179 179
 
180 180
     /* extradata will contain every chunk up to the first fcTL (excluded) */
181
-    st->codec->extradata = av_malloc(len + 12 + FF_INPUT_BUFFER_PADDING_SIZE);
181
+    st->codec->extradata = av_malloc(len + 12 + AV_INPUT_BUFFER_PADDING_SIZE);
182 182
     if (!st->codec->extradata)
183 183
         return AVERROR(ENOMEM);
184 184
     st->codec->extradata_size = len + 12;
... ...
@@ -517,7 +517,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
517 517
         if (sizeX > 40) {
518 518
             st->codec->extradata_size = ffio_limit(pb, sizeX - 40);
519 519
             st->codec->extradata      = av_mallocz(st->codec->extradata_size +
520
-                                                   FF_INPUT_BUFFER_PADDING_SIZE);
520
+                                                   AV_INPUT_BUFFER_PADDING_SIZE);
521 521
             if (!st->codec->extradata)
522 522
                 return AVERROR(ENOMEM);
523 523
             avio_read(pb, st->codec->extradata, st->codec->extradata_size);
... ...
@@ -1394,12 +1394,12 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
1394 1394
                 } else {
1395 1395
                     /* packet descrambling */
1396 1396
                     AVBufferRef *buf = av_buffer_alloc(asf_st->pkt.size +
1397
-                                                       FF_INPUT_BUFFER_PADDING_SIZE);
1397
+                                                       AV_INPUT_BUFFER_PADDING_SIZE);
1398 1398
                     if (buf) {
1399 1399
                         uint8_t *newdata = buf->data;
1400 1400
                         int offset = 0;
1401 1401
                         memset(newdata + asf_st->pkt.size, 0,
1402
-                               FF_INPUT_BUFFER_PADDING_SIZE);
1402
+                               AV_INPUT_BUFFER_PADDING_SIZE);
1403 1403
                         while (offset < asf_st->pkt.size) {
1404 1404
                             int off = offset / asf_st->ds_chunk_size;
1405 1405
                             int row = off / asf_st->ds_span;
... ...
@@ -674,12 +674,12 @@ static int parse_video_info(AVIOContext *pb, AVStream *st)
674 674
         int ret;
675 675
         st->codec->extradata_size  = size - BMP_HEADER_SIZE;
676 676
         if (!(st->codec->extradata = av_malloc(st->codec->extradata_size +
677
-                                               FF_INPUT_BUFFER_PADDING_SIZE))) {
677
+                                               AV_INPUT_BUFFER_PADDING_SIZE))) {
678 678
             st->codec->extradata_size = 0;
679 679
             return AVERROR(ENOMEM);
680 680
         }
681 681
         memset(st->codec->extradata + st->codec->extradata_size , 0,
682
-               FF_INPUT_BUFFER_PADDING_SIZE);
682
+               AV_INPUT_BUFFER_PADDING_SIZE);
683 683
         if ((ret = avio_read(pb, st->codec->extradata,
684 684
                              st->codec->extradata_size)) < 0)
685 685
             return ret;
... ...
@@ -180,7 +180,7 @@ int ff_avc_write_annexb_extradata(const uint8_t *in, uint8_t **buf, int *size)
180 180
     if (11 + sps_size + pps_size > *size)
181 181
         return AVERROR_INVALIDDATA;
182 182
     out_size = 8 + sps_size + pps_size;
183
-    out = av_mallocz(out_size + FF_INPUT_BUFFER_PADDING_SIZE);
183
+    out = av_mallocz(out_size + AV_INPUT_BUFFER_PADDING_SIZE);
184 184
     if (!out)
185 185
         return AVERROR(ENOMEM);
186 186
     AV_WB32(&out[0], 0x00000001);
... ...
@@ -823,7 +823,7 @@ static int avi_read_header(AVFormatContext *s)
823 823
                         st->codec->extradata_size += 9;
824 824
                         if ((ret = av_reallocp(&st->codec->extradata,
825 825
                                                st->codec->extradata_size +
826
-                                               FF_INPUT_BUFFER_PADDING_SIZE)) < 0) {
826
+                                               AV_INPUT_BUFFER_PADDING_SIZE)) < 0) {
827 827
                             st->codec->extradata_size = 0;
828 828
                             return ret;
829 829
                         } else
... ...
@@ -585,7 +585,7 @@ int avio_open_dyn_buf(AVIOContext **s);
585 585
 /**
586 586
  * Return the written size and a pointer to the buffer. The buffer
587 587
  * must be freed with av_free().
588
- * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer.
588
+ * Padding of AV_INPUT_BUFFER_PADDING_SIZE is added to the buffer.
589 589
  *
590 590
  * @param s IO context
591 591
  * @param pbuffer pointer to a byte buffer
... ...
@@ -1130,7 +1130,7 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
1130 1130
 {
1131 1131
     DynBuffer *d;
1132 1132
     int size;
1133
-    static const char padbuf[FF_INPUT_BUFFER_PADDING_SIZE] = {0};
1133
+    static const char padbuf[AV_INPUT_BUFFER_PADDING_SIZE] = {0};
1134 1134
     int padding = 0;
1135 1135
 
1136 1136
     if (!s) {
... ...
@@ -1141,7 +1141,7 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
1141 1141
     /* don't attempt to pad fixed-size packet buffers */
1142 1142
     if (!s->max_packet_size) {
1143 1143
         avio_write(s, padbuf, sizeof(padbuf));
1144
-        padding = FF_INPUT_BUFFER_PADDING_SIZE;
1144
+        padding = AV_INPUT_BUFFER_PADDING_SIZE;
1145 1145
     }
1146 1146
 
1147 1147
     avio_flush(s);
... ...
@@ -101,7 +101,7 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size)
101 101
     AVIOContext *pb = s->pb;
102 102
     AVStream *st      = s->streams[0];
103 103
 
104
-    if (size < 0 || size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE)
104
+    if (size < 0 || size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
105 105
         return -1;
106 106
 
107 107
     if (st->codec->codec_id == AV_CODEC_ID_AAC) {
... ...
@@ -34,7 +34,7 @@ static int dts_probe(AVProbeData *p)
34 34
     int markers[4*16] = {0};
35 35
     int sum, max, i;
36 36
     int64_t diff = 0;
37
-    uint8_t hdr[12 + FF_INPUT_BUFFER_PADDING_SIZE] = { 0 };
37
+    uint8_t hdr[12 + AV_INPUT_BUFFER_PADDING_SIZE] = { 0 };
38 38
 
39 39
     buf = p->buf + FFMIN(4096, p->buf_size);
40 40
 
... ...
@@ -108,10 +108,10 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size)
108 108
             ret = AVERROR_INVALIDDATA;
109 109
         goto fail;
110 110
     }
111
-    if (!(data = av_buffer_alloc(len + FF_INPUT_BUFFER_PADDING_SIZE))) {
111
+    if (!(data = av_buffer_alloc(len + AV_INPUT_BUFFER_PADDING_SIZE))) {
112 112
         RETURN_ERROR(AVERROR(ENOMEM));
113 113
     }
114
-    memset(data->data + len, 0, FF_INPUT_BUFFER_PADDING_SIZE);
114
+    memset(data->data + len, 0, AV_INPUT_BUFFER_PADDING_SIZE);
115 115
     if (avio_read(pb, data->data, len) != len) {
116 116
         av_log(s, AV_LOG_ERROR, "Error reading attached picture data.\n");
117 117
         if (s->error_recognition & AV_EF_EXPLODE)
... ...
@@ -58,7 +58,7 @@ static int flac_read_header(AVFormatContext *s)
58 58
         case FLAC_METADATA_TYPE_CUESHEET:
59 59
         case FLAC_METADATA_TYPE_PICTURE:
60 60
         case FLAC_METADATA_TYPE_VORBIS_COMMENT:
61
-            buffer = av_mallocz(metadata_size + FF_INPUT_BUFFER_PADDING_SIZE);
61
+            buffer = av_mallocz(metadata_size + AV_INPUT_BUFFER_PADDING_SIZE);
62 62
             if (!buffer) {
63 63
                 return AVERROR(ENOMEM);
64 64
             }
... ...
@@ -654,7 +654,7 @@ static int flv_queue_extradata(FLVContext *flv, AVIOContext *pb, int stream,
654 654
 {
655 655
     av_free(flv->new_extradata[stream]);
656 656
     flv->new_extradata[stream] = av_mallocz(size +
657
-                                            FF_INPUT_BUFFER_PADDING_SIZE);
657
+                                            AV_INPUT_BUFFER_PADDING_SIZE);
658 658
     if (!flv->new_extradata[stream])
659 659
         return AVERROR(ENOMEM);
660 660
     flv->new_extradata_size[stream] = size;
... ...
@@ -644,7 +644,7 @@ static uint8_t *nal_unit_extract_rbsp(const uint8_t *src, uint32_t src_len,
644 644
     uint8_t *dst;
645 645
     uint32_t i, len;
646 646
 
647
-    dst = av_malloc(src_len + FF_INPUT_BUFFER_PADDING_SIZE);
647
+    dst = av_malloc(src_len + AV_INPUT_BUFFER_PADDING_SIZE);
648 648
     if (!dst)
649 649
         return NULL;
650 650
 
... ...
@@ -752,7 +752,7 @@ static int id3_has_changed_values(struct playlist *pls, AVDictionary *metadata,
752 752
 
753 753
     if (apic) {
754 754
         int size = pls->ctx->streams[1]->attached_pic.size;
755
-        if (size != apic->buf->size - FF_INPUT_BUFFER_PADDING_SIZE)
755
+        if (size != apic->buf->size - AV_INPUT_BUFFER_PADDING_SIZE)
756 756
             return 1;
757 757
 
758 758
         if (memcmp(apic->buf->data, pls->ctx->streams[1]->attached_pic.data, size) != 0)
... ...
@@ -605,10 +605,10 @@ static void read_apic(AVFormatContext *s, AVIOContext *pb, int taglen,
605 605
         goto fail;
606 606
     }
607 607
 
608
-    apic->buf = av_buffer_alloc(taglen + FF_INPUT_BUFFER_PADDING_SIZE);
608
+    apic->buf = av_buffer_alloc(taglen + AV_INPUT_BUFFER_PADDING_SIZE);
609 609
     if (!apic->buf || !taglen || avio_read(pb, apic->buf->data, taglen) != taglen)
610 610
         goto fail;
611
-    memset(apic->buf->data + taglen, 0, FF_INPUT_BUFFER_PADDING_SIZE);
611
+    memset(apic->buf->data + taglen, 0, AV_INPUT_BUFFER_PADDING_SIZE);
612 612
 
613 613
     new_extra->tag  = "APIC";
614 614
     new_extra->data = apic;
... ...
@@ -1105,7 +1105,7 @@ int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta **extra_meta)
1105 1105
         av_init_packet(&st->attached_pic);
1106 1106
         st->attached_pic.buf          = apic->buf;
1107 1107
         st->attached_pic.data         = apic->buf->data;
1108
-        st->attached_pic.size         = apic->buf->size - FF_INPUT_BUFFER_PADDING_SIZE;
1108
+        st->attached_pic.size         = apic->buf->size - AV_INPUT_BUFFER_PADDING_SIZE;
1109 1109
         st->attached_pic.stream_index = st->index;
1110 1110
         st->attached_pic.flags       |= AV_PKT_FLAG_KEY;
1111 1111
 
... ...
@@ -455,7 +455,7 @@ static int iff_read_header(AVFormatContext *s)
455 455
                  return AVERROR_INVALIDDATA;
456 456
             }
457 457
             st->codec->extradata_size = data_size + IFF_EXTRA_VIDEO_SIZE;
458
-            st->codec->extradata      = av_malloc(data_size + IFF_EXTRA_VIDEO_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
458
+            st->codec->extradata      = av_malloc(data_size + IFF_EXTRA_VIDEO_SIZE + AV_INPUT_BUFFER_PADDING_SIZE);
459 459
             if (!st->codec->extradata)
460 460
                 return AVERROR(ENOMEM);
461 461
             if (avio_read(pb, st->codec->extradata + IFF_EXTRA_VIDEO_SIZE, data_size) < 0)
... ...
@@ -682,7 +682,7 @@ static int iff_read_header(AVFormatContext *s)
682 682
 
683 683
         if (!st->codec->extradata) {
684 684
             st->codec->extradata_size = IFF_EXTRA_VIDEO_SIZE;
685
-            st->codec->extradata      = av_malloc(IFF_EXTRA_VIDEO_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
685
+            st->codec->extradata      = av_malloc(IFF_EXTRA_VIDEO_SIZE + AV_INPUT_BUFFER_PADDING_SIZE);
686 686
             if (!st->codec->extradata)
687 687
                 return AVERROR(ENOMEM);
688 688
         }
... ...
@@ -449,7 +449,7 @@ uint8_t *ff_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type,
449 449
                                  int size);
450 450
 
451 451
 /**
452
- * Allocate extradata with additional FF_INPUT_BUFFER_PADDING_SIZE at end
452
+ * Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end
453 453
  * which is always set to 0.
454 454
  *
455 455
  * @param size size of extradata
... ...
@@ -458,7 +458,7 @@ uint8_t *ff_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type,
458 458
 int ff_alloc_extradata(AVCodecContext *avctx, int size);
459 459
 
460 460
 /**
461
- * Allocate extradata with additional FF_INPUT_BUFFER_PADDING_SIZE at end
461
+ * Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end
462 462
  * which is always set to 0 and fill it from pb.
463 463
  *
464 464
  * @param size size of extradata
... ...
@@ -172,7 +172,7 @@ static int jacosub_read_header(AVFormatContext *s)
172 172
 
173 173
     jacosub->timeres = 30;
174 174
 
175
-    av_bprint_init(&header, 1024+FF_INPUT_BUFFER_PADDING_SIZE, 4096);
175
+    av_bprint_init(&header, 1024+AV_INPUT_BUFFER_PADDING_SIZE, 4096);
176 176
 
177 177
     while (!avio_feof(pb)) {
178 178
         int cmd_len;
... ...
@@ -196,7 +196,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
196 196
                     return ret;
197 197
                 if (ret < size) {
198 198
                     memset(pkt->data + JV_PREAMBLE_SIZE + ret, 0,
199
-                           FF_INPUT_BUFFER_PADDING_SIZE);
199
+                           AV_INPUT_BUFFER_PADDING_SIZE);
200 200
                     pkt->flags |= AV_PKT_FLAG_CORRUPT;
201 201
                 }
202 202
                 pkt->size         = ret + JV_PREAMBLE_SIZE;
... ...
@@ -1853,7 +1853,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
1853 1853
         } else if (codec_id == AV_CODEC_ID_AAC && !track->codec_priv.size) {
1854 1854
             int profile = matroska_aac_profile(track->codec_id);
1855 1855
             int sri     = matroska_aac_sri(track->audio.samplerate);
1856
-            extradata   = av_mallocz(5 + FF_INPUT_BUFFER_PADDING_SIZE);
1856
+            extradata   = av_mallocz(5 + AV_INPUT_BUFFER_PADDING_SIZE);
1857 1857
             if (!extradata)
1858 1858
                 return AVERROR(ENOMEM);
1859 1859
             extradata[0] = (profile << 3) | ((sri & 0x0E) >> 1);
... ...
@@ -1866,13 +1866,13 @@ static int matroska_parse_tracks(AVFormatContext *s)
1866 1866
                 extradata_size = 5;
1867 1867
             } else
1868 1868
                 extradata_size = 2;
1869
-        } else if (codec_id == AV_CODEC_ID_ALAC && track->codec_priv.size && track->codec_priv.size < INT_MAX - 12 - FF_INPUT_BUFFER_PADDING_SIZE) {
1869
+        } else if (codec_id == AV_CODEC_ID_ALAC && track->codec_priv.size && track->codec_priv.size < INT_MAX - 12 - AV_INPUT_BUFFER_PADDING_SIZE) {
1870 1870
             /* Only ALAC's magic cookie is stored in Matroska's track headers.
1871 1871
              * Create the "atom size", "tag", and "tag version" fields the
1872 1872
              * decoder expects manually. */
1873 1873
             extradata_size = 12 + track->codec_priv.size;
1874 1874
             extradata      = av_mallocz(extradata_size +
1875
-                                        FF_INPUT_BUFFER_PADDING_SIZE);
1875
+                                        AV_INPUT_BUFFER_PADDING_SIZE);
1876 1876
             if (!extradata)
1877 1877
                 return AVERROR(ENOMEM);
1878 1878
             AV_WB32(extradata, extradata_size);
... ...
@@ -1882,7 +1882,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
1882 1882
                    track->codec_priv.size);
1883 1883
         } else if (codec_id == AV_CODEC_ID_TTA) {
1884 1884
             extradata_size = 30;
1885
-            extradata      = av_mallocz(extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
1885
+            extradata      = av_mallocz(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
1886 1886
             if (!extradata)
1887 1887
                 return AVERROR(ENOMEM);
1888 1888
             ffio_init_context(&b, extradata, extradata_size, 1,
... ...
@@ -1246,14 +1246,14 @@ static int mov_read_fiel(MOVContext *c, AVIOContext *pb, MOVAtom atom)
1246 1246
 static int mov_realloc_extradata(AVCodecContext *codec, MOVAtom atom)
1247 1247
 {
1248 1248
     int err = 0;
1249
-    uint64_t size = (uint64_t)codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE;
1249
+    uint64_t size = (uint64_t)codec->extradata_size + atom.size + 8 + AV_INPUT_BUFFER_PADDING_SIZE;
1250 1250
     if (size > INT_MAX || (uint64_t)atom.size > INT_MAX)
1251 1251
         return AVERROR_INVALIDDATA;
1252 1252
     if ((err = av_reallocp(&codec->extradata, size)) < 0) {
1253 1253
         codec->extradata_size = 0;
1254 1254
         return err;
1255 1255
     }
1256
-    codec->extradata_size = size - FF_INPUT_BUFFER_PADDING_SIZE;
1256
+    codec->extradata_size = size - AV_INPUT_BUFFER_PADDING_SIZE;
1257 1257
     return 0;
1258 1258
 }
1259 1259
 
... ...
@@ -1275,7 +1275,7 @@ static int64_t mov_read_atom_into_extradata(MOVContext *c, AVIOContext *pb, MOVA
1275 1275
         codec->extradata_size -= atom.size - err;
1276 1276
         result = err;
1277 1277
     }
1278
-    memset(buf + 8 + err, 0, FF_INPUT_BUFFER_PADDING_SIZE);
1278
+    memset(buf + 8 + err, 0, AV_INPUT_BUFFER_PADDING_SIZE);
1279 1279
     return result;
1280 1280
 }
1281 1281
 
... ...
@@ -1899,7 +1899,7 @@ static int mov_rewrite_dvd_sub_extradata(AVStream *st)
1899 1899
 
1900 1900
     av_freep(&st->codec->extradata);
1901 1901
     st->codec->extradata_size = 0;
1902
-    st->codec->extradata = av_mallocz(strlen(buf) + FF_INPUT_BUFFER_PADDING_SIZE);
1902
+    st->codec->extradata = av_mallocz(strlen(buf) + AV_INPUT_BUFFER_PADDING_SIZE);
1903 1903
     if (!st->codec->extradata)
1904 1904
         return AVERROR(ENOMEM);
1905 1905
     st->codec->extradata_size = strlen(buf);
... ...
@@ -2336,7 +2336,7 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom)
2336 2336
 
2337 2337
     num_bytes = (entries*field_size+4)>>3;
2338 2338
 
2339
-    buf = av_malloc(num_bytes+FF_INPUT_BUFFER_PADDING_SIZE);
2339
+    buf = av_malloc(num_bytes+AV_INPUT_BUFFER_PADDING_SIZE);
2340 2340
     if (!buf) {
2341 2341
         av_freep(&sc->sample_sizes);
2342 2342
         return AVERROR(ENOMEM);
... ...
@@ -733,7 +733,7 @@ static int mov_write_dvc1_structs(MOVTrack *track, uint8_t *buf)
733 733
                "dvc1 atom. Set the delay_moov flag to fix this.\n");
734 734
     }
735 735
 
736
-    unescaped = av_mallocz(track->vos_len + FF_INPUT_BUFFER_PADDING_SIZE);
736
+    unescaped = av_mallocz(track->vos_len + AV_INPUT_BUFFER_PADDING_SIZE);
737 737
     if (!unescaped)
738 738
         return AVERROR(ENOMEM);
739 739
     start = find_next_marker(track->vos_data, end);
... ...
@@ -154,7 +154,7 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
154 154
         av_log(s, AV_LOG_ERROR, "Bad seek table size\n");
155 155
         return;
156 156
     }
157
-    if(!(buf = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE)))
157
+    if(!(buf = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE)))
158 158
         return;
159 159
     ret = avio_read(s->pb, buf, size);
160 160
     if (ret != size) {
... ...
@@ -162,7 +162,7 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
162 162
         av_free(buf);
163 163
         return;
164 164
     }
165
-    memset(buf+size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
165
+    memset(buf+size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
166 166
 
167 167
     init_get_bits(&gb, buf, size * 8);
168 168
     size = gb_get_v(&gb);
... ...
@@ -871,7 +871,7 @@ static void new_pes_packet(PESContext *pes, AVPacket *pkt)
871 871
         av_log(pes->stream, AV_LOG_WARNING, "PES packet size mismatch\n");
872 872
         pes->flags |= AV_PKT_FLAG_CORRUPT;
873 873
     }
874
-    memset(pkt->data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
874
+    memset(pkt->data + pkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
875 875
 
876 876
     // Separate out the AC3 substream from an HDMV combined TrueHD/AC3 PID
877 877
     if (pes->sub_st && pes->stream_type == 0x83 && pes->extended_stream_id == 0x76)
... ...
@@ -903,8 +903,8 @@ static int read_sl_header(PESContext *pes, SLConfigDescr *sl,
903 903
     int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0;
904 904
     int dts_flag = -1, cts_flag = -1;
905 905
     int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE;
906
-    uint8_t buf_padded[128 + FF_INPUT_BUFFER_PADDING_SIZE];
907
-    int buf_padded_size = FFMIN(buf_size, sizeof(buf_padded) - FF_INPUT_BUFFER_PADDING_SIZE);
906
+    uint8_t buf_padded[128 + AV_INPUT_BUFFER_PADDING_SIZE];
907
+    int buf_padded_size = FFMIN(buf_size, sizeof(buf_padded) - AV_INPUT_BUFFER_PADDING_SIZE);
908 908
 
909 909
     memcpy(buf_padded, buf, buf_padded_size);
910 910
 
... ...
@@ -1036,7 +1036,7 @@ static int mpegts_push_data(MpegTSFilter *filter,
1036 1036
 
1037 1037
                     /* allocate pes buffer */
1038 1038
                     pes->buffer = av_buffer_alloc(pes->total_size +
1039
-                                                  FF_INPUT_BUFFER_PADDING_SIZE);
1039
+                                                  AV_INPUT_BUFFER_PADDING_SIZE);
1040 1040
                     if (!pes->buffer)
1041 1041
                         return AVERROR(ENOMEM);
1042 1042
 
... ...
@@ -1194,7 +1194,7 @@ skip:
1194 1194
                     new_pes_packet(pes, ts->pkt);
1195 1195
                     pes->total_size = MAX_PES_PAYLOAD;
1196 1196
                     pes->buffer = av_buffer_alloc(pes->total_size +
1197
-                                                  FF_INPUT_BUFFER_PADDING_SIZE);
1197
+                                                  AV_INPUT_BUFFER_PADDING_SIZE);
1198 1198
                     if (!pes->buffer)
1199 1199
                         return AVERROR(ENOMEM);
1200 1200
                     ts->stop_parse = 1;
... ...
@@ -1793,7 +1793,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
1793 1793
             ext_desc_tag == 0x80) { /* User defined (provisional Opus) */
1794 1794
             if (!st->codec->extradata) {
1795 1795
                 st->codec->extradata = av_mallocz(sizeof(opus_default_extradata) +
1796
-                                                  FF_INPUT_BUFFER_PADDING_SIZE);
1796
+                                                  AV_INPUT_BUFFER_PADDING_SIZE);
1797 1797
                 if (!st->codec->extradata)
1798 1798
                     return AVERROR(ENOMEM);
1799 1799
 
... ...
@@ -2382,7 +2382,7 @@ static void finished_reading_packet(AVFormatContext *s, int raw_packet_size)
2382 2382
 static int handle_packets(MpegTSContext *ts, int64_t nb_packets)
2383 2383
 {
2384 2384
     AVFormatContext *s = ts->stream;
2385
-    uint8_t packet[TS_PACKET_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
2385
+    uint8_t packet[TS_PACKET_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
2386 2386
     const uint8_t *data;
2387 2387
     int64_t packet_num;
2388 2388
     int ret = 0;
... ...
@@ -2409,7 +2409,7 @@ static int handle_packets(MpegTSContext *ts, int64_t nb_packets)
2409 2409
 
2410 2410
     ts->stop_parse = 0;
2411 2411
     packet_num = 0;
2412
-    memset(packet + TS_PACKET_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE);
2412
+    memset(packet + TS_PACKET_SIZE, 0, AV_INPUT_BUFFER_PADDING_SIZE);
2413 2413
     for (;;) {
2414 2414
         packet_num++;
2415 2415
         if (nb_packets != 0 && packet_num >= nb_packets ||
... ...
@@ -111,7 +111,7 @@ static int mxg_update_cache(AVFormatContext *s, unsigned int cache_size)
111 111
     soi_pos = mxg->soi_ptr - mxg->buffer;
112 112
     buffer = av_fast_realloc(mxg->buffer, &mxg->buffer_size,
113 113
                              current_pos + cache_size +
114
-                             FF_INPUT_BUFFER_PADDING_SIZE);
114
+                             AV_INPUT_BUFFER_PADDING_SIZE);
115 115
     if (!buffer)
116 116
         return AVERROR(ENOMEM);
117 117
     mxg->buffer = buffer;
... ...
@@ -82,7 +82,7 @@ static int ogg_save(AVFormatContext *s)
82 82
 
83 83
     for (i = 0; i < ogg->nstreams; i++) {
84 84
         struct ogg_stream *os = ogg->streams + i;
85
-        os->buf = av_mallocz(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE);
85
+        os->buf = av_mallocz(os->bufsize + AV_INPUT_BUFFER_PADDING_SIZE);
86 86
         if (os->buf)
87 87
             memcpy(os->buf, ost->streams[i].buf, os->bufpos);
88 88
         else
... ...
@@ -263,7 +263,7 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial)
263 263
     memset(os, 0, sizeof(*os));
264 264
     os->serial        = serial;
265 265
     os->bufsize       = DECODER_BUFFER_SIZE;
266
-    os->buf           = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE);
266
+    os->buf           = av_malloc(os->bufsize + AV_INPUT_BUFFER_PADDING_SIZE);
267 267
     os->header        = -1;
268 268
     os->start_granule = OGG_NOGRANULE_VALUE;
269 269
     if (!os->buf)
... ...
@@ -285,7 +285,7 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial)
285 285
 static int ogg_new_buf(struct ogg *ogg, int idx)
286 286
 {
287 287
     struct ogg_stream *os = ogg->streams + idx;
288
-    uint8_t *nb = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE);
288
+    uint8_t *nb = av_malloc(os->bufsize + AV_INPUT_BUFFER_PADDING_SIZE);
289 289
     int size = os->bufpos - os->pstart;
290 290
 
291 291
     if (!nb)
... ...
@@ -424,7 +424,7 @@ static int ogg_read_page(AVFormatContext *s, int *sid)
424 424
     }
425 425
 
426 426
     if (os->bufsize - os->bufpos < size) {
427
-        uint8_t *nb = av_malloc((os->bufsize *= 2) + FF_INPUT_BUFFER_PADDING_SIZE);
427
+        uint8_t *nb = av_malloc((os->bufsize *= 2) + AV_INPUT_BUFFER_PADDING_SIZE);
428 428
         if (!nb)
429 429
             return AVERROR(ENOMEM);
430 430
         memcpy(nb, os->buf, os->bufpos);
... ...
@@ -440,7 +440,7 @@ static int ogg_read_page(AVFormatContext *s, int *sid)
440 440
     os->granule = gp;
441 441
     os->flags   = flags;
442 442
 
443
-    memset(os->buf + os->bufpos, 0, FF_INPUT_BUFFER_PADDING_SIZE);
443
+    memset(os->buf + os->bufpos, 0, AV_INPUT_BUFFER_PADDING_SIZE);
444 444
     if (sid)
445 445
         *sid = idx;
446 446
 
... ...
@@ -102,7 +102,7 @@ ogm_header(AVFormatContext *s, int idx)
102 102
                 size -= 4;
103 103
             }
104 104
             if (size > 52) {
105
-                av_assert0(FF_INPUT_BUFFER_PADDING_SIZE <= 52);
105
+                av_assert0(AV_INPUT_BUFFER_PADDING_SIZE <= 52);
106 106
                 size -= 52;
107 107
                 ff_alloc_extradata(st->codec, size);
108 108
                 bytestream2_get_buffer(&p, st->codec->extradata, st->codec->extradata_size);
... ...
@@ -127,11 +127,11 @@ static int theora_header(AVFormatContext *s, int idx)
127 127
     }
128 128
 
129 129
     if ((err = av_reallocp(&st->codec->extradata,
130
-                           cds + FF_INPUT_BUFFER_PADDING_SIZE)) < 0) {
130
+                           cds + AV_INPUT_BUFFER_PADDING_SIZE)) < 0) {
131 131
         st->codec->extradata_size = 0;
132 132
         return err;
133 133
     }
134
-    memset(st->codec->extradata + cds, 0, FF_INPUT_BUFFER_PADDING_SIZE);
134
+    memset(st->codec->extradata + cds, 0, AV_INPUT_BUFFER_PADDING_SIZE);
135 135
 
136 136
     cdp    = st->codec->extradata + st->codec->extradata_size;
137 137
     *cdp++ = os->psize >> 8;
... ...
@@ -242,7 +242,7 @@ static int fixup_vorbis_headers(AVFormatContext *as,
242 242
         offset += priv->len[i];
243 243
         av_freep(&priv->packet[i]);
244 244
     }
245
-    if ((err = av_reallocp(buf, offset + FF_INPUT_BUFFER_PADDING_SIZE)) < 0)
245
+    if ((err = av_reallocp(buf, offset + AV_INPUT_BUFFER_PADDING_SIZE)) < 0)
246 246
         return err;
247 247
     return offset;
248 248
 }
... ...
@@ -86,7 +86,7 @@ struct PayloadContext {
86 86
     RMStream **rmst;
87 87
     uint8_t *mlti_data;
88 88
     unsigned int mlti_data_size;
89
-    char buffer[RTP_MAX_PACKET_LENGTH + FF_INPUT_BUFFER_PADDING_SIZE];
89
+    char buffer[RTP_MAX_PACKET_LENGTH + AV_INPUT_BUFFER_PADDING_SIZE];
90 90
     int audio_pkt_cnt; /**< remaining audio packets in rmdec */
91 91
 };
92 92
 
... ...
@@ -398,7 +398,7 @@ rdt_parse_b64buf (unsigned int *target_len, const char *p)
398 398
         len -= 2; /* skip embracing " at start/end */
399 399
     }
400 400
     *target_len = len * 3 / 4;
401
-    target = av_mallocz(*target_len + FF_INPUT_BUFFER_PADDING_SIZE);
401
+    target = av_mallocz(*target_len + AV_INPUT_BUFFER_PADDING_SIZE);
402 402
     if (!target)
403 403
         return NULL;
404 404
     av_base64_decode(target, p, *target_len);
... ...
@@ -67,7 +67,7 @@ static int redspark_read_header(AVFormatContext *s)
67 67
         return AVERROR(ENOMEM);
68 68
     codec = st->codec;
69 69
 
70
-    header = av_malloc(HEADER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
70
+    header = av_malloc(HEADER_SIZE + AV_INPUT_BUFFER_PADDING_SIZE);
71 71
     if (!header)
72 72
         return AVERROR(ENOMEM);
73 73
     pbc = header;
... ...
@@ -220,7 +220,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
220 220
                 if (version == 5)
221 221
                     avio_r8(pb);
222 222
                 codecdata_length = avio_rb32(pb);
223
-                if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){
223
+                if(codecdata_length + AV_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){
224 224
                     av_log(s, AV_LOG_ERROR, "codecdata_length too large\n");
225 225
                     return -1;
226 226
                 }
... ...
@@ -250,7 +250,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
250 250
             if (version == 5)
251 251
                 avio_r8(pb);
252 252
             codecdata_length = avio_rb32(pb);
253
-            if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){
253
+            if(codecdata_length + AV_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){
254 254
                 av_log(s, AV_LOG_ERROR, "codecdata_length too large\n");
255 255
                 return -1;
256 256
             }
... ...
@@ -119,7 +119,7 @@ int ff_h264_parse_sprop_parameter_sets(AVFormatContext *s,
119 119
             uint8_t *dest = av_realloc(*data_ptr,
120 120
                                        packet_size + sizeof(start_sequence) +
121 121
                                        *size_ptr +
122
-                                       FF_INPUT_BUFFER_PADDING_SIZE);
122
+                                       AV_INPUT_BUFFER_PADDING_SIZE);
123 123
             if (!dest) {
124 124
                 av_log(s, AV_LOG_ERROR,
125 125
                        "Unable to allocate memory for extradata!\n");
... ...
@@ -132,7 +132,7 @@ int ff_h264_parse_sprop_parameter_sets(AVFormatContext *s,
132 132
             memcpy(dest + *size_ptr + sizeof(start_sequence),
133 133
                    decoded_packet, packet_size);
134 134
             memset(dest + *size_ptr + sizeof(start_sequence) +
135
-                   packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
135
+                   packet_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
136 136
 
137 137
             *size_ptr += sizeof(start_sequence) + packet_size;
138 138
         }
... ...
@@ -152,7 +152,7 @@ static av_cold int hevc_parse_sdp_line(AVFormatContext *ctx, int st_index,
152 152
             codec->extradata_size = hevc_data->vps_size + hevc_data->sps_size +
153 153
                                     hevc_data->pps_size + hevc_data->sei_size;
154 154
             codec->extradata = av_malloc(codec->extradata_size +
155
-                                         FF_INPUT_BUFFER_PADDING_SIZE);
155
+                                         AV_INPUT_BUFFER_PADDING_SIZE);
156 156
             if (!codec->extradata) {
157 157
                 ret = AVERROR(ENOMEM);
158 158
                 codec->extradata_size = 0;
... ...
@@ -166,7 +166,7 @@ static av_cold int hevc_parse_sdp_line(AVFormatContext *ctx, int st_index,
166 166
                 pos += hevc_data->pps_size;
167 167
                 memcpy(codec->extradata + pos, hevc_data->sei, hevc_data->sei_size);
168 168
                 pos += hevc_data->sei_size;
169
-                memset(codec->extradata + pos, 0, FF_INPUT_BUFFER_PADDING_SIZE);
169
+                memset(codec->extradata + pos, 0, AV_INPUT_BUFFER_PADDING_SIZE);
170 170
             }
171 171
 
172 172
             av_freep(&hevc_data->vps);
... ...
@@ -97,7 +97,7 @@ static int parse_fmtp_config(AVStream *st, const char *value)
97 97
     int audio_mux_version, same_time_framing, num_programs, num_layers;
98 98
 
99 99
     /* Pad this buffer, too, to avoid out of bounds reads with get_bits below */
100
-    config = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE);
100
+    config = av_mallocz(len + AV_INPUT_BUFFER_PADDING_SIZE);
101 101
     if (!config)
102 102
         return AVERROR(ENOMEM);
103 103
     ff_hex_to_data(config, value);
... ...
@@ -174,14 +174,14 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
174 174
         if (qt->pkt.size > 0 && qt->timestamp == *timestamp) {
175 175
             int err;
176 176
             if ((err = av_reallocp(&qt->pkt.data, qt->pkt.size + alen +
177
-                                   FF_INPUT_BUFFER_PADDING_SIZE)) < 0) {
177
+                                   AV_INPUT_BUFFER_PADDING_SIZE)) < 0) {
178 178
                 qt->pkt.size = 0;
179 179
                 return err;
180 180
             }
181 181
         } else {
182 182
             av_freep(&qt->pkt.data);
183 183
             av_init_packet(&qt->pkt);
184
-            qt->pkt.data = av_realloc(NULL, alen + FF_INPUT_BUFFER_PADDING_SIZE);
184
+            qt->pkt.data = av_realloc(NULL, alen + AV_INPUT_BUFFER_PADDING_SIZE);
185 185
             if (!qt->pkt.data)
186 186
                 return AVERROR(ENOMEM);
187 187
             qt->pkt.size = 0;
... ...
@@ -198,7 +198,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
198 198
             qt->pkt.data = NULL;
199 199
             pkt->flags        = keyframe ? AV_PKT_FLAG_KEY : 0;
200 200
             pkt->stream_index = st->index;
201
-            memset(pkt->data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
201
+            memset(pkt->data + pkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
202 202
             return 0;
203 203
         }
204 204
         return AVERROR(EAGAIN);
... ...
@@ -262,8 +262,8 @@ parse_packed_headers(const uint8_t * packed_headers,
262 262
     /* allocate extra space:
263 263
      * -- length/255 +2 for xiphlacing
264 264
      * -- one for the '2' marker
265
-     * -- FF_INPUT_BUFFER_PADDING_SIZE required */
266
-    extradata_alloc = length + length/255 + 3 + FF_INPUT_BUFFER_PADDING_SIZE;
265
+     * -- AV_INPUT_BUFFER_PADDING_SIZE required */
266
+    extradata_alloc = length + length/255 + 3 + AV_INPUT_BUFFER_PADDING_SIZE;
267 267
 
268 268
     if (ff_alloc_extradata(codec, extradata_alloc)) {
269 269
         av_log(codec, AV_LOG_ERROR, "Out of memory\n");
... ...
@@ -525,7 +525,7 @@ static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt)
525 525
     if (ctx->extra_bswap ^ (ctx->spdif_flags & SPDIF_FLAG_BIGENDIAN)) {
526 526
         avio_write(s->pb, ctx->out_buf, ctx->out_bytes & ~1);
527 527
     } else {
528
-        av_fast_malloc(&ctx->buffer, &ctx->buffer_size, ctx->out_bytes + FF_INPUT_BUFFER_PADDING_SIZE);
528
+        av_fast_malloc(&ctx->buffer, &ctx->buffer_size, ctx->out_bytes + AV_INPUT_BUFFER_PADDING_SIZE);
529 529
         if (!ctx->buffer)
530 530
             return AVERROR(ENOMEM);
531 531
         ff_spdif_bswap_buf16((uint16_t *)ctx->buffer, (uint16_t *)ctx->out_buf, ctx->out_bytes >> 1);
... ...
@@ -82,10 +82,10 @@ static int tak_read_header(AVFormatContext *s)
82 82
             if (size <= 3)
83 83
                 return AVERROR_INVALIDDATA;
84 84
 
85
-            buffer = av_malloc(size - 3 + FF_INPUT_BUFFER_PADDING_SIZE);
85
+            buffer = av_malloc(size - 3 + AV_INPUT_BUFFER_PADDING_SIZE);
86 86
             if (!buffer)
87 87
                 return AVERROR(ENOMEM);
88
-            memset(buffer + size - 3, 0, FF_INPUT_BUFFER_PADDING_SIZE);
88
+            memset(buffer + size - 3, 0, AV_INPUT_BUFFER_PADDING_SIZE);
89 89
 
90 90
             ffio_init_checksum(pb, tak_check_crc, 0xCE04B7U);
91 91
             if (avio_read(pb, buffer, size - 3) != size - 3) {
... ...
@@ -2922,14 +2922,14 @@ int ff_alloc_extradata(AVCodecContext *avctx, int size)
2922 2922
 {
2923 2923
     int ret;
2924 2924
 
2925
-    if (size < 0 || size >= INT32_MAX - FF_INPUT_BUFFER_PADDING_SIZE) {
2925
+    if (size < 0 || size >= INT32_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
2926 2926
         avctx->extradata = NULL;
2927 2927
         avctx->extradata_size = 0;
2928 2928
         return AVERROR(EINVAL);
2929 2929
     }
2930
-    avctx->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
2930
+    avctx->extradata = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
2931 2931
     if (avctx->extradata) {
2932
-        memset(avctx->extradata + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
2932
+        memset(avctx->extradata + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
2933 2933
         avctx->extradata_size = size;
2934 2934
         ret = 0;
2935 2935
     } else {