History

Replace any remaining avpicture function with imgutils

avpicture_get_size() -> av_image_get_buffer_size()

Vittorio Giovara committed 11 years ago

Commit f8906771 parent 13bddab9 files · +30 −15Browse files

Unified · Split

9 files
  1. libavcodec/pamenc.c +5 −3
  2. libavcodec/pnm_parser.c +3 −1
  3. libavcodec/pnmenc.c +4 −3
  4. libavcodec/targaenc.c +3 −1
  5. libavcodec/vble.c +4 −2
  6. libavdevice/libdc1394.c +3 −1
  7. libavdevice/v4l2.c +2 −2
  8. libavformat/rawvideodec.c +2 −1
  9. libavformat/yuv4mpegdec.c +4 −1
libavcodec/pamenc.c+5−3
@@ -19,6 +19,8 @@ · 18 unmodified lines
1919 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2020 */
2121
22+#include "libavutil/imgutils.h"
23+
2224 #include "avcodec.h"
2325 #include "bytestream.h"
2426 #include "internal.h"
@@ -31,10 +33,10 @@ static int pam_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 6 unmodified lines
3133 int i, h, w, n, linesize, depth, maxval, ret;
3234 const char *tuple_type;
3335 uint8_t *ptr;
36+ int size = av_image_get_buffer_size(avctx->pix_fmt,
37+ avctx->width, avctx->height, 1);
3438
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) {
3840 av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n");
3941 return ret;
4042 }
libavcodec/pnm_parser.c+3−1
@@ -19,6 +19,8 @@ · 18 unmodified lines
1919 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2020 */
2121
22+#include "libavutil/imgutils.h"
23+
2224 #include "parser.h" //for ParseContext
2325 #include "pnm.h"
2426
@@ -66,7 +68,7 @@ retry: · 41 unmodified lines
6668 next = END_NOT_FOUND;
6769 } else {
6870 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);
7072 if (pnmctx.bytestream_start != buf)
7173 next -= pc->index;
7274 if (next > buf_size)
libavcodec/pnmenc.c+4−3
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2020 */
2121
22+#include "libavutil/imgutils.h"
2223 #include "libavutil/pixdesc.h"
2324 #include "avcodec.h"
2425 #include "bytestream.h"
@@ -31,10 +32,10 @@ static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 6 unmodified lines
3132 const AVFrame * const p = pict;
3233 int i, h, h1, c, n, linesize, ret;
3334 uint8_t *ptr, *ptr1, *ptr2;
35+ int size = av_image_get_buffer_size(avctx->pix_fmt,
36+ avctx->width, avctx->height, 1);
3437
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) {
3839 av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n");
3940 return ret;
4041 }
libavcodec/targaenc.c+3−1
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121
2222 #include <string.h>
2323
24+#include "libavutil/imgutils.h"
2425 #include "libavutil/internal.h"
2526 #include "libavutil/intreadwrite.h"
2627 #include "libavutil/pixdesc.h"
@@ -84,7 +85,8 @@ static int targa_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 57 unmodified lines
8485 av_log(avctx, AV_LOG_ERROR, "image dimensions too large\n");
8586 return AVERROR(EINVAL);
8687 }
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);
8890 if ((ret = ff_alloc_packet(pkt, picsize + 45)) < 0) {
8991 av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n");
9092 return ret;
libavcodec/vble.c+4−2
@@ -26,6 +26,8 @@ · 25 unmodified lines
2626
2727 #define BITSTREAM_READER_LE
2828
29+#include "libavutil/imgutils.h"
30+
2931 #include "avcodec.h"
3032 #include "get_bits.h"
3133 #include "huffyuvdsp.h"
@@ -183,8 +185,8 @@ static av_cold int vble_decode_init(AVCodecContext *avctx) · 151 unmodified lines
183185 avctx->pix_fmt = AV_PIX_FMT_YUV420P;
184186 avctx->bits_per_raw_sample = 8;
185187
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);
188190
189191 ctx->val = av_malloc(ctx->size * sizeof(*ctx->val));
190192
libavdevice/libdc1394.c+3−1
@@ -41,6 +41,7 @@ · 40 unmodified lines
4141 #define DC1394_FRAMERATE_240 FRAMERATE_240
4242 #endif
4343
44+#include "libavutil/imgutils.h"
4445 #include "libavutil/internal.h"
4546 #include "libavutil/log.h"
4647 #include "libavutil/mathematics.h"
@@ -179,7 +180,8 @@ static inline int dc1394_read_common(AVFormatContext *c, · 132 unmodified lines
179180
180181 /* packet init */
181182 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);
183185 dc1394->packet.stream_index = vst->index;
184186 dc1394->packet.flags |= AV_PKT_FLAG_KEY;
185187
libavdevice/v4l2.c+2−2
@@ -828,8 +828,8 @@ static int v4l2_read_header(AVFormatContext *s1) · 827 unmodified lines
828828 return res;
829829
830830 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);
833833
834834 if ((res = mmap_init(s1)) ||
835835 (res = mmap_start(s1)) < 0) {
libavformat/rawvideodec.c+2−1
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2020 */
2121
22+#include "libavutil/imgutils.h"
2223 #include "libavutil/parseutils.h"
2324 #include "libavutil/pixdesc.h"
2425 #include "libavutil/opt.h"
@@ -85,7 +86,7 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt) · 60 unmodified lines
8586 width = st->codec->width;
8687 height = st->codec->height;
8788
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);
8990 if (packet_size < 0)
9091 return -1;
9192
libavformat/yuv4mpegdec.c+4−1
@@ -19,6 +19,8 @@ · 18 unmodified lines
1919 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2020 */
2121
22+#include "libavutil/imgutils.h"
23+
2224 #include "avformat.h"
2325 #include "internal.h"
2426 #include "yuv4mpeg.h"
@@ -226,7 +228,8 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt) · 201 unmodified lines
226228 width = st->codec->width;
227229 height = st->codec->height;
228230
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);
230233 if (packet_size < 0)
231234 return packet_size;
232235

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t