4 #include "colormodels.h"
5 #include "funcprotos.h"
7 #include "workarounds.h"
8 #include ENCORE_INCLUDE
9 #include DECORE_INCLUDE
19 unsigned char *work_buffer
;
22 int decode_initialized
[FIELDS
];
23 int encode_initialized
[FIELDS
];
24 // For heroine 60 encoding, we want different streams for each field.
27 long rc_period
; // the intended rate control averaging period
28 long rc_reaction_period
; // the reation period for rate control
29 long rc_reaction_ratio
; // the ratio for down/up rate control
30 long max_key_interval
; // the maximum interval between key frames
31 int max_quantizer
; // the upper limit of the quantizer
32 int min_quantizer
; // the lower limit of the quantizer
33 int quantizer
; // For vbr
34 int quality
; // the forward search range for motion estimation
39 long last_frame
[FIELDS
];
40 int encode_handle
[FIELDS
];
42 DEC_PARAM dec_param
[FIELDS
];
43 ENC_PARAM enc_param
[FIELDS
];
45 int decode_handle
[FIELDS
];
46 // Must count pframes in VBR
48 } quicktime_divx_codec_t
;
50 static pthread_mutex_t encode_mutex
;
51 static pthread_mutex_t decode_mutex
;
52 static int mutex_initialized
= 0;
53 static int decode_handle
= 1;
54 static int encode_handle
= 0;
56 static int delete_codec(quicktime_video_map_t
*vtrack
)
58 quicktime_divx_codec_t
*codec
;
60 //printf("delete_codec 1\n");
63 codec
= ((quicktime_codec_t
*)vtrack
->codec
)->priv
;
64 for(i
= 0; i
< codec
->total_fields
; i
++)
66 if(codec
->encode_initialized
[i
])
68 pthread_mutex_lock(&encode_mutex
);
69 encore(codec
->encode_handle
[i
],
73 pthread_mutex_unlock(&encode_mutex
);
76 if(codec
->decode_initialized
[i
])
78 pthread_mutex_lock(&decode_mutex
);
80 decore_set_global(&codec
->dec_param
[i
]);
81 decore(codec
->decode_handle
[i
],
86 free(codec
->dec_param
[i
].buffers
.mp4_edged_ref_buffers
);
87 free(codec
->dec_param
[i
].buffers
.mp4_edged_for_buffers
);
88 free(codec
->dec_param
[i
].buffers
.mp4_display_buffers
);
89 free(codec
->dec_param
[i
].buffers
.mp4_state
);
90 free(codec
->dec_param
[i
].buffers
.mp4_tables
);
91 free(codec
->dec_param
[i
].buffers
.mp4_stream
);
93 pthread_mutex_unlock(&decode_mutex
);
96 pthread_mutex_unlock(&decode_mutex
);
99 if(codec
->temp_frame
) free(codec
->temp_frame
);
100 if(codec
->work_buffer
) free(codec
->work_buffer
);
104 //printf("delete_codec 100\n");
108 static int reads_colormodel(quicktime_t
*file
,
112 return (colormodel
== BC_YUV420P
);
115 static int writes_colormodel(quicktime_t
*file
,
119 return (colormodel
== BC_RGB888
||
120 colormodel
== BC_RGBA8888
||
121 colormodel
== BC_RGB161616
||
122 colormodel
== BC_RGBA16161616
||
123 colormodel
== BC_YUV888
||
124 colormodel
== BC_YUVA8888
||
125 colormodel
== BC_YUV161616
||
126 colormodel
== BC_YUVA16161616
||
127 colormodel
== BC_YUV420P
||
128 colormodel
== BC_YUV422
||
129 colormodel
== BC_COMPRESSED
);
139 static void init_mutex()
141 if(!mutex_initialized
)
143 pthread_mutexattr_t attr
;
144 mutex_initialized
= 1;
145 pthread_mutexattr_init(&attr
);
146 pthread_mutex_init(&decode_mutex
, &attr
);
147 pthread_mutex_init(&encode_mutex
, &attr
);
154 // Determine of the compressed frame is a keyframe for direct copy
155 int quicktime_divx_is_key(unsigned char *data
, long size
)
160 for(i
= 0; i
< size
- 5; i
++)
162 if( data
[i
] == 0x00 &&
163 data
[i
+ 1] == 0x00 &&
164 data
[i
+ 2] == 0x01 &&
167 if((data
[i
+ 4] & 0xc0) == 0x0)
178 // Test for VOL header in frame
179 int quicktime_divx_has_vol(unsigned char *data
)
181 if( data
[0] == 0x00 &&
197 static void putbits(unsigned char **data
,
204 value
&= 0xffffffffffffffff >> (64 - count
);
206 while(64 - *bit_pos
< count
)
208 *(*data
)++ = (*bit_store
) >> 56;
213 (*bit_store
) |= value
<< (64 - count
- *bit_pos
);
219 static void flushbits(unsigned char **data
,
223 //printf("flushbits %llx\n", (*bit_store));
224 while((*bit_pos
) > 0)
226 *(*data
)++ = (*bit_store
) >> 56;
235 #define VO_START_CODE 0x8
236 #define VO_START_CODE_LENGTH 27
237 #define VOL_START_CODE 0x12 /* 25-MAR-97 JDL : according to WD2 */
238 #define VOL_START_CODE_LENGTH 28
242 int quicktime_divx_write_vol(unsigned char *data_start
,
245 int time_increment_resolution
,
249 int bits
, fixed_vop_time_increment
;
250 unsigned char *data
= data_start
;
257 vol_width
= (int)((float)vol_width
/ 16 + 0.5) * 16;
258 vol_height
= (int)((float)vol_height
/ 16 + 0.5) * 16;
265 VO_START_CODE_LENGTH
, VO_START_CODE
);
270 5, 0); /* vo_id = 0 */
276 VOL_START_CODE_LENGTH
, VOL_START_CODE
);
285 4, 0); /* vol_id = 0 */
291 1, 0); /* random_accessible_vol = 0 */
296 8, 1); /* video_object_type_indication = 1 video */
301 1, 1); /* is_object_layer_identifier = 1 */
306 4, 2); /* visual_object_layer_ver_id = 2 */
311 3, 1); /* visual_object_layer_priority = 1 */
316 4, 1); /* aspect_ratio_info = 1 */
328 1, 0); /* vol_control_parameter = 0 */
333 2, 0); /* vol_shape = 0 rectangular */
350 16, time_increment_resolution
);
360 1, 1); /* fixed_vop_rate = 1 */
364 while((1 << bits
) < time_increment_resolution
) bits
++;
366 // Log calculation fails for some reason
367 // bits = (int)ceil(log((double)time_increment_resolution) / log(2.0));
368 // if (bits < 1) bits=1;
370 fixed_vop_time_increment
=
371 (int)(time_increment_resolution
/ frame_rate
+ 0.1);
377 bits
, fixed_vop_time_increment
);
410 1, 0); /* interlaced = 0 */
415 1, 1); /* OBMC_disabled = 1 */
420 2, 0); /* vol_sprite_usage = 0 */
425 1, 0); /* not_8_bit = 0 */
431 1, 0); /* vol_quant_type = 0 */
436 1, 0); /* vol_quarter_pixel = 0 */
441 1, 1); /* complexity_estimation_disabled = 1 */
446 1, 1); /* resync_marker_disabled = 1 */
451 1, 0); /* data_partitioning_enabled = 0 */
456 1, 0); /* scalability = 0 */
465 * for(i = 0; i < data - data_start; i++)
466 * for(j = 0x80; j >= 1; j /= 2)
467 * printf("%d", (data_start[i] & j) ? 1 : 0);
473 return data
- data_start
;
480 #define READ_RAW(framenum) \
482 quicktime_set_video_position(file, framenum, track); \
483 bytes = quicktime_frame_size(file, framenum, track); \
484 if(!codec->work_buffer || codec->buffer_size < bytes) \
486 if(codec->work_buffer) free(codec->work_buffer); \
487 codec->buffer_size = bytes; \
488 codec->work_buffer = calloc(1, codec->buffer_size + 100); \
490 result = !quicktime_read_data(file, codec->work_buffer, bytes); \
497 static int decode(quicktime_t
*file
, unsigned char **row_pointers
, int track
)
502 quicktime_video_map_t
*vtrack
= &(file
->vtracks
[track
]);
503 quicktime_trak_t
*trak
= vtrack
->track
;
504 quicktime_divx_codec_t
*codec
= ((quicktime_codec_t
*)vtrack
->codec
)->priv
;
505 int width
= trak
->tkhd
.track_width
;
506 int height
= trak
->tkhd
.track_height
;
507 int width_i
= (int)((float)width
/ 16 + 0.5) * 16;
508 int height_i
= (int)((float)height
/ 16 + 0.5) * 16;
512 char *bmp_pointers
[3];
514 int current_field
= vtrack
->current_position
% codec
->total_fields
;
519 pthread_mutex_lock(&decode_mutex
);
527 * printf("decode 1 %d %d %d\n",
528 * vtrack->current_position,
530 * codec->decode_initialized[current_field]);
537 if(!codec
->decode_initialized
[current_field
])
539 DEC_MEM_REQS dec_mem_reqs
;
542 if(!codec
->temp_frame
)
543 codec
->temp_frame
= malloc(width_i
* height_i
* 3 / 2);
545 // decore requires handle to be > 1
546 codec
->decode_handle
[current_field
] = decode_handle
++;
547 codec
->last_frame
[current_field
] = -1;
548 codec
->dec_param
[current_field
].x_dim
= width_i
;
549 codec
->dec_param
[current_field
].y_dim
= height_i
;
550 codec
->dec_param
[current_field
].output_format
= DEC_420
;
551 codec
->dec_param
[current_field
].time_incr
= 0;
553 decore(codec
->decode_handle
[current_field
],
555 &codec
->dec_param
[current_field
],
557 codec
->dec_param
[current_field
].buffers
.mp4_edged_ref_buffers
=
558 calloc(1, dec_mem_reqs
.mp4_edged_ref_buffers_size
);
559 codec
->dec_param
[current_field
].buffers
.mp4_edged_for_buffers
=
560 calloc(1, dec_mem_reqs
.mp4_edged_for_buffers_size
);
561 codec
->dec_param
[current_field
].buffers
.mp4_display_buffers
=
562 calloc(1, dec_mem_reqs
.mp4_display_buffers_size
);
563 codec
->dec_param
[current_field
].buffers
.mp4_state
=
564 calloc(1, dec_mem_reqs
.mp4_state_size
);
565 codec
->dec_param
[current_field
].buffers
.mp4_tables
=
566 calloc(1, dec_mem_reqs
.mp4_tables_size
);
567 codec
->dec_param
[current_field
].buffers
.mp4_stream
=
568 calloc(1, dec_mem_reqs
.mp4_stream_size
);
569 //printf("decode 2\n");
570 decore(codec
->decode_handle
[current_field
],
572 &codec
->dec_param
[current_field
],
575 //printf("decode 3\n");
579 // Must decode frame with VOL header first but only the first frame in the
580 // field sequence has a VOL header.
581 temp_position
= vtrack
->current_position
;
582 READ_RAW(current_field
);
583 vtrack
->current_position
= temp_position
;
584 dec_frame
.bitstream
= codec
->work_buffer
;
585 dec_frame
.length
= bytes
;
586 dec_frame
.stride
= width_i
;
587 dec_frame
.render_flag
= 0;
588 dec_frame
.bmp
[0] = codec
->temp_frame
;
589 dec_frame
.bmp
[1] = codec
->temp_frame
+ width_i
* height_i
;
590 dec_frame
.bmp
[2] = codec
->temp_frame
+ width_i
* height_i
* 5 / 4;
591 decore(codec
->decode_handle
[current_field
], 0, &dec_frame
, NULL
);
594 //printf("decode 9\n");
596 codec
->decode_initialized
[current_field
] = 1;
597 decore_save_global(&codec
->dec_param
[current_field
]);
599 //printf("decode 10\n");
601 decore_set_global(&codec
->dec_param
[current_field
]);
603 // Enable deblocking. This doesn't make much difference at high bitrates.
605 dec_set_arg
.postproc_level
= (codec
->use_deblocking
? 100 : 0);
606 decore(codec
->decode_handle
[current_field
],
610 //printf("decode 30\n");
614 input_cmodel
= BC_YUV420P
;
616 // Decode directly into return values
617 if(file
->color_model
== input_cmodel
&&
618 file
->out_w
== width_i
&&
619 file
->out_h
== height_i
&&
622 file
->in_w
== width_i
&&
623 file
->in_h
== height_i
)
625 // dec_frame.dst = row_pointers[0];
626 dec_frame
.bmp
[0] = row_pointers
[0];
627 dec_frame
.bmp
[1] = row_pointers
[1];
628 dec_frame
.bmp
[2] = row_pointers
[2];
632 // Decode into temporaries
634 dec_frame
.bmp
[0] = codec
->temp_frame
;
635 dec_frame
.bmp
[1] = codec
->temp_frame
+ width_i
* height_i
;
636 dec_frame
.bmp
[2] = codec
->temp_frame
+ width_i
* height_i
* 5 / 4;
640 //printf("decode 40\n");
641 dec_frame
.stride
= width_i
;
654 //printf("decode 1 %d %d\n", codec->last_frame, vtrack->current_position);
656 if(quicktime_has_keyframes(file
, track
) &&
657 vtrack
->current_position
!=
658 codec
->last_frame
[current_field
] + codec
->total_fields
)
660 int frame1
, frame2
= vtrack
->current_position
, current_frame
= frame2
;
662 // Get first keyframe of same field
665 frame1
= quicktime_get_keyframe_before(file
,
668 }while(frame1
> 0 && (frame1
% codec
->total_fields
) != current_field
);
671 // Keyframe is before last decoded frame and current frame is after last decoded
672 // frame, so instead of rerendering from the last keyframe we can rerender from
673 // the last decoded frame.
674 if(frame1
< codec
->last_frame
[current_field
] &&
675 frame2
> codec
->last_frame
[current_field
])
676 frame1
= codec
->last_frame
[current_field
] + codec
->total_fields
;
678 // Render up to current position
679 while(frame1
< frame2
)
683 dec_frame
.bitstream
= codec
->work_buffer
;
684 dec_frame
.length
= bytes
;
685 dec_frame
.render_flag
= 0;
686 decore(codec
->decode_handle
[current_field
],
690 frame1
+= codec
->total_fields
;
694 vtrack
->current_position
= frame2
;
701 //printf("decode 50\n");
711 codec
->last_frame
[current_field
] = vtrack
->current_position
;
712 //printf("decode 1\n");
715 READ_RAW(vtrack
->current_position
);
719 //printf("decode 6\n");
722 dec_frame
.bitstream
= codec
->work_buffer
;
723 dec_frame
.length
= bytes
;
724 dec_frame
.render_flag
= 1;
726 //printf("decode 60\n");
727 decore(codec
->decode_handle
[current_field
], 0, &dec_frame
, NULL
);
728 //printf("decode 100\n");
732 // Now line average the Y buffer, doubling its height
733 // while keeping the UV buffers the same.
735 * if(codec->total_fields == 2)
737 * unsigned char *bitmap = dec_frame.bmp[0];
738 * unsigned char *in_row1 = bitmap + width_i * height_i / 2 - width_i * 2;
739 * unsigned char *in_row2 = in_row1 + width_i;
740 * unsigned char *out_row1 = bitmap + width_i * height_i - width_i * 2;
741 * unsigned char *out_row2 = out_row1 + width_i;
743 * while(in_row1 >= bitmap)
745 * unsigned char *in_ptr1 = in_row1;
746 * unsigned char *in_ptr2 = in_row2;
747 * unsigned char *out_ptr1 = out_row1;
748 * unsigned char *out_ptr2 = out_row2;
749 * if(current_field == 0)
750 * for(i = 0; i < width_i; i++)
752 * *out_ptr1++ = ((int64_t)*in_ptr1 + (int64_t)*in_ptr2) >> 1;
753 * *out_ptr2++ = *in_ptr2;
758 * for(i = 0; i < width_i; i++)
760 * *out_ptr1++ = *in_ptr1;
761 * *out_ptr2++ = ((int64_t)*in_ptr1 + (int64_t)*in_ptr2) >> 1;
765 * in_row1 -= width_i;
766 * in_row2 -= width_i;
767 * out_row1 -= width_i * 2;
768 * out_row2 -= width_i * 2;
773 //printf("decode 110\n");
775 // Convert to output colorspace
778 unsigned char **input_rows
= malloc(sizeof(unsigned char*) * height_i
);
779 for(i
= 0; i
< height_i
; i
++)
780 input_rows
[i
] = codec
->temp_frame
+ width_i
* 3;
783 cmodel_transfer(row_pointers
, /* Leave NULL if non existent */
785 row_pointers
[0], /* Leave NULL if non existent */
788 codec
->temp_frame
, /* Leave NULL if non existent */
789 codec
->temp_frame
+ width_i
* height_i
,
790 codec
->temp_frame
+ width_i
* height_i
+ width_i
* height_i
/ 4,
791 file
->in_x
, /* Dimensions to capture from input frame */
795 0, /* Dimensions to project on output frame */
801 0, /* When transfering BC_RGBA8888 to non-alpha this is the background color in 0xRRGGBB hex */
802 width_i
, /* For planar use the luma rowspan */
809 decore_save_global(&codec
->dec_param
[current_field
]);
810 pthread_mutex_unlock(&decode_mutex
);
813 //printf("decode 120\n");
820 static int encode(quicktime_t
*file
, unsigned char **row_pointers
, int track
)
822 longest offset
= quicktime_position(file
);
823 quicktime_video_map_t
*vtrack
= &(file
->vtracks
[track
]);
824 quicktime_divx_codec_t
*codec
= ((quicktime_codec_t
*)vtrack
->codec
)->priv
;
825 quicktime_trak_t
*trak
= vtrack
->track
;
826 int width
= trak
->tkhd
.track_width
;
827 int height
= trak
->tkhd
.track_height
;
828 int width_i
= (int)((float)width
/ 16 + 0.5) * 16;
829 int height_i
= (int)((float)height
/ 16 + 0.5) * 16;
832 ENC_FRAME encore_input
;
833 ENC_RESULT encore_result
;
834 int current_field
= vtrack
->current_position
% codec
->total_fields
;
837 pthread_mutex_lock(&encode_mutex
);
839 if(!codec
->encode_initialized
[current_field
])
841 codec
->encode_initialized
[current_field
] = 1;
842 codec
->encode_handle
[current_field
] = encode_handle
++;
843 codec
->enc_param
[current_field
].x_dim
= width_i
;
844 codec
->enc_param
[current_field
].y_dim
= height_i
;
845 codec
->enc_param
[current_field
].framerate
=
846 quicktime_frame_rate(file
, track
) / codec
->total_fields
;
847 codec
->enc_param
[current_field
].bitrate
=
848 codec
->bitrate
/ codec
->total_fields
;
849 codec
->enc_param
[current_field
].rc_period
= codec
->rc_period
;
850 codec
->enc_param
[current_field
].rc_reaction_period
= codec
->rc_reaction_period
;
851 codec
->enc_param
[current_field
].rc_reaction_ratio
= codec
->rc_reaction_ratio
;
852 codec
->enc_param
[current_field
].max_quantizer
= codec
->max_quantizer
;
853 codec
->enc_param
[current_field
].min_quantizer
= codec
->min_quantizer
;
854 codec
->enc_param
[current_field
].max_key_interval
= codec
->max_key_interval
;
856 codec
->enc_param
[current_field
].search_range
= codec
->quality
* 3;
857 if(codec
->enc_param
[current_field
].search_range
> 15)
858 codec
->enc_param
[current_field
].search_range
= 15;
860 encore(codec
->encode_handle
[current_field
],
862 &codec
->enc_param
[current_field
], NULL
);
866 // Assume planes are contiguous.
867 // Encode directly from function arguments
868 if(file
->color_model
== BC_YUV420P
&&
872 encore_input
.image
= row_pointers
[0];
874 // Convert to YUV420P
875 // Encode from temporary.
878 if(!codec
->temp_frame
)
880 codec
->temp_frame
= malloc(width_i
* height_i
* 3 / 2);
883 cmodel_transfer(0, /* Leave NULL if non existent */
885 codec
->temp_frame
, /* Leave NULL if non existent */
886 codec
->temp_frame
+ width_i
* height_i
,
887 codec
->temp_frame
+ width_i
* height_i
+ width_i
* height_i
/ 4,
888 row_pointers
[0], /* Leave NULL if non existent */
891 0, /* Dimensions to capture from input frame */
895 0, /* Dimensions to project on output frame */
901 0, /* When transfering BC_RGBA8888 to non-alpha this is the background color in 0xRRGGBB hex */
902 width
, /* For planar use the luma rowspan */
906 encore_input
.image
= codec
->temp_frame
;
909 // Now shrink the Y buffer by half to contain just one field
911 * if(codec->total_fields == 2)
913 * unsigned char *out_ptr = encore_input.image;
914 * unsigned char *in_ptr = encore_input.image + current_field * width_i;
915 * int size = width_i * height_i;
916 * while(in_ptr < (unsigned char*)encore_input.image + size)
918 * for(i = 0; i < width_i; i++)
919 * *out_ptr++ = *in_ptr++;
922 * bzero(out_ptr, (unsigned char*)encore_input.image + size - out_ptr);
929 if(!codec
->work_buffer
)
931 codec
->buffer_size
= width
* height
;
932 codec
->work_buffer
= malloc(codec
->buffer_size
);
936 bzero(codec
->work_buffer
, codec
->buffer_size
);
937 encore_input
.bitstream
= codec
->work_buffer
;
938 encore_input
.length
= 0;
939 encore_input
.quant
= !codec
->fix_bitrate
? codec
->quantizer
: 0;
941 if(codec
->p_count
== 0)
943 codec
->p_count
[current_field
]++;
947 codec
->p_count
[current_field
]++;
948 if(codec
->p_count
[current_field
] >= codec
->max_key_interval
)
949 codec
->p_count
[current_field
] = 0;
952 encore(codec
->encode_handle
[current_field
],
956 pthread_mutex_unlock(&encode_mutex
);
958 result
= !quicktime_write_data(file
,
960 encore_input
.length
);
961 quicktime_update_tables(file
,
964 vtrack
->current_chunk
,
965 vtrack
->current_position
,
967 encore_input
.length
);
969 if(encore_result
.isKeyFrame
)
970 quicktime_insert_keyframe(file
, file
->vtracks
[track
].current_position
, track
);
972 file
->vtracks
[track
].current_chunk
++;
978 static int set_parameter(quicktime_t
*file
,
983 quicktime_video_map_t
*vtrack
= &(file
->vtracks
[track
]);
984 quicktime_divx_codec_t
*codec
= ((quicktime_codec_t
*)vtrack
->codec
)->priv
;
986 if(!strcasecmp(key
, "divx_bitrate"))
987 codec
->bitrate
= *(int*)value
;
989 if(!strcasecmp(key
, "divx_rc_period"))
990 codec
->rc_period
= *(int*)value
;
992 if(!strcasecmp(key
, "divx_rc_reaction_ratio"))
993 codec
->rc_reaction_ratio
= *(int*)value
;
995 if(!strcasecmp(key
, "divx_rc_reaction_period"))
996 codec
->rc_reaction_period
= *(int*)value
;
998 if(!strcasecmp(key
, "divx_max_key_interval"))
999 codec
->max_key_interval
= *(int*)value
;
1001 if(!strcasecmp(key
, "divx_max_quantizer"))
1002 codec
->max_quantizer
= *(int*)value
;
1004 if(!strcasecmp(key
, "divx_min_quantizer"))
1005 codec
->min_quantizer
= *(int*)value
;
1007 if(!strcasecmp(key
, "divx_quantizer"))
1008 codec
->quantizer
= *(int*)value
;
1010 if(!strcasecmp(key
, "divx_quality"))
1011 codec
->quality
= *(int*)value
;
1013 if(!strcasecmp(key
, "divx_fix_bitrate"))
1014 codec
->fix_bitrate
= *(int*)value
;
1016 if(!strcasecmp(key
, "divx_use_deblocking"))
1017 codec
->use_deblocking
= *(int*)value
;
1022 void quicktime_init_codec_divx(quicktime_video_map_t
*vtrack
)
1024 quicktime_divx_codec_t
*codec
;
1026 /* Init public items */
1027 ((quicktime_codec_t
*)vtrack
->codec
)->priv
= calloc(1, sizeof(quicktime_divx_codec_t
));
1028 ((quicktime_codec_t
*)vtrack
->codec
)->delete_vcodec
= delete_codec
;
1029 ((quicktime_codec_t
*)vtrack
->codec
)->decode_video
= decode
;
1030 ((quicktime_codec_t
*)vtrack
->codec
)->encode_video
= encode
;
1031 ((quicktime_codec_t
*)vtrack
->codec
)->reads_colormodel
= reads_colormodel
;
1032 ((quicktime_codec_t
*)vtrack
->codec
)->writes_colormodel
= writes_colormodel
;
1033 ((quicktime_codec_t
*)vtrack
->codec
)->set_parameter
= set_parameter
;
1035 codec
= ((quicktime_codec_t
*)vtrack
->codec
)->priv
;
1037 codec
->bitrate
= 1000000;
1038 codec
->rc_period
= 50;
1039 codec
->rc_reaction_ratio
= 45;
1040 codec
->rc_reaction_period
= 10;
1041 codec
->max_key_interval
= 45;
1042 codec
->max_quantizer
= 31;
1043 codec
->min_quantizer
= 1;
1044 codec
->quantizer
= 10;
1046 codec
->fix_bitrate
= 1;
1047 codec
->total_fields
= 1;
1050 void quicktime_init_codec_hv60(quicktime_video_map_t
*vtrack
)
1052 quicktime_init_codec_divx(vtrack
);
1053 quicktime_divx_codec_t
*codec
;
1055 codec
= ((quicktime_codec_t
*)vtrack
->codec
)->priv
;
1057 codec
->total_fields
= 2;