annotate libmpcodecs/vf_softskip.c @ 28765:771dce7d5e82

synced with r28788
author Gabrov
date Tue, 03 Mar 2009 09:19:35 +0000
parents 00fff9a3b735
children 0f1b5b68af32
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12337
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
1 #include <stdio.h>
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
2 #include <stdlib.h>
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
3 #include <string.h>
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
4
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 12337
diff changeset
5 #include "config.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 12337
diff changeset
6 #include "mp_msg.h"
12337
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
7
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
8 #include "img_format.h"
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
9 #include "mp_image.h"
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
10 #include "vf.h"
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
11
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
12 struct vf_priv_s {
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
13 int skipflag;
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
14 };
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
15
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17012
diff changeset
16 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
12337
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
17 {
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
18 mp_image_t *dmpi;
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
19
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
20 if (vf->priv->skipflag)
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
21 return vf->priv->skipflag = 0;
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
22
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
23 dmpi = vf_get_image(vf->next, mpi->imgfmt,
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
24 MP_IMGTYPE_EXPORT, 0, mpi->width, mpi->height);
21698
009635b12924 Pass quant tables to next filters
gpoirier
parents: 17906
diff changeset
25 vf_clone_mpi_attributes(dmpi, mpi);
12337
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
26
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
27 dmpi->planes[0] = mpi->planes[0];
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
28 dmpi->stride[0] = mpi->stride[0];
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
29 if (dmpi->flags&MP_IMGFLAG_PLANAR) {
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
30 dmpi->planes[1] = mpi->planes[1];
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
31 dmpi->stride[1] = mpi->stride[1];
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
32 dmpi->planes[2] = mpi->planes[2];
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
33 dmpi->stride[2] = mpi->stride[2];
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
34 }
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
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);
12337
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
37 }
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
38
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
39 static int control(struct vf_instance_s* vf, int request, void* data)
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
40 {
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
41 switch (request) {
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
42 case VFCTRL_SKIP_NEXT_FRAME:
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
43 vf->priv->skipflag = 1;
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
44 return CONTROL_TRUE;
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
45 }
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
46 return vf_next_control(vf, request, data);
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
47 }
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
48
24605
8a6f80593529 Disable unused query_format functions for now until they are
diego
parents: 23373
diff changeset
49 #if 0
12337
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
50 static int query_format(struct vf_instance_s* vf, unsigned int fmt)
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
51 {
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
52 /* FIXME - figure out which other formats work */
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
53 switch (fmt) {
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
54 case IMGFMT_YV12:
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
55 case IMGFMT_IYUV:
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
56 case IMGFMT_I420:
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
57 return vf_next_query_format(vf, fmt);
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
58 }
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
59 return 0;
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
60 }
24605
8a6f80593529 Disable unused query_format functions for now until they are
diego
parents: 23373
diff changeset
61 #endif
12337
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
62
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
63 static void uninit(struct vf_instance_s* vf)
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
64 {
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
65 free(vf->priv);
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
66 }
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
67
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
68 static int open(vf_instance_t *vf, char* args)
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
69 {
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
70 vf->put_image = put_image;
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
71 vf->control = control;
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
72 vf->uninit = uninit;
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
73 vf->priv = calloc(1, sizeof(struct vf_priv_s));
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
74 return 1;
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
75 }
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
76
25221
00fff9a3b735 Make all vf_info_t structs const
reimar
parents: 24605
diff changeset
77 const vf_info_t vf_info_softskip = {
12337
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
78 "soft (post-filter) frame skipping for encoding",
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
79 "softskip",
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
80 "Rich Felker",
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
81 "",
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
82 open,
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
83 NULL
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
84 };
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
85
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
86