avpicture_get_size() -> av_image_get_buffer_size()
Unified · Split
| @@ -19,6 +19,8 @@ · 18 unmodified lines | ||
| 19 | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | +#include "libavutil/imgutils.h" | |
| 23 | + | |
| 22 | 24 | #include "avcodec.h" |
| 23 | 25 | #include "bytestream.h" |
| 24 | 26 | #include "internal.h" |
| @@ -31,10 +33,10 @@ static int pam_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 6 unmodified lines | ||
| 31 | 33 | int i, h, w, n, linesize, depth, maxval, ret; |
| 32 | 34 | const char *tuple_type; |
| 33 | 35 | uint8_t *ptr; |
| 36 | + int size = av_image_get_buffer_size(avctx->pix_fmt, | |
| 37 | + avctx->width, avctx->height, 1); | |
| 34 | 38 | |
| 35 | − if ((ret = ff_alloc_packet(pkt, avpicture_get_size(avctx->pix_fmt, | |
| 36 | − avctx->width, | |
| 37 | − avctx->height) + 200)) < 0) { | |
| 39 | + if ((ret = ff_alloc_packet(pkt, size + 200)) < 0) { | |
| 38 | 40 | av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n"); |
| 39 | 41 | return ret; |
| 40 | 42 | } |
| @@ -19,6 +19,8 @@ · 18 unmodified lines | ||
| 19 | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | +#include "libavutil/imgutils.h" | |
| 23 | + | |
| 22 | 24 | #include "parser.h" //for ParseContext |
| 23 | 25 | #include "pnm.h" |
| 24 | 26 | |
| @@ -66,7 +68,7 @@ retry: · 41 unmodified lines | ||
| 66 | 68 | next = END_NOT_FOUND; |
| 67 | 69 | } else { |
| 68 | 70 | next = pnmctx.bytestream - pnmctx.bytestream_start |
| 69 | − + avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); | |
| 71 | + + av_image_get_buffer_size(avctx->pix_fmt, avctx->width, avctx->height, 1); | |
| 70 | 72 | if (pnmctx.bytestream_start != buf) |
| 71 | 73 | next -= pc->index; |
| 72 | 74 | if (next > buf_size) |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | +#include "libavutil/imgutils.h" | |
| 22 | 23 | #include "libavutil/pixdesc.h" |
| 23 | 24 | #include "avcodec.h" |
| 24 | 25 | #include "bytestream.h" |
| @@ -31,10 +32,10 @@ static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 6 unmodified lines | ||
| 31 | 32 | const AVFrame * const p = pict; |
| 32 | 33 | int i, h, h1, c, n, linesize, ret; |
| 33 | 34 | uint8_t *ptr, *ptr1, *ptr2; |
| 35 | + int size = av_image_get_buffer_size(avctx->pix_fmt, | |
| 36 | + avctx->width, avctx->height, 1); | |
| 34 | 37 | |
| 35 | − if ((ret = ff_alloc_packet(pkt, avpicture_get_size(avctx->pix_fmt, | |
| 36 | − avctx->width, | |
| 37 | − avctx->height) + 200)) < 0) { | |
| 38 | + if ((ret = ff_alloc_packet(pkt, size + 200)) < 0) { | |
| 38 | 39 | av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n"); |
| 39 | 40 | return ret; |
| 40 | 41 | } |
| @@ -21,6 +21,7 @@ · 20 unmodified lines | ||
| 21 | 21 | |
| 22 | 22 | #include <string.h> |
| 23 | 23 | |
| 24 | +#include "libavutil/imgutils.h" | |
| 24 | 25 | #include "libavutil/internal.h" |
| 25 | 26 | #include "libavutil/intreadwrite.h" |
| 26 | 27 | #include "libavutil/pixdesc.h" |
| @@ -84,7 +85,8 @@ static int targa_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 57 unmodified lines | ||
| 84 | 85 | av_log(avctx, AV_LOG_ERROR, "image dimensions too large\n"); |
| 85 | 86 | return AVERROR(EINVAL); |
| 86 | 87 | } |
| 87 | − picsize = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); | |
| 88 | + picsize = av_image_get_buffer_size(avctx->pix_fmt, | |
| 89 | + avctx->width, avctx->height, 1); | |
| 88 | 90 | if ((ret = ff_alloc_packet(pkt, picsize + 45)) < 0) { |
| 89 | 91 | av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n"); |
| 90 | 92 | return ret; |
| @@ -26,6 +26,8 @@ · 25 unmodified lines | ||
| 26 | 26 | |
| 27 | 27 | #define BITSTREAM_READER_LE |
| 28 | 28 | |
| 29 | +#include "libavutil/imgutils.h" | |
| 30 | + | |
| 29 | 31 | #include "avcodec.h" |
| 30 | 32 | #include "get_bits.h" |
| 31 | 33 | #include "huffyuvdsp.h" |
| @@ -183,8 +185,8 @@ static av_cold int vble_decode_init(AVCodecContext *avctx) · 151 unmodified lines | ||
| 183 | 185 | avctx->pix_fmt = AV_PIX_FMT_YUV420P; |
| 184 | 186 | avctx->bits_per_raw_sample = 8; |
| 185 | 187 | |
| 186 | − ctx->size = avpicture_get_size(avctx->pix_fmt, | |
| 187 | − avctx->width, avctx->height); | |
| 188 | + ctx->size = av_image_get_buffer_size(avctx->pix_fmt, | |
| 189 | + avctx->width, avctx->height, 1); | |
| 188 | 190 | |
| 189 | 191 | ctx->val = av_malloc(ctx->size * sizeof(*ctx->val)); |
| 190 | 192 | |
| @@ -41,6 +41,7 @@ · 40 unmodified lines | ||
| 41 | 41 | #define DC1394_FRAMERATE_240 FRAMERATE_240 |
| 42 | 42 | #endif |
| 43 | 43 | |
| 44 | +#include "libavutil/imgutils.h" | |
| 44 | 45 | #include "libavutil/internal.h" |
| 45 | 46 | #include "libavutil/log.h" |
| 46 | 47 | #include "libavutil/mathematics.h" |
| @@ -179,7 +180,8 @@ static inline int dc1394_read_common(AVFormatContext *c, · 132 unmodified lines | ||
| 179 | 180 | |
| 180 | 181 | /* packet init */ |
| 181 | 182 | av_init_packet(&dc1394->packet); |
| 182 | − dc1394->packet.size = avpicture_get_size(fmt->pix_fmt, fmt->width, fmt->height); | |
| 183 | + dc1394->packet.size = av_image_get_buffer_size(fmt->pix_fmt, | |
| 184 | + fmt->width, fmt->height, 1); | |
| 183 | 185 | dc1394->packet.stream_index = vst->index; |
| 184 | 186 | dc1394->packet.flags |= AV_PKT_FLAG_KEY; |
| 185 | 187 | |
| @@ -828,8 +828,8 @@ static int v4l2_read_header(AVFormatContext *s1) · 827 unmodified lines | ||
| 828 | 828 | return res; |
| 829 | 829 | |
| 830 | 830 | st->codec->pix_fmt = fmt_v4l2ff(desired_format, codec_id); |
| 831 | − s->frame_size = | |
| 832 | − avpicture_get_size(st->codec->pix_fmt, s->width, s->height); | |
| 831 | + s->frame_size = av_image_get_buffer_size(st->codec->pix_fmt, | |
| 832 | + s->width, s->height, 1); | |
| 833 | 833 | |
| 834 | 834 | if ((res = mmap_init(s1)) || |
| 835 | 835 | (res = mmap_start(s1)) < 0) { |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | +#include "libavutil/imgutils.h" | |
| 22 | 23 | #include "libavutil/parseutils.h" |
| 23 | 24 | #include "libavutil/pixdesc.h" |
| 24 | 25 | #include "libavutil/opt.h" |
| @@ -85,7 +86,7 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt) · 60 unmodified lines | ||
| 85 | 86 | width = st->codec->width; |
| 86 | 87 | height = st->codec->height; |
| 87 | 88 | |
| 88 | − packet_size = avpicture_get_size(st->codec->pix_fmt, width, height); | |
| 89 | + packet_size = av_image_get_buffer_size(st->codec->pix_fmt, width, height, 1); | |
| 89 | 90 | if (packet_size < 0) |
| 90 | 91 | return -1; |
| 91 | 92 | |
| @@ -19,6 +19,8 @@ · 18 unmodified lines | ||
| 19 | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | +#include "libavutil/imgutils.h" | |
| 23 | + | |
| 22 | 24 | #include "avformat.h" |
| 23 | 25 | #include "internal.h" |
| 24 | 26 | #include "yuv4mpeg.h" |
| @@ -226,7 +228,8 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt) · 201 unmodified lines | ||
| 226 | 228 | width = st->codec->width; |
| 227 | 229 | height = st->codec->height; |
| 228 | 230 | |
| 229 | − packet_size = avpicture_get_size(st->codec->pix_fmt, width, height); | |
| 231 | + packet_size = av_image_get_buffer_size(st->codec->pix_fmt, | |
| 232 | + width, height, 1); | |
| 230 | 233 | if (packet_size < 0) |
| 231 | 234 | return packet_size; |
| 232 | 235 | |