annotate libmpcodecs/vf_harddup.c @ 16807:f11cf6fe9599

Formal syncing. Typo hunting.
author jheryan
date Wed, 19 Oct 2005 12:09:56 +0000
parents e0b92e840609
children 6ff3379a0862
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12334
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
1 #include <stdio.h>
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
2 #include <stdlib.h>
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
3 #include <string.h>
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
4
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
5 #include "../config.h"
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
6 #include "../mp_msg.h"
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
7
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
8 #include "img_format.h"
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
9 #include "mp_image.h"
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
10 #include "vf.h"
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
11
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
12 #include "../libvo/fastmemcpy.h"
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
13
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
14 struct vf_priv_s {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
15 mp_image_t *last_mpi;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
16 };
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
17
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
18 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi)
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
19 {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
20 mp_image_t *dmpi;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
21 int ret;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
22
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
23 vf->priv->last_mpi = mpi;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
24
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
25 dmpi = vf_get_image(vf->next, mpi->imgfmt,
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
26 MP_IMGTYPE_EXPORT, 0, mpi->width, mpi->height);
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
27
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
28 dmpi->planes[0] = mpi->planes[0];
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
29 dmpi->stride[0] = mpi->stride[0];
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
30 if (dmpi->flags&MP_IMGFLAG_PLANAR) {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
31 dmpi->planes[1] = mpi->planes[1];
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
32 dmpi->stride[1] = mpi->stride[1];
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
33 dmpi->planes[2] = mpi->planes[2];
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
34 dmpi->stride[2] = mpi->stride[2];
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
35 }
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
36
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
37 return vf_next_put_image(vf, dmpi);
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
38 }
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
39
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
40 static int control(struct vf_instance_s* vf, int request, void* data)
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
41 {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
42 switch (request) {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
43 case VFCTRL_DUPLICATE_FRAME:
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
44 if (!vf->priv->last_mpi) break;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
45 // This is a huge hack. We assume nothing
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
46 // has been called earlier in the filter chain
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
47 // since the last put_image. This is reasonable
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
48 // because we're handling a duplicate frame!
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
49 if (put_image(vf, vf->priv->last_mpi))
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
50 return CONTROL_TRUE;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
51 break;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
52 }
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
53 return vf_next_control(vf, request, data);
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
54 }
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
55
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
56 static int query_format(struct vf_instance_s* vf, unsigned int fmt)
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
57 {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
58 /* FIXME - figure out which other formats work */
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
59 switch (fmt) {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
60 case IMGFMT_YV12:
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
61 case IMGFMT_IYUV:
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
62 case IMGFMT_I420:
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
63 return vf_next_query_format(vf, fmt);
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
64 }
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
65 return 0;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
66 }
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
67
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
68 static void uninit(struct vf_instance_s* vf)
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
69 {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
70 free(vf->priv);
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
71 }
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
72
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
73 static int open(vf_instance_t *vf, char* args)
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
74 {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
75 vf->put_image = put_image;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
76 vf->control = control;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
77 vf->uninit = uninit;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
78 vf->priv = calloc(1, sizeof(struct vf_priv_s));
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
79 return 1;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
80 }
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
81
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
82 vf_info_t vf_info_harddup = {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
83 "resubmit duplicate frames for encoding",
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
84 "harddup",
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
85 "Rich Felker",
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
86 "",
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
87 open,
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
88 NULL
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
89 };
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
90
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
91