patch by Vitor: \vitor1001 gmail com/ original thread: [FFmpeg-devel] RoQ video encoder (take 3) date: 06/08/2007 10:34 PM Originally committed as revision 9420 to svn://svn.ffmpeg.org/ffmpeg/trunktags/v0.5
| @@ -87,6 +87,7 @@ version <next> | |||||
| - extern C declarations for C++ removed from headers | - extern C declarations for C++ removed from headers | ||||
| - sws_flags command line option | - sws_flags command line option | ||||
| - codebook generator | - codebook generator | ||||
| - RoQ video encoder | |||||
| version 0.4.9-pre1: | version 0.4.9-pre1: | ||||
| @@ -1027,7 +1027,7 @@ following image formats are supported: | |||||
| @item Cirrus Logic AccuPak @tab @tab X @tab fourcc: CLJR | @item Cirrus Logic AccuPak @tab @tab X @tab fourcc: CLJR | ||||
| @item 4X Video @tab @tab X @tab Used in certain computer games. | @item 4X Video @tab @tab X @tab Used in certain computer games. | ||||
| @item Sony Playstation MDEC @tab @tab X | @item Sony Playstation MDEC @tab @tab X | ||||
| @item Id RoQ @tab @tab X @tab Used in Quake III, Jedi Knight 2, other computer games. | |||||
| @item Id RoQ @tab X @tab X @tab Used in Quake III, Jedi Knight 2, other computer games. | |||||
| @item Xan/WC3 @tab @tab X @tab Used in Wing Commander III .MVE files. | @item Xan/WC3 @tab @tab X @tab Used in Wing Commander III .MVE files. | ||||
| @item Interplay Video @tab @tab X @tab Used in Interplay .MVE files. | @item Interplay Video @tab @tab X @tab Used in Interplay .MVE files. | ||||
| @item Apple Animation @tab @tab X @tab fourcc: 'rle ' | @item Apple Animation @tab @tab X @tab fourcc: 'rle ' | ||||
| @@ -135,6 +135,7 @@ OBJS-$(CONFIG_QTRLE_DECODER) += qtrle.o | |||||
| OBJS-$(CONFIG_RA_144_DECODER) += ra144.o | OBJS-$(CONFIG_RA_144_DECODER) += ra144.o | ||||
| OBJS-$(CONFIG_RA_288_DECODER) += ra288.o | OBJS-$(CONFIG_RA_288_DECODER) += ra288.o | ||||
| OBJS-$(CONFIG_ROQ_DECODER) += roqvideodec.o roqvideo.o | OBJS-$(CONFIG_ROQ_DECODER) += roqvideodec.o roqvideo.o | ||||
| OBJS-$(CONFIG_ROQ_ENCODER) += roqvideoenc.o roqvideo.o elbg.o | |||||
| OBJS-$(CONFIG_ROQ_DPCM_DECODER) += dpcm.o | OBJS-$(CONFIG_ROQ_DPCM_DECODER) += dpcm.o | ||||
| OBJS-$(CONFIG_ROQ_DPCM_ENCODER) += roqaudioenc.o | OBJS-$(CONFIG_ROQ_DPCM_ENCODER) += roqaudioenc.o | ||||
| OBJS-$(CONFIG_RPZA_DECODER) += rpza.o | OBJS-$(CONFIG_RPZA_DECODER) += rpza.o | ||||
| @@ -124,7 +124,7 @@ void avcodec_register_all(void) | |||||
| REGISTER_DECODER(QPEG, qpeg); | REGISTER_DECODER(QPEG, qpeg); | ||||
| REGISTER_DECODER(QTRLE, qtrle); | REGISTER_DECODER(QTRLE, qtrle); | ||||
| REGISTER_ENCDEC (RAWVIDEO, rawvideo); | REGISTER_ENCDEC (RAWVIDEO, rawvideo); | ||||
| REGISTER_DECODER(ROQ, roq); | |||||
| REGISTER_ENCDEC (ROQ, roq); | |||||
| REGISTER_DECODER(RPZA, rpza); | REGISTER_DECODER(RPZA, rpza); | ||||
| REGISTER_ENCDEC (RV10, rv10); | REGISTER_ENCDEC (RV10, rv10); | ||||
| REGISTER_ENCDEC (RV20, rv20); | REGISTER_ENCDEC (RV20, rv20); | ||||
| @@ -57,6 +57,7 @@ extern AVCodec pgmyuv_encoder; | |||||
| extern AVCodec png_encoder; | extern AVCodec png_encoder; | ||||
| extern AVCodec ppm_encoder; | extern AVCodec ppm_encoder; | ||||
| extern AVCodec roq_dpcm_encoder; | extern AVCodec roq_dpcm_encoder; | ||||
| extern AVCodec roq_encoder; | |||||
| extern AVCodec rv10_encoder; | extern AVCodec rv10_encoder; | ||||
| extern AVCodec rv20_encoder; | extern AVCodec rv20_encoder; | ||||
| extern AVCodec sgi_encoder; | extern AVCodec sgi_encoder; | ||||
| @@ -24,6 +24,7 @@ | |||||
| #include "avcodec.h" | #include "avcodec.h" | ||||
| #include "dsputil.h" | #include "dsputil.h" | ||||
| #include "random.h" | |||||
| typedef struct { | typedef struct { | ||||
| unsigned char y[4]; | unsigned char y[4]; | ||||
| @@ -34,6 +35,10 @@ typedef struct { | |||||
| int idx[4]; | int idx[4]; | ||||
| } roq_qcell; | } roq_qcell; | ||||
| typedef struct { | |||||
| int d[2]; | |||||
| } motion_vect; | |||||
| typedef struct RoqContext { | typedef struct RoqContext { | ||||
| AVCodecContext *avctx; | AVCodecContext *avctx; | ||||
| @@ -41,6 +46,7 @@ typedef struct RoqContext { | |||||
| AVFrame frames[2]; | AVFrame frames[2]; | ||||
| AVFrame *last_frame; | AVFrame *last_frame; | ||||
| AVFrame *current_frame; | AVFrame *current_frame; | ||||
| int first_frame; | |||||
| int y_stride; | int y_stride; | ||||
| int c_stride; | int c_stride; | ||||
| @@ -49,7 +55,22 @@ typedef struct RoqContext { | |||||
| unsigned char *buf; | unsigned char *buf; | ||||
| int size; | int size; | ||||
| int width, height; | |||||
| /* Encoder only data */ | |||||
| AVRandomState randctx; | |||||
| uint64_t lambda; | |||||
| motion_vect *this_motion4; | |||||
| motion_vect *last_motion4; | |||||
| motion_vect *this_motion8; | |||||
| motion_vect *last_motion8; | |||||
| unsigned int framesSinceKeyframe; | |||||
| AVFrame *frame_to_enc; | |||||
| uint8_t *out_buf; | |||||
| } RoqContext; | } RoqContext; | ||||
| #define RoQ_INFO 0x1001 | #define RoQ_INFO 0x1001 | ||||