annotate libschroedinger.h @ 10061:09f2db2d7c90 libavcodec

Fix bug caused by difference in stride and picture width. When a frame is allocated using libschroedinger routines, the frame data size does not match the actual frame size if the width is not a multiple of 16. So we cannot do a straightforward memcpy of the frame returned by libschroedinger into the FFmpeg picture as the stride differs from the width. Fix this bug by allocating for the libschroedinger frame with the dimensions in AVCodecContext within libavcodec and passing the frame to libschroedinger. patch by Anuradha Suraparaju, anuradha rd.bbc.co uk
author diego
date Sat, 15 Aug 2009 11:59:53 +0000
parents 965220ebc611
children 7dd2a45249a9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6738
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
1 /*
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
2 * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
3 *
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
4 * This file is part of FFmpeg.
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
5 *
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
10 *
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
14 * Lesser General Public License for more details.
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
15 *
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
19 */
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
20
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
21 /**
8718
e9d9d946f213 Use full internal pathname in doxygen @file directives.
diego
parents: 8590
diff changeset
22 * @file libavcodec/libschroedinger.h
6738
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
23 * data structures common to libschroedingerdec.c and libschroedingerenc.c
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
24 */
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
25
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 6738
diff changeset
26 #ifndef AVCODEC_LIBSCHROEDINGER_H
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 6738
diff changeset
27 #define AVCODEC_LIBSCHROEDINGER_H
6738
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
28
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
29 #include <schroedinger/schrobitstream.h>
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
30 #include <schroedinger/schroframe.h>
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
31 #include "avcodec.h"
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
32
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
33 static const struct {
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
34 enum PixelFormat ff_pix_fmt;
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
35 SchroChromaFormat schro_pix_fmt;
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
36 SchroFrameFormat schro_frame_fmt;
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
37 } ffmpeg_schro_pixel_format_map[] = {
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
38 { PIX_FMT_YUV420P, SCHRO_CHROMA_420, SCHRO_FRAME_FORMAT_U8_420 },
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
39 { PIX_FMT_YUV422P, SCHRO_CHROMA_422, SCHRO_FRAME_FORMAT_U8_422 },
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
40 { PIX_FMT_YUV444P, SCHRO_CHROMA_444, SCHRO_FRAME_FORMAT_U8_444 },
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
41 };
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
42
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
43 /**
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
44 * Returns the video format preset matching the input video dimensions and
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
45 * time base.
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
46 */
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
47 SchroVideoFormatEnum ff_get_schro_video_format_preset (AVCodecContext *avccontext);
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
48
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
49 /**
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
50 * Sets the Schroedinger frame format corresponding to the Schro chroma format
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
51 * passed. Returns 0 on success, -1 on failure.
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
52 */
10060
965220ebc611 cosmetics: indentation, prettyprinting, K&R coding style
diego
parents: 10041
diff changeset
53 int ff_get_schro_frame_format(SchroChromaFormat schro_chroma_fmt,
965220ebc611 cosmetics: indentation, prettyprinting, K&R coding style
diego
parents: 10041
diff changeset
54 SchroFrameFormat *schro_frame_fmt);
6738
bdacae101076 Add Dirac support through libschroedinger.
diego
parents:
diff changeset
55
10061
09f2db2d7c90 Fix bug caused by difference in stride and picture width.
diego
parents: 10060
diff changeset
56 /**
09f2db2d7c90 Fix bug caused by difference in stride and picture width.
diego
parents: 10060
diff changeset
57 * Create a Schro frame based on the dimensions and frame format
09f2db2d7c90 Fix bug caused by difference in stride and picture width.
diego
parents: 10060
diff changeset
58 * passed. Returns a pointer to a frame on success, NULL on failure.
09f2db2d7c90 Fix bug caused by difference in stride and picture width.
diego
parents: 10060
diff changeset
59 */
09f2db2d7c90 Fix bug caused by difference in stride and picture width.
diego
parents: 10060
diff changeset
60 SchroFrame *ff_create_schro_frame(AVCodecContext *avccontext,
09f2db2d7c90 Fix bug caused by difference in stride and picture width.
diego
parents: 10060
diff changeset
61 SchroFrameFormat schro_frame_fmt);
09f2db2d7c90 Fix bug caused by difference in stride and picture width.
diego
parents: 10060
diff changeset
62
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 6738
diff changeset
63 #endif /* AVCODEC_LIBSCHROEDINGER_H */