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