annotate libmpcodecs/vf_softskip.c @ 13877:a4a28364b79b

10l
author faust3
date Fri, 05 Nov 2004 13:48:41 +0000
parents 6f1b4c989914
children 6ff3379a0862
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
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
5 #include "../config.h"
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
6 #include "../mp_msg.h"
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 #include "../libvo/fastmemcpy.h"
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
13
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
14 struct vf_priv_s {
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
15 int skipflag;
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
16 };
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 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi)
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 mp_image_t *dmpi;
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
21
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
22 if (vf->priv->skipflag)
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
23 return vf->priv->skipflag = 0;
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
24
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
25 dmpi = vf_get_image(vf->next, mpi->imgfmt,
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
26 MP_IMGTYPE_EXPORT, 0, mpi->width, mpi->height);
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
27
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
28 dmpi->planes[0] = mpi->planes[0];
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
29 dmpi->stride[0] = mpi->stride[0];
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
30 if (dmpi->flags&MP_IMGFLAG_PLANAR) {
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
31 dmpi->planes[1] = mpi->planes[1];
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
32 dmpi->stride[1] = mpi->stride[1];
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
33 dmpi->planes[2] = mpi->planes[2];
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
34 dmpi->stride[2] = mpi->stride[2];
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
35 }
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
36
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
37 return vf_next_put_image(vf, dmpi);
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
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
40 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
41 {
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
42 switch (request) {
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
43 case VFCTRL_SKIP_NEXT_FRAME:
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
44 vf->priv->skipflag = 1;
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
45 return CONTROL_TRUE;
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
46 }
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
47 return vf_next_control(vf, request, data);
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
48 }
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
49
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 }
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
61
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
62 static void uninit(struct vf_instance_s* vf)
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
63 {
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
64 free(vf->priv);
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
65 }
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 static int open(vf_instance_t *vf, char* args)
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
68 {
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
69 vf->put_image = put_image;
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
70 vf->control = control;
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
71 vf->uninit = uninit;
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
72 vf->priv = calloc(1, sizeof(struct vf_priv_s));
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
73 return 1;
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
74 }
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 vf_info_t vf_info_softskip = {
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
77 "soft (post-filter) frame skipping for encoding",
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
78 "softskip",
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
79 "Rich Felker",
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
80 "",
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
81 open,
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
82 NULL
6f1b4c989914 soft skipping for mencoder. rather than skipping decoding/filtering
rfelker
parents:
diff changeset
83 };
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