comparison libmpcodecs/vf_pullup.c @ 10773:012eeac10e16

direct render frames whose fields are not in a common buffer, rather than repacking them together and exporting. slight performance boost.
author rfelker
date Mon, 01 Sep 2003 02:54:06 +0000
parents b6b68224033d
children fdcd0d571912
comparison
equal deleted inserted replaced
10772:57971d3c8bee 10773:012eeac10e16
91 mpi->stride[1] = c->stride[1]; 91 mpi->stride[1] = c->stride[1];
92 mpi->stride[2] = c->stride[2]; 92 mpi->stride[2] = c->stride[2];
93 93
94 mpi->flags |= MP_IMGFLAG_DIRECT; 94 mpi->flags |= MP_IMGFLAG_DIRECT;
95 mpi->flags &= ~MP_IMGFLAG_DRAW_CALLBACK; 95 mpi->flags &= ~MP_IMGFLAG_DRAW_CALLBACK;
96
97 //mpi->width = mpi->stride[0];
98 } 96 }
99 97
100 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi) 98 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi)
101 { 99 {
102 struct pullup_context *c = vf->priv->ctx; 100 struct pullup_context *c = vf->priv->ctx;
131 } 129 }
132 } 130 }
133 131
134 p = mpi->fields & MP_IMGFIELD_TOP_FIRST ? 0 : 132 p = mpi->fields & MP_IMGFIELD_TOP_FIRST ? 0 :
135 (mpi->fields & MP_IMGFIELD_ORDERED ? 1 : 0); 133 (mpi->fields & MP_IMGFIELD_ORDERED ? 1 : 0);
136 //printf("p=%d\n", p);
137 pullup_submit_field(c, b, p); 134 pullup_submit_field(c, b, p);
138 pullup_submit_field(c, b, p^1); 135 pullup_submit_field(c, b, p^1);
139 if (mpi->fields & MP_IMGFIELD_REPEAT_FIRST) 136 if (mpi->fields & MP_IMGFIELD_REPEAT_FIRST)
140 pullup_submit_field(c, b, p); 137 pullup_submit_field(c, b, p);
141 138
156 return 0; 153 return 0;
157 } 154 }
158 } 155 }
159 156
160 /* If the frame isn't already exportable... */ 157 /* If the frame isn't already exportable... */
161 if (!f->buffer) { 158 while (!f->buffer) {
162 /* FIXME: DR disabled for now */ 159 dmpi = vf_get_image(vf->next, mpi->imgfmt,
163 if (0) { 160 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
164 dmpi = vf_get_image(vf->next, mpi->imgfmt, 161 mpi->width, mpi->height);
165 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, 162 /* FIXME: Is it ok to discard dmpi if it's not direct? */
166 mpi->width, mpi->height); 163 if (!(dmpi->flags & MP_IMGFLAG_DIRECT)) {
167 /* FIXME: draw into DR buffer */ 164 pullup_pack_frame(c, f);
168 return vf_next_put_image(vf, dmpi); 165 break;
169 } 166 }
170 pullup_pack_frame(c, f); 167 /* Direct render fields into output buffer */
168 p = f->parity;
169 my_memcpy_pic(dmpi->planes[0], f->fields[p]->planes[0],
170 mpi->w, mpi->h/2, dmpi->stride[0]*2, c->stride[0]*2);
171 my_memcpy_pic(dmpi->planes[0] + dmpi->stride[0],
172 f->fields[p^1]->planes[0] + c->stride[0],
173 mpi->w, mpi->h/2, dmpi->stride[0]*2, c->stride[0]*2);
174 if (mpi->flags & MP_IMGFLAG_PLANAR) {
175 my_memcpy_pic(dmpi->planes[1], f->fields[p]->planes[1],
176 mpi->chroma_width, mpi->chroma_height/2,
177 dmpi->stride[1]*2, c->stride[1]*2);
178 my_memcpy_pic(dmpi->planes[1] + dmpi->stride[1],
179 f->fields[p^1]->planes[1] + c->stride[1],
180 mpi->chroma_width, mpi->chroma_height/2,
181 dmpi->stride[1]*2, c->stride[1]*2);
182 my_memcpy_pic(dmpi->planes[2], f->fields[p]->planes[2],
183 mpi->chroma_width, mpi->chroma_height/2,
184 dmpi->stride[2]*2, c->stride[2]*2);
185 my_memcpy_pic(dmpi->planes[2] + dmpi->stride[2],
186 f->fields[p^1]->planes[2] + c->stride[2],
187 mpi->chroma_width, mpi->chroma_height/2,
188 dmpi->stride[2]*2, c->stride[2]*2);
189 }
190 pullup_release_frame(f);
191 return vf_next_put_image(vf, dmpi);
171 } 192 }
172 dmpi = vf_get_image(vf->next, mpi->imgfmt, 193 dmpi = vf_get_image(vf->next, mpi->imgfmt,
173 MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE, 194 MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
174 mpi->width, mpi->height); 195 mpi->width, mpi->height);
175 196