annotate libmpcodecs/vf_harddup.c @ 20300:30b75e573d5c

r20288: vf uspp description: it now uses snow, not mpeg4 r20304: What is the meaning of the numbers on the status line during the encoding process?
author kraymer
date Thu, 19 Oct 2006 13:19:41 +0000
parents 6a08d0dabca8
children f8d4f8eff72b
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
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 12336
diff changeset
5 #include "config.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 12336
diff changeset
6 #include "mp_msg.h"
12334
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
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 12336
diff changeset
12 #include "libvo/fastmemcpy.h"
12334
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
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17012
diff changeset
18 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
12334
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
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
22 vf->priv->last_mpi = mpi;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
23
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
24 dmpi = vf_get_image(vf->next, mpi->imgfmt,
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
25 MP_IMGTYPE_EXPORT, 0, mpi->width, mpi->height);
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
26
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
27 dmpi->planes[0] = mpi->planes[0];
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
28 dmpi->stride[0] = mpi->stride[0];
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
29 if (dmpi->flags&MP_IMGFLAG_PLANAR) {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
30 dmpi->planes[1] = mpi->planes[1];
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
31 dmpi->stride[1] = mpi->stride[1];
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
32 dmpi->planes[2] = mpi->planes[2];
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
33 dmpi->stride[2] = mpi->stride[2];
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
34 }
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
35
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17012
diff changeset
36 return vf_next_put_image(vf, dmpi, pts);
12334
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
37 }
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 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
40 {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
41 switch (request) {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
42 case VFCTRL_DUPLICATE_FRAME:
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
43 if (!vf->priv->last_mpi) break;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
44 // This is a huge hack. We assume nothing
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
45 // has been called earlier in the filter chain
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
46 // since the last put_image. This is reasonable
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
47 // because we're handling a duplicate frame!
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17012
diff changeset
48 if (put_image(vf, vf->priv->last_mpi, MP_NOPTS_VALUE))
12334
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
49 return CONTROL_TRUE;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
50 break;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
51 }
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
52 return vf_next_control(vf, request, data);
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
53 }
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 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
56 {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
57 /* FIXME - figure out which other formats work */
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
58 switch (fmt) {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
59 case IMGFMT_YV12:
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
60 case IMGFMT_IYUV:
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
61 case IMGFMT_I420:
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
62 return vf_next_query_format(vf, fmt);
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
63 }
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
64 return 0;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
65 }
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 static void uninit(struct vf_instance_s* vf)
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
68 {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
69 free(vf->priv);
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
70 }
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 static int open(vf_instance_t *vf, char* args)
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
73 {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
74 vf->put_image = put_image;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
75 vf->control = control;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
76 vf->uninit = uninit;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
77 vf->priv = calloc(1, sizeof(struct vf_priv_s));
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
78 return 1;
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
79 }
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 vf_info_t vf_info_harddup = {
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
82 "resubmit duplicate frames for encoding",
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
83 "harddup",
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
84 "Rich Felker",
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
85 "",
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
86 open,
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
87 NULL
eeddcef4fb08 "hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff changeset
88 };
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