Browse code

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

S.N. Hemanth Meenakshisundaram authored on 2010/08/07 09:02:26
Showing 4 changed files
... ...
@@ -1585,8 +1585,8 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic)
1585 1585
     ref->w = codec->width;
1586 1586
     ref->h = codec->height;
1587 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;
1589
-        unsigned vshift = (i == 1 || i == 2) ? av_pix_fmt_descriptors[ref->pic->format].log2_chroma_h : 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->format].log2_chroma_h : 0;
1590 1590
 
1591 1591
         if (ref->data[i]) {
1592 1592
             ref->data[i]    += (edge >> hshift) + ((edge * ref->linesize[i]) >> vshift);
... ...
@@ -1617,7 +1617,7 @@ static int input_reget_buffer(AVCodecContext *codec, AVFrame *pic)
1617 1617
     }
1618 1618
 
1619 1619
     if ((codec->width != ref->w) || (codec->height != ref->h) ||
1620
-        (codec->pix_fmt != ref->pic->format)) {
1620
+        (codec->pix_fmt != ref->format)) {
1621 1621
         av_log(codec, AV_LOG_ERROR, "Picture properties changed.\n");
1622 1622
         return -1;
1623 1623
     }
... ...
@@ -1671,7 +1671,7 @@ static int input_request_frame(AVFilterLink *link)
1671 1671
     } else {
1672 1672
         picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, link->w, link->h);
1673 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 1676
     av_free_packet(&pkt);
1677 1677
 
... ...
@@ -25,8 +25,8 @@
25 25
 #include "libavutil/avutil.h"
26 26
 
27 27
 #define LIBAVFILTER_VERSION_MAJOR  1
28
-#define LIBAVFILTER_VERSION_MINOR 27
29
-#define LIBAVFILTER_VERSION_MICRO  1
28
+#define LIBAVFILTER_VERSION_MINOR 28
29
+#define LIBAVFILTER_VERSION_MICRO  0
30 30
 
31 31
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
32 32
                                                LIBAVFILTER_VERSION_MINOR, \
... ...
@@ -68,7 +68,6 @@ typedef struct AVFilterBuffer
68 68
 {
69 69
     uint8_t *data[8];           ///< buffer data for each plane/channel
70 70
     int linesize[8];            ///< number of bytes per line
71
-    int format;                 ///< media format
72 71
 
73 72
     unsigned refcount;          ///< number of references to this buffer
74 73
 
... ...
@@ -104,6 +103,7 @@ typedef struct AVFilterPicRef
104 104
     int linesize[4];            ///< number of bytes per line
105 105
     int w;                      ///< image width
106 106
     int h;                      ///< image height
107
+    int format;                 ///< media format
107 108
 
108 109
     int64_t pts;                ///< presentation timestamp in units of 1/AV_TIME_BASE
109 110
     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 47
     ref->perms = perms | AV_PERM_READ;
48 48
 
49 49
     pic->refcount = 1;
50
-    pic->format   = link->format;
50
+    ref->format   = link->format;
51 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 54
     for (i=0; i<4;i++)
55 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 58
     buf = av_malloc(tempsize + 16); // +2 is needed for swscaler, +16 to be
59 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 62
     memcpy(ref->data,     pic->data,     4*sizeof(pic->data[0]));
63 63
     memcpy(ref->linesize, pic->linesize, 4*sizeof(pic->linesize[0]));
... ...
@@ -120,7 +120,7 @@ static int request_frame(AVFilterLink *link)
120 120
                                        link->w, link->h);
121 121
 
122 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 125
     picref->pts             = c->pts;
126 126
     picref->pixel_aspect    = c->pixel_aspect;