Commit 47020421 authored by Hendrik Leppkes's avatar Hendrik Leppkes

Merge commit 'f890677d'

* commit 'f890677d':
  Replace any remaining avpicture function with imgutils
Merged-by: 's avatarHendrik Leppkes <h.leppkes@gmail.com>
parents 4c46f1d4 f890677d
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "libavutil/imgutils.h"
#include "parser.h" //for ParseContext #include "parser.h" //for ParseContext
#include "pnm.h" #include "pnm.h"
...@@ -66,7 +68,7 @@ retry: ...@@ -66,7 +68,7 @@ retry:
next = END_NOT_FOUND; next = END_NOT_FOUND;
} else { } else {
next = pnmctx.bytestream - pnmctx.bytestream_start next = pnmctx.bytestream - pnmctx.bytestream_start
+ avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); + av_image_get_buffer_size(avctx->pix_fmt, avctx->width, avctx->height, 1);
if (pnmctx.bytestream_start != buf) if (pnmctx.bytestream_start != buf)
next -= pc->index; next -= pc->index;
if (next > buf_size) if (next > buf_size)
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "libavutil/imgutils.h"
#include "libavutil/pixdesc.h" #include "libavutil/pixdesc.h"
#include "avcodec.h" #include "avcodec.h"
#include "internal.h" #include "internal.h"
...@@ -29,10 +30,10 @@ static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt, ...@@ -29,10 +30,10 @@ static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
uint8_t *bytestream, *bytestream_start, *bytestream_end; uint8_t *bytestream, *bytestream_start, *bytestream_end;
int i, h, h1, c, n, linesize, ret; int i, h, h1, c, n, linesize, ret;
uint8_t *ptr, *ptr1, *ptr2; uint8_t *ptr, *ptr1, *ptr2;
int size = av_image_get_buffer_size(avctx->pix_fmt,
avctx->width, avctx->height, 1);
if ((ret = ff_alloc_packet2(avctx, pkt, avpicture_get_size(avctx->pix_fmt, if ((ret = ff_alloc_packet2(avctx, pkt, size + 200, 0)) < 0)
avctx->width,
avctx->height) + 200, 0)) < 0)
return ret; return ret;
bytestream_start = bytestream_start =
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <string.h> #include <string.h>
#include "libavutil/imgutils.h"
#include "libavutil/internal.h" #include "libavutil/internal.h"
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "libavutil/pixdesc.h" #include "libavutil/pixdesc.h"
...@@ -84,7 +85,8 @@ static int targa_encode_frame(AVCodecContext *avctx, AVPacket *pkt, ...@@ -84,7 +85,8 @@ static int targa_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
av_log(avctx, AV_LOG_ERROR, "image dimensions too large\n"); av_log(avctx, AV_LOG_ERROR, "image dimensions too large\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
picsize = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); picsize = av_image_get_buffer_size(avctx->pix_fmt,
avctx->width, avctx->height, 1);
if ((ret = ff_alloc_packet2(avctx, pkt, picsize + 45, 0)) < 0) if ((ret = ff_alloc_packet2(avctx, pkt, picsize + 45, 0)) < 0)
return ret; return ret;
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
#define BITSTREAM_READER_LE #define BITSTREAM_READER_LE
#include "libavutil/imgutils.h"
#include "avcodec.h" #include "avcodec.h"
#include "get_bits.h" #include "get_bits.h"
#include "huffyuvdsp.h" #include "huffyuvdsp.h"
...@@ -187,8 +189,8 @@ static av_cold int vble_decode_init(AVCodecContext *avctx) ...@@ -187,8 +189,8 @@ static av_cold int vble_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_YUV420P; avctx->pix_fmt = AV_PIX_FMT_YUV420P;
avctx->bits_per_raw_sample = 8; avctx->bits_per_raw_sample = 8;
ctx->size = avpicture_get_size(avctx->pix_fmt, ctx->size = av_image_get_buffer_size(avctx->pix_fmt,
avctx->width, avctx->height); avctx->width, avctx->height, 1);
ctx->val = av_malloc_array(ctx->size, sizeof(*ctx->val)); ctx->val = av_malloc_array(ctx->size, sizeof(*ctx->val));
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#define DC1394_FRAMERATE_240 FRAMERATE_240 #define DC1394_FRAMERATE_240 FRAMERATE_240
#endif #endif
#include "libavutil/imgutils.h"
#include "libavutil/internal.h" #include "libavutil/internal.h"
#include "libavutil/log.h" #include "libavutil/log.h"
#include "libavutil/mathematics.h" #include "libavutil/mathematics.h"
...@@ -180,7 +181,8 @@ static inline int dc1394_read_common(AVFormatContext *c, ...@@ -180,7 +181,8 @@ static inline int dc1394_read_common(AVFormatContext *c,
/* packet init */ /* packet init */
av_init_packet(&dc1394->packet); av_init_packet(&dc1394->packet);
dc1394->packet.size = avpicture_get_size(fmt->pix_fmt, fmt->width, fmt->height); dc1394->packet.size = av_image_get_buffer_size(fmt->pix_fmt,
fmt->width, fmt->height, 1);
dc1394->packet.stream_index = vst->index; dc1394->packet.stream_index = vst->index;
dc1394->packet.flags |= AV_PKT_FLAG_KEY; dc1394->packet.flags |= AV_PKT_FLAG_KEY;
......
...@@ -939,8 +939,8 @@ static int v4l2_read_header(AVFormatContext *ctx) ...@@ -939,8 +939,8 @@ static int v4l2_read_header(AVFormatContext *ctx)
goto fail; goto fail;
st->codec->pix_fmt = ff_fmt_v4l2ff(desired_format, codec_id); st->codec->pix_fmt = ff_fmt_v4l2ff(desired_format, codec_id);
s->frame_size = s->frame_size = av_image_get_buffer_size(st->codec->pix_fmt,
avpicture_get_size(st->codec->pix_fmt, s->width, s->height); s->width, s->height, 1);
if ((res = mmap_init(ctx)) || if ((res = mmap_init(ctx)) ||
(res = mmap_start(ctx)) < 0) (res = mmap_start(ctx)) < 0)
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "libavutil/imgutils.h"
#include "libavutil/parseutils.h" #include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h" #include "libavutil/pixdesc.h"
#include "libavutil/opt.h" #include "libavutil/opt.h"
...@@ -73,7 +74,7 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -73,7 +74,7 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
width = st->codec->width; width = st->codec->width;
height = st->codec->height; height = st->codec->height;
packet_size = avpicture_get_size(st->codec->pix_fmt, width, height); packet_size = av_image_get_buffer_size(st->codec->pix_fmt, width, height, 1);
if (packet_size < 0) if (packet_size < 0)
return -1; return -1;
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "libavutil/imgutils.h"
#include "avformat.h" #include "avformat.h"
#include "internal.h" #include "internal.h"
#include "yuv4mpeg.h" #include "yuv4mpeg.h"
...@@ -256,7 +258,7 @@ static int yuv4_read_header(AVFormatContext *s) ...@@ -256,7 +258,7 @@ static int yuv4_read_header(AVFormatContext *s)
st->sample_aspect_ratio = (AVRational){ aspectn, aspectd }; st->sample_aspect_ratio = (AVRational){ aspectn, aspectd };
st->codec->chroma_sample_location = chroma_sample_location; st->codec->chroma_sample_location = chroma_sample_location;
st->codec->field_order = field_order; st->codec->field_order = field_order;
s->packet_size = avpicture_get_size(st->codec->pix_fmt, width, height) + Y4M_FRAME_MAGIC_LEN; s->packet_size = av_image_get_buffer_size(st->codec->pix_fmt, width, height, 1) + Y4M_FRAME_MAGIC_LEN;
if ((int) s->packet_size < 0) if ((int) s->packet_size < 0)
return s->packet_size; return s->packet_size;
s->internal->data_offset = avio_tell(pb); s->internal->data_offset = avio_tell(pb);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment