Commit d54e0948 authored by S.N. Hemanth Meenakshisundaram's avatar S.N. Hemanth Meenakshisundaram Committed by Stefano Sabatini

Move format from AVFilterBuffer to AVFilterPicRef.

Patch by S.N. Hemanth Meenakshisundaram |smeenaks|ucsd|edu|.

Originally committed as revision 24728 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 59ff3fd5
...@@ -1585,8 +1585,8 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic) ...@@ -1585,8 +1585,8 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic)
ref->w = codec->width; ref->w = codec->width;
ref->h = codec->height; ref->h = codec->height;
for(i = 0; i < 4; i ++) { for(i = 0; i < 4; i ++) {
unsigned hshift = (i == 1 || i == 2) ? av_pix_fmt_descriptors[ref->pic->format].log2_chroma_w : 0; unsigned hshift = (i == 1 || i == 2) ? av_pix_fmt_descriptors[ref->format].log2_chroma_w : 0;
unsigned vshift = (i == 1 || i == 2) ? av_pix_fmt_descriptors[ref->pic->format].log2_chroma_h : 0; unsigned vshift = (i == 1 || i == 2) ? av_pix_fmt_descriptors[ref->format].log2_chroma_h : 0;
if (ref->data[i]) { if (ref->data[i]) {
ref->data[i] += (edge >> hshift) + ((edge * ref->linesize[i]) >> vshift); ref->data[i] += (edge >> hshift) + ((edge * ref->linesize[i]) >> vshift);
...@@ -1617,7 +1617,7 @@ static int input_reget_buffer(AVCodecContext *codec, AVFrame *pic) ...@@ -1617,7 +1617,7 @@ static int input_reget_buffer(AVCodecContext *codec, AVFrame *pic)
} }
if ((codec->width != ref->w) || (codec->height != ref->h) || if ((codec->width != ref->w) || (codec->height != ref->h) ||
(codec->pix_fmt != ref->pic->format)) { (codec->pix_fmt != ref->format)) {
av_log(codec, AV_LOG_ERROR, "Picture properties changed.\n"); av_log(codec, AV_LOG_ERROR, "Picture properties changed.\n");
return -1; return -1;
} }
...@@ -1671,7 +1671,7 @@ static int input_request_frame(AVFilterLink *link) ...@@ -1671,7 +1671,7 @@ static int input_request_frame(AVFilterLink *link)
} else { } else {
picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, link->w, link->h); picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, link->w, link->h);
av_picture_copy((AVPicture *)&picref->data, (AVPicture *)priv->frame, av_picture_copy((AVPicture *)&picref->data, (AVPicture *)priv->frame,
picref->pic->format, link->w, link->h); picref->format, link->w, link->h);
} }
av_free_packet(&pkt); av_free_packet(&pkt);
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
#include "libavutil/avutil.h" #include "libavutil/avutil.h"
#define LIBAVFILTER_VERSION_MAJOR 1 #define LIBAVFILTER_VERSION_MAJOR 1
#define LIBAVFILTER_VERSION_MINOR 27 #define LIBAVFILTER_VERSION_MINOR 28
#define LIBAVFILTER_VERSION_MICRO 1 #define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \ LIBAVFILTER_VERSION_MINOR, \
...@@ -68,7 +68,6 @@ typedef struct AVFilterBuffer ...@@ -68,7 +68,6 @@ typedef struct AVFilterBuffer
{ {
uint8_t *data[8]; ///< buffer data for each plane/channel uint8_t *data[8]; ///< buffer data for each plane/channel
int linesize[8]; ///< number of bytes per line int linesize[8]; ///< number of bytes per line
int format; ///< media format
unsigned refcount; ///< number of references to this buffer unsigned refcount; ///< number of references to this buffer
...@@ -104,6 +103,7 @@ typedef struct AVFilterPicRef ...@@ -104,6 +103,7 @@ typedef struct AVFilterPicRef
int linesize[4]; ///< number of bytes per line int linesize[4]; ///< number of bytes per line
int w; ///< image width int w; ///< image width
int h; ///< image height int h; ///< image height
int format; ///< media format
int64_t pts; ///< presentation timestamp in units of 1/AV_TIME_BASE int64_t pts; ///< presentation timestamp in units of 1/AV_TIME_BASE
int64_t pos; ///< byte position in stream, -1 if unknown int64_t pos; ///< byte position in stream, -1 if unknown
......
...@@ -47,17 +47,17 @@ AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms, ...@@ -47,17 +47,17 @@ AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms,
ref->perms = perms | AV_PERM_READ; ref->perms = perms | AV_PERM_READ;
pic->refcount = 1; pic->refcount = 1;
pic->format = link->format; ref->format = link->format;
pic->free = avfilter_default_free_buffer; pic->free = avfilter_default_free_buffer;
av_fill_image_linesizes(pic->linesize, pic->format, ref->w); av_fill_image_linesizes(pic->linesize, ref->format, ref->w);
for (i=0; i<4;i++) for (i=0; i<4;i++)
pic->linesize[i] = FFALIGN(pic->linesize[i], 16); pic->linesize[i] = FFALIGN(pic->linesize[i], 16);
tempsize = av_fill_image_pointers(pic->data, pic->format, ref->h, NULL, pic->linesize); tempsize = av_fill_image_pointers(pic->data, ref->format, ref->h, NULL, pic->linesize);
buf = av_malloc(tempsize + 16); // +2 is needed for swscaler, +16 to be buf = av_malloc(tempsize + 16); // +2 is needed for swscaler, +16 to be
// SIMD-friendly // SIMD-friendly
av_fill_image_pointers(pic->data, pic->format, ref->h, buf, pic->linesize); av_fill_image_pointers(pic->data, ref->format, ref->h, buf, pic->linesize);
memcpy(ref->data, pic->data, 4*sizeof(pic->data[0])); memcpy(ref->data, pic->data, 4*sizeof(pic->data[0]));
memcpy(ref->linesize, pic->linesize, 4*sizeof(pic->linesize[0])); memcpy(ref->linesize, pic->linesize, 4*sizeof(pic->linesize[0]));
......
...@@ -120,7 +120,7 @@ static int request_frame(AVFilterLink *link) ...@@ -120,7 +120,7 @@ static int request_frame(AVFilterLink *link)
link->w, link->h); link->w, link->h);
av_picture_copy((AVPicture *)&picref->data, (AVPicture *)&c->frame, av_picture_copy((AVPicture *)&picref->data, (AVPicture *)&c->frame,
picref->pic->format, link->w, link->h); picref->format, link->w, link->h);
picref->pts = c->pts; picref->pts = c->pts;
picref->pixel_aspect = c->pixel_aspect; picref->pixel_aspect = c->pixel_aspect;
......
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