annotate libvo/jpeg_enc.h @ 35584:fb92c6de7f70

Reduce register usage in an asm block. Reduce to 4 registers in an asm block of render_frame_yuv420p_sse4 with simplification of code. After the modification, this function can still be ~3.5x faster than render_frame_yuv420p.
author upsuper
date Fri, 14 Dec 2012 02:16:30 +0000
parents 0f1b5b68af32
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26739
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 26029
diff changeset
1 /*
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 26029
diff changeset
2 * straightforward (to be) optimized JPEG encoder for the YUV422 format
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 26029
diff changeset
3 * based on MJPEG code from FFmpeg
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 26029
diff changeset
4 *
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 26029
diff changeset
5 * For an excellent introduction to the JPEG format, see:
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 26029
diff changeset
6 * http://www.ece.purdue.edu/~bouman/grad-labs/lab8/pdf/lab.pdf
4651
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
7 *
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
8 * Copyright (c) 2002, Rik Snel
26739
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 26029
diff changeset
9 * parts from FFmpeg Copyright (c) 2000-2002 Fabrice Bellard
4651
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
10 *
26739
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 26029
diff changeset
11 * This file is part of MPlayer.
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 26029
diff changeset
12 *
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 26029
diff changeset
13 * MPlayer is free software; you can redistribute it and/or modify
4651
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
14 * it under the terms of the GNU General Public License as published by
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
15 * the Free Software Foundation; either version 2 of the License, or
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
16 * (at your option) any later version.
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
17 *
26739
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 26029
diff changeset
18 * MPlayer is distributed in the hope that it will be useful,
4651
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
21 * GNU General Public License for more details.
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
22 *
26739
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 26029
diff changeset
23 * You should have received a copy of the GNU General Public License along
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 26029
diff changeset
24 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 26029
diff changeset
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
4651
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
26 */
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
27
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25553
diff changeset
28 #ifndef MPLAYER_JPEG_ENC_H
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25553
diff changeset
29 #define MPLAYER_JPEG_ENC_H
4651
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
30
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
31 typedef struct {
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
32 struct MpegEncContext *s;
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
33 int cheap_upsample;
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
34 int bw;
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
35 int y_ps;
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
36 int u_ps;
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
37 int v_ps;
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
38 int y_rs;
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
39 int u_rs;
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
40 int v_rs;
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
41 } jpeg_enc_t;
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
42
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
43 jpeg_enc_t *jpeg_enc_init(int w, int h, int y_psize, int y_rsize,
4651
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
44 int u_psize, int u_rsize, int v_psize, int v_rsize,
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
45 int cu, int q, int b);
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
46
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
47 int jpeg_enc_frame(jpeg_enc_t *j, unsigned char *y_data,
4651
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
48 unsigned char *u_data, unsigned char *v_data, char *bufr);
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
49
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
50 void jpeg_enc_uninit(jpeg_enc_t *j);
25553
6ac1ece1f9fe Add multiple inclusion guards to all header files that lack them.
diego
parents: 21977
diff changeset
51
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25553
diff changeset
52 #endif /* MPLAYER_JPEG_ENC_H */