Mercurial > mplayer.hg
annotate libmpcodecs/vf_harddup.c @ 23541:5fda2824ce8a
add missing IDCT algothim, as defined in libavcodec/avcodec.h
author | gpoirier |
---|---|
date | Sat, 16 Jun 2007 11:49:11 +0000 |
parents | f8d4f8eff72b |
children | cbc7ab25255e |
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 | 5 #include "config.h" |
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 |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
12 struct vf_priv_s { |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
13 mp_image_t *last_mpi; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
14 }; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
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) |
12334
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 mp_image_t *dmpi; |
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 vf->priv->last_mpi = mpi; |
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 dmpi = vf_get_image(vf->next, mpi->imgfmt, |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
23 MP_IMGTYPE_EXPORT, 0, mpi->width, mpi->height); |
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->planes[0] = mpi->planes[0]; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
26 dmpi->stride[0] = mpi->stride[0]; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
27 if (dmpi->flags&MP_IMGFLAG_PLANAR) { |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
28 dmpi->planes[1] = mpi->planes[1]; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
29 dmpi->stride[1] = mpi->stride[1]; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
30 dmpi->planes[2] = mpi->planes[2]; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
31 dmpi->stride[2] = mpi->stride[2]; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
32 } |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
33 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
34 return vf_next_put_image(vf, dmpi, pts); |
12334
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 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
|
38 { |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
39 switch (request) { |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
40 case VFCTRL_DUPLICATE_FRAME: |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
41 if (!vf->priv->last_mpi) break; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
42 // This is a huge hack. We assume nothing |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
43 // has been called earlier in the filter chain |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
44 // since the last put_image. This is reasonable |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
45 // 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
|
46 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
|
47 return CONTROL_TRUE; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
48 break; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
49 } |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
50 return vf_next_control(vf, request, data); |
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 |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
53 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
|
54 { |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
55 /* FIXME - figure out which other formats work */ |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
56 switch (fmt) { |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
57 case IMGFMT_YV12: |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
58 case IMGFMT_IYUV: |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
59 case IMGFMT_I420: |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
60 return vf_next_query_format(vf, fmt); |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
61 } |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
62 return 0; |
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 |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
65 static void uninit(struct vf_instance_s* vf) |
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 free(vf->priv); |
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 |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
70 static int open(vf_instance_t *vf, char* args) |
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 vf->put_image = put_image; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
73 vf->control = control; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
74 vf->uninit = uninit; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
75 vf->priv = calloc(1, sizeof(struct vf_priv_s)); |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
76 return 1; |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
77 } |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
78 |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
79 vf_info_t vf_info_harddup = { |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
80 "resubmit duplicate frames for encoding", |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
81 "harddup", |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
82 "Rich Felker", |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
83 "", |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
84 open, |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
85 NULL |
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 |
eeddcef4fb08
"hard" frame duplication for mencoder. this finally makes it possible
rfelker
parents:
diff
changeset
|
88 |