Merge branch 'master' of http://repo.or.cz/r/FFMpeg-mirror
[FFMpeg-mirror/DVCPRO-HD.git] / libavcodec / libschroedinger.c
blob8c80c96aca74212faf8848d968170c14c74e8c87
1 /*
2 * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
4 * This file is part of FFmpeg.
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 /**
22 * @file libschroedinger.c
23 * function definitions common to libschroedingerdec.c and libschroedingerenc.c
26 #include "libdirac_libschro.h"
27 #include "libschroedinger.h"
29 /**
30 * Schroedinger video preset table. Ensure that this tables matches up correctly
31 * with the ff_dirac_schro_video_format_info table in libdirac_libschro.c.
33 static const SchroVideoFormatEnum ff_schro_video_formats[]={
34 SCHRO_VIDEO_FORMAT_CUSTOM ,
35 SCHRO_VIDEO_FORMAT_QSIF ,
36 SCHRO_VIDEO_FORMAT_QCIF ,
37 SCHRO_VIDEO_FORMAT_SIF ,
38 SCHRO_VIDEO_FORMAT_CIF ,
39 SCHRO_VIDEO_FORMAT_4SIF ,
40 SCHRO_VIDEO_FORMAT_4CIF ,
41 SCHRO_VIDEO_FORMAT_SD480I_60 ,
42 SCHRO_VIDEO_FORMAT_SD576I_50 ,
43 SCHRO_VIDEO_FORMAT_HD720P_60 ,
44 SCHRO_VIDEO_FORMAT_HD720P_50 ,
45 SCHRO_VIDEO_FORMAT_HD1080I_60 ,
46 SCHRO_VIDEO_FORMAT_HD1080I_50 ,
47 SCHRO_VIDEO_FORMAT_HD1080P_60 ,
48 SCHRO_VIDEO_FORMAT_HD1080P_50 ,
49 SCHRO_VIDEO_FORMAT_DC2K_24 ,
50 SCHRO_VIDEO_FORMAT_DC4K_24 ,
53 SchroVideoFormatEnum ff_get_schro_video_format_preset(AVCodecContext *avccontext)
55 unsigned int num_formats = sizeof(ff_schro_video_formats) /
56 sizeof(ff_schro_video_formats[0]);
58 unsigned int idx = ff_dirac_schro_get_video_format_idx (avccontext);
60 return (idx < num_formats) ?
61 ff_schro_video_formats[idx] : SCHRO_VIDEO_FORMAT_CUSTOM;
64 int ff_get_schro_frame_format (SchroChromaFormat schro_pix_fmt,
65 SchroFrameFormat *schro_frame_fmt)
67 unsigned int num_formats = sizeof(ffmpeg_schro_pixel_format_map) /
68 sizeof(ffmpeg_schro_pixel_format_map[0]);
70 int idx;
72 for (idx = 0; idx < num_formats; ++idx) {
73 if (ffmpeg_schro_pixel_format_map[idx].schro_pix_fmt == schro_pix_fmt) {
74 *schro_frame_fmt =
75 ffmpeg_schro_pixel_format_map[idx].schro_frame_fmt;
76 return 0;
79 return -1;