Patch by S.N. Hemanth Meenakshisundaram |smeenaks|ucsd|edu|. Originally committed as revision 24728 to svn://svn.ffmpeg.org/ffmpeg/trunk
Unified · Split
| @@ -1585,8 +1585,8 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic) · 1584 unmodified lines | |||
| 1585 | ref->w = codec->width; | 1585 | ref->w = codec->width; |
| 1586 | ref->h = codec->height; | 1586 | ref->h = codec->height; |
| 1587 | for(i = 0; i < 4; i ++) { | 1587 | for(i = 0; i < 4; i ++) { |
| 1588 | unsigned hshift = (i == 1 || i == 2) ? av_pix_fmt_descriptors[ref->pic->format].log2_chroma_w : 0; | 1588 | unsigned hshift = (i == 1 || i == 2) ? av_pix_fmt_descriptors[ref->format].log2_chroma_w : 0; |
| 1589 | unsigned vshift = (i == 1 || i == 2) ? av_pix_fmt_descriptors[ref->pic->format].log2_chroma_h : 0; | 1589 | unsigned vshift = (i == 1 || i == 2) ? av_pix_fmt_descriptors[ref->format].log2_chroma_h : 0; |
| 1590 | 1590 | ||
| 1591 | if (ref->data[i]) { | 1591 | if (ref->data[i]) { |
| 1592 | ref->data[i] += (edge >> hshift) + ((edge * ref->linesize[i]) >> vshift); | 1592 | ref->data[i] += (edge >> hshift) + ((edge * ref->linesize[i]) >> vshift); |
| @@ -1617,7 +1617,7 @@ static int input_reget_buffer(AVCodecContext *codec, AVFrame *pic) · 24 unmodified lines | |||
| 1617 | } | 1617 | } |
| 1618 | 1618 | ||
| 1619 | if ((codec->width != ref->w) || (codec->height != ref->h) || | 1619 | if ((codec->width != ref->w) || (codec->height != ref->h) || |
| 1620 | (codec->pix_fmt != ref->pic->format)) { | 1620 | (codec->pix_fmt != ref->format)) { |
| 1621 | av_log(codec, AV_LOG_ERROR, "Picture properties changed.\n"); | 1621 | av_log(codec, AV_LOG_ERROR, "Picture properties changed.\n"); |
| 1622 | return -1; | 1622 | return -1; |
| 1623 | } | 1623 | } |
| @@ -1671,7 +1671,7 @@ static int input_request_frame(AVFilterLink *link) · 47 unmodified lines | |||
| 1671 | } else { | 1671 | } else { |
| 1672 | picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, link->w, link->h); | 1672 | picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, link->w, link->h); |
| 1673 | av_picture_copy((AVPicture *)&picref->data, (AVPicture *)priv->frame, | 1673 | av_picture_copy((AVPicture *)&picref->data, (AVPicture *)priv->frame, |
| 1674 | picref->pic->format, link->w, link->h); | 1674 | picref->format, link->w, link->h); |
| 1675 | } | 1675 | } |
| 1676 | av_free_packet(&pkt); | 1676 | av_free_packet(&pkt); |
| 1677 | 1677 | ||
| @@ -25,8 +25,8 @@ · 24 unmodified lines | |||
| 25 | #include "libavutil/avutil.h" | 25 | #include "libavutil/avutil.h" |
| 26 | 26 | ||
| 27 | #define LIBAVFILTER_VERSION_MAJOR 1 | 27 | #define LIBAVFILTER_VERSION_MAJOR 1 |
| 28 | #define LIBAVFILTER_VERSION_MINOR 27 | 28 | #define LIBAVFILTER_VERSION_MINOR 28 |
| 29 | #define LIBAVFILTER_VERSION_MICRO 1 | 29 | #define LIBAVFILTER_VERSION_MICRO 0 |
| 30 | 30 | ||
| 31 | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ | 31 | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ |
| 32 | LIBAVFILTER_VERSION_MINOR, \ | 32 | LIBAVFILTER_VERSION_MINOR, \ |
| @@ -68,7 +68,6 @@ typedef struct AVFilterBuffer · 35 unmodified lines | |||
| 68 | { | 68 | { |
| 69 | uint8_t *data[8]; ///< buffer data for each plane/channel | 69 | uint8_t *data[8]; ///< buffer data for each plane/channel |
| 70 | int linesize[8]; ///< number of bytes per line | 70 | int linesize[8]; ///< number of bytes per line |
| 71 | int format; ///< media format | ||
| 72 | 71 | ||
| 73 | unsigned refcount; ///< number of references to this buffer | 72 | unsigned refcount; ///< number of references to this buffer |
| 74 | 73 | ||
| @@ -104,6 +103,7 @@ typedef struct AVFilterPicRef · 29 unmodified lines | |||
| 104 | int linesize[4]; ///< number of bytes per line | 103 | int linesize[4]; ///< number of bytes per line |
| 105 | int w; ///< image width | 104 | int w; ///< image width |
| 106 | int h; ///< image height | 105 | int h; ///< image height |
| 106 | int format; ///< media format | ||
| 107 | 107 | ||
| 108 | int64_t pts; ///< presentation timestamp in units of 1/AV_TIME_BASE | 108 | int64_t pts; ///< presentation timestamp in units of 1/AV_TIME_BASE |
| 109 | int64_t pos; ///< byte position in stream, -1 if unknown | 109 | int64_t pos; ///< byte position in stream, -1 if unknown |
| @@ -47,17 +47,17 @@ AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms, · 46 unmodified lines | |||
| 47 | ref->perms = perms | AV_PERM_READ; | 47 | ref->perms = perms | AV_PERM_READ; |
| 48 | 48 | ||
| 49 | pic->refcount = 1; | 49 | pic->refcount = 1; |
| 50 | pic->format = link->format; | 50 | ref->format = link->format; |
| 51 | pic->free = avfilter_default_free_buffer; | 51 | pic->free = avfilter_default_free_buffer; |
| 52 | av_fill_image_linesizes(pic->linesize, pic->format, ref->w); | 52 | av_fill_image_linesizes(pic->linesize, ref->format, ref->w); |
| 53 | 53 | ||
| 54 | for (i=0; i<4;i++) | 54 | for (i=0; i<4;i++) |
| 55 | pic->linesize[i] = FFALIGN(pic->linesize[i], 16); | 55 | pic->linesize[i] = FFALIGN(pic->linesize[i], 16); |
| 56 | 56 | ||
| 57 | tempsize = av_fill_image_pointers(pic->data, pic->format, ref->h, NULL, pic->linesize); | 57 | tempsize = av_fill_image_pointers(pic->data, ref->format, ref->h, NULL, pic->linesize); |
| 58 | buf = av_malloc(tempsize + 16); // +2 is needed for swscaler, +16 to be | 58 | buf = av_malloc(tempsize + 16); // +2 is needed for swscaler, +16 to be |
| 59 | // SIMD-friendly | 59 | // SIMD-friendly |
| 60 | av_fill_image_pointers(pic->data, pic->format, ref->h, buf, pic->linesize); | 60 | av_fill_image_pointers(pic->data, ref->format, ref->h, buf, pic->linesize); |
| 61 | 61 | ||
| 62 | memcpy(ref->data, pic->data, 4*sizeof(pic->data[0])); | 62 | memcpy(ref->data, pic->data, 4*sizeof(pic->data[0])); |
| 63 | memcpy(ref->linesize, pic->linesize, 4*sizeof(pic->linesize[0])); | 63 | memcpy(ref->linesize, pic->linesize, 4*sizeof(pic->linesize[0])); |
| @@ -120,7 +120,7 @@ static int request_frame(AVFilterLink *link) · 119 unmodified lines | |||
| 120 | link->w, link->h); | 120 | link->w, link->h); |
| 121 | 121 | ||
| 122 | av_picture_copy((AVPicture *)&picref->data, (AVPicture *)&c->frame, | 122 | av_picture_copy((AVPicture *)&picref->data, (AVPicture *)&c->frame, |
| 123 | picref->pic->format, link->w, link->h); | 123 | picref->format, link->w, link->h); |
| 124 | 124 | ||
| 125 | picref->pts = c->pts; | 125 | picref->pts = c->pts; |
| 126 | picref->pixel_aspect = c->pixel_aspect; | 126 | picref->pixel_aspect = c->pixel_aspect; |