annotate libmpcodecs/mp_image.c @ 29888:5c39c41f38e8

Deobfuscate the special hack to disable cache for live555. Cache can not be used for it, since it does not provide any data stream, the data is provided to the demuxer "behind MPlayer's back".
author reimar
date Tue, 17 Nov 2009 19:23:55 +0000
parents 0f1b5b68af32
children 19414a605695
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23994
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
1
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
2 #include "config.h"
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
3
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
4 #include <stdio.h>
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
5 #include <stdlib.h>
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
6 #include <string.h>
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
7
28594
df67d03dde3b Convert HAVE_MALLOC_H into a 0/1 definition, fixes the warning:
diego
parents: 23994
diff changeset
8 #if HAVE_MALLOC_H
23994
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
9 #include <malloc.h>
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
10 #endif
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
11
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
12 #include "libmpcodecs/img_format.h"
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
13 #include "libmpcodecs/mp_image.h"
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
14
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
15 #include "libvo/fastmemcpy.h"
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
16
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
17 mp_image_t* alloc_mpi(int w, int h, unsigned long int fmt) {
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
18 mp_image_t* mpi = new_mp_image(w,h);
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
19
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
20 mp_image_setfmt(mpi,fmt);
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
21 // IF09 - allocate space for 4. plane delta info - unused
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
22 if (mpi->imgfmt == IMGFMT_IF09)
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
23 {
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
24 mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8+
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
25 mpi->chroma_width*mpi->chroma_height);
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
26 /* delta table, just for fun ;) */
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
27 mpi->planes[3]=mpi->planes[0]+2*(mpi->chroma_width*mpi->chroma_height);
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
28 }
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
29 else
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
30 mpi->planes[0]=memalign(64, mpi->bpp*mpi->width*(mpi->height+2)/8);
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
31 if(mpi->flags&MP_IMGFLAG_PLANAR){
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
32 // YV12/I420/YVU9/IF09. feel free to add other planar formats here...
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
33 if(!mpi->stride[0]) mpi->stride[0]=mpi->width;
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
34 if(!mpi->stride[1]) mpi->stride[1]=mpi->stride[2]=mpi->chroma_width;
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
35 if(mpi->flags&MP_IMGFLAG_SWAPPED){
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
36 // I420/IYUV (Y,U,V)
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
37 mpi->planes[1]=mpi->planes[0]+mpi->width*mpi->height;
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
38 mpi->planes[2]=mpi->planes[1]+mpi->chroma_width*mpi->chroma_height;
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
39 } else {
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
40 // YV12,YVU9,IF09 (Y,V,U)
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
41 mpi->planes[2]=mpi->planes[0]+mpi->width*mpi->height;
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
42 mpi->planes[1]=mpi->planes[2]+mpi->chroma_width*mpi->chroma_height;
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
43 }
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
44 } else {
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
45 if(!mpi->stride[0]) mpi->stride[0]=mpi->width*mpi->bpp/8;
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
46 }
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
47 mpi->flags|=MP_IMGFLAG_ALLOCATED;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28594
diff changeset
48
23994
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
49 return mpi;
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
50 }
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
51
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
52 void copy_mpi(mp_image_t *dmpi, mp_image_t *mpi) {
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
53 if(mpi->flags&MP_IMGFLAG_PLANAR){
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
54 memcpy_pic(dmpi->planes[0],mpi->planes[0], mpi->w, mpi->h,
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
55 dmpi->stride[0],mpi->stride[0]);
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
56 memcpy_pic(dmpi->planes[1],mpi->planes[1], mpi->chroma_width, mpi->chroma_height,
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
57 dmpi->stride[1],mpi->stride[1]);
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
58 memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->chroma_width, mpi->chroma_height,
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
59 dmpi->stride[2],mpi->stride[2]);
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
60 } else {
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28594
diff changeset
61 memcpy_pic(dmpi->planes[0],mpi->planes[0],
23994
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
62 mpi->w*(dmpi->bpp/8), mpi->h,
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
63 dmpi->stride[0],mpi->stride[0]);
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
64 }
8572d2ef5263 Move alloc_mpi and copy_mpi from libmenu/vf_menu.c to libmpcodecs/mp_image.c.
cehoyos
parents:
diff changeset
65 }