~ubuntu-branches/ubuntu/maverick/zapping/maverick

« back to all changes in this revision

Viewing changes to libtv/image_format.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2005-11-08 11:07:34 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051108110734-ygvf6uljvgcjmca7
Tags: 0.9.6-1ubuntu1
* Resynchronise with Debian (Closes: #4022):
  - Fix desktop file to not use absolute path.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
18
 */
19
19
 
20
 
/* $Id: image_format.c,v 1.11 2005/02/25 18:14:36 mschimek Exp $ */
 
20
/* $Id: image_format.c,v 1.12 2005/06/28 01:02:51 mschimek Exp $ */
21
21
 
22
22
#include <string.h>             /* memset() */
23
23
#include <assert.h>
35
35
        assert (NULL != format);
36
36
 
37
37
        fprintf (fp, "width=%u height=%u "
38
 
                 "offset=%u,%u,%u,%u bpl=%u,%u,%u,%u "
39
 
                 "size=%u pixfmt=%s",
 
38
                 "offset=%lu,%lu,%lu,%lu bpl=%lu,%lu,%lu,%lu "
 
39
                 "size=%lu pixfmt=%s",
40
40
                 format->width,
41
41
                 format->height,
42
42
                 format->offset[0],
55
55
tv_image_format_init            (tv_image_format *      format,
56
56
                                 unsigned int           width,
57
57
                                 unsigned int           height,
58
 
                                 unsigned int           bytes_per_line,
 
58
                                 unsigned long          bytes_per_line,
59
59
                                 tv_pixfmt              pixfmt,
60
60
                                 tv_colspc              colspc)
61
61
{
62
62
        const tv_pixel_format *pf;
63
 
        unsigned int min_bpl;
 
63
        unsigned long min_bpl;
64
64
 
65
65
        assert (NULL != format);
66
66
 
93
93
        format->offset[0] = 0;
94
94
 
95
95
        if (pf->planar) {
96
 
                unsigned int uv_bpl;
97
 
                unsigned int y_size;
98
 
                unsigned int uv_size;
 
96
                unsigned long uv_bpl;
 
97
                unsigned long y_size;
 
98
                unsigned long uv_size;
99
99
 
100
100
                /* No padding. */
101
101
                uv_bpl = format->bytes_per_line[0] >> pf->uv_hshift;
139
139
tv_image_format_is_valid        (const tv_image_format *format)
140
140
{
141
141
        const tv_pixel_format *pf;
142
 
        unsigned int min_bpl;
143
 
        unsigned int min_size;
 
142
        unsigned long min_bpl;
 
143
        unsigned long min_size;
144
144
 
145
145
        assert (NULL != format);
146
146
 
161
161
        min_size = format->bytes_per_line[0] * (format->height - 1) + min_bpl;
162
162
 
163
163
        if (pf->planar) {
164
 
                unsigned int min_uv_bytes_per_line;
165
 
                unsigned int min_u_size;
166
 
                unsigned int min_v_size;
167
 
                unsigned int p1_offset;
168
 
                unsigned int p2_offset;
 
164
                unsigned long min_uv_bytes_per_line;
 
165
                unsigned long min_u_size;
 
166
                unsigned long min_v_size;
 
167
                unsigned long p1_offset;
 
168
                unsigned long p2_offset;
169
169
                unsigned int hres;
170
170
                unsigned int vres;
171
171
 
231
231
                                 unsigned int           value,
232
232
                                 unsigned int           width,
233
233
                                 unsigned int           height,
234
 
                                 unsigned int           bytes_per_line)
 
234
                                 unsigned long          bytes_per_line)
235
235
{
236
236
        if (width == bytes_per_line) {
237
237
                memset (d, (int) value, width * height);
248
248
                                 unsigned int           value,
249
249
                                 unsigned int           width,
250
250
                                 unsigned int           height,
251
 
                                 unsigned int           bytes_per_line)
 
251
                                 unsigned long          bytes_per_line)
252
252
{
253
253
        uint8_t *p;
254
 
        unsigned int padding;
 
254
        unsigned long padding;
255
255
 
256
256
        padding = bytes_per_line - width * 3;
257
257
 
296
296
                                 unsigned int           value,
297
297
                                 unsigned int           width,
298
298
                                 unsigned int           height,
299
 
                                 unsigned int           bytes_per_line)
 
299
                                 unsigned long          bytes_per_line)
300
300
{
301
301
        uint32_t *p;
302
 
        unsigned int padding;
 
302
        unsigned long padding;
303
303
 
304
304
        padding = bytes_per_line - width * 4;
305
305
 
515
515
        case TV_PIXFMT_BGRA8:
516
516
        case TV_PIXFMT_ARGB8:
517
517
        case TV_PIXFMT_ABGR8:
518
 
                assert (!"reached");
 
518
                assert (0);
519
519
 
520
520
        case TV_PIXFMT_SBGGR:
521
521
                clear_block[0] (data + format->offset[0], 0,
541
541
                                 const void *           src,
542
542
                                 size_t                 n_bytes)
543
543
{
544
 
        if (__builtin_expect (dst == src, FALSE))
 
544
        if (unlikely (dst == src))
545
545
                return;
546
546
 
547
547
#ifdef HAVE_SSE
558
558
        memcpy (dst, src, n_bytes);
559
559
}
560
560
 
561
 
static void
 
561
void
562
562
copy_block1_generic             (void *                 dst,
563
563
                                 const void *           src,
564
564
                                 unsigned int           width,
565
565
                                 unsigned int           height,
566
 
                                 unsigned int           dst_bytes_per_line,
567
 
                                 unsigned int           src_bytes_per_line)
 
566
                                 unsigned long          dst_bytes_per_line,
 
567
                                 unsigned long          src_bytes_per_line)
568
568
{
569
 
        unsigned int dst_padding;
570
 
        unsigned int src_padding;
 
569
        unsigned long dst_padding;
 
570
        unsigned long src_padding;
571
571
        uint8_t *d;
572
572
        const uint8_t *s;
573
573
 
574
574
        dst_padding = dst_bytes_per_line - width * 1;
575
575
        src_padding = src_bytes_per_line - width * 1;
576
576
 
577
 
        if (__builtin_expect (0 == (dst_padding | src_padding), TRUE)) {
 
577
        if (likely (0 == (dst_padding | src_padding))) {
578
578
                memcpy (dst, src, width * height);
579
579
                return;
580
580
        }