summaryrefslogtreecommitdiff
path: root/libavcodec/pamenc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/pamenc.c')
-rw-r--r--libavcodec/pamenc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/pamenc.c b/libavcodec/pamenc.c
index 0be07e1f1b..2b63af986e 100644
--- a/libavcodec/pamenc.c
+++ b/libavcodec/pamenc.c
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/imgutils.h"
+
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
@@ -31,10 +33,10 @@ static int pam_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int i, h, w, n, linesize, depth, maxval, ret;
const char *tuple_type;
uint8_t *ptr;
+ int size = av_image_get_buffer_size(avctx->pix_fmt,
+ avctx->width, avctx->height, 1);
- if ((ret = ff_alloc_packet(pkt, avpicture_get_size(avctx->pix_fmt,
- avctx->width,
- avctx->height) + 200)) < 0) {
+ if ((ret = ff_alloc_packet(pkt, size + 200)) < 0) {
av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n");
return ret;
}