comparison dvbsubdec.c @ 5354:dfa6e7fa2bac libavcodec

create colorspace.h and use it where appropriate patch by Ian Caulfield: /ian caulfield gmail com/
author benoit
date Tue, 17 Jul 2007 12:33:14 +0000
parents 6258f497d42e
children 9f8219a3b86f
comparison
equal deleted inserted replaced
5353:7e4703e16bbd 5354:dfa6e7fa2bac
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */ 20 */
21 #include "avcodec.h" 21 #include "avcodec.h"
22 #include "dsputil.h" 22 #include "dsputil.h"
23 #include "bitstream.h" 23 #include "bitstream.h"
24 #include "colorspace.h"
24 25
25 //#define DEBUG 26 //#define DEBUG
26 //#define DEBUG_PACKET_CONTENTS 27 //#define DEBUG_PACKET_CONTENTS
27 //#define DEBUG_SAVE_IMAGES 28 //#define DEBUG_SAVE_IMAGES
28 29
892 av_log(avctx, AV_LOG_ERROR, "Unknown object coding %d\n", coding_method); 893 av_log(avctx, AV_LOG_ERROR, "Unknown object coding %d\n", coding_method);
893 } 894 }
894 895
895 } 896 }
896 897
897 #define SCALEBITS 10
898 #define ONE_HALF (1 << (SCALEBITS - 1))
899 #define FIX(x) ((int) ((x) * (1<<SCALEBITS) + 0.5))
900
901 #define YUV_TO_RGB1_CCIR(cb1, cr1)\
902 {\
903 cb = (cb1) - 128;\
904 cr = (cr1) - 128;\
905 r_add = FIX(1.40200*255.0/224.0) * cr + ONE_HALF;\
906 g_add = - FIX(0.34414*255.0/224.0) * cb - FIX(0.71414*255.0/224.0) * cr + \
907 ONE_HALF;\
908 b_add = FIX(1.77200*255.0/224.0) * cb + ONE_HALF;\
909 }
910
911 #define YUV_TO_RGB2_CCIR(r, g, b, y1)\
912 {\
913 y = ((y1) - 16) * FIX(255.0/219.0);\
914 r = cm[(y + r_add) >> SCALEBITS];\
915 g = cm[(y + g_add) >> SCALEBITS];\
916 b = cm[(y + b_add) >> SCALEBITS];\
917 }
918
919
920 static void dvbsub_parse_clut_segment(AVCodecContext *avctx, 898 static void dvbsub_parse_clut_segment(AVCodecContext *avctx,
921 uint8_t *buf, int buf_size) 899 uint8_t *buf, int buf_size)
922 { 900 {
923 DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data; 901 DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
924 902