too bad, odd mb row count mpeg-2 streams were broken.

This commit is contained in:
rwillenbacher 2022-08-15 17:11:52 +02:00
parent 73f9f28e2f
commit 044909dc7b
4 changed files with 28 additions and 7 deletions

View file

@ -47,6 +47,8 @@ void y262_write_sequence_header( y262_t *ps_context )
{
s_sequence_header.i_horizontal_size = ps_context->i_sequence_width;
}
if( ps_context->b_progressive_sequence )
{
if( ( ps_context->i_sequence_height >> 4 ) == ( ( ps_context->i_sequence_display_height + 15 ) >> 4 ) )
{
s_sequence_header.i_vertical_size = ps_context->i_sequence_display_height;
@ -55,6 +57,18 @@ void y262_write_sequence_header( y262_t *ps_context )
{
s_sequence_header.i_vertical_size = ps_context->i_sequence_height;
}
}
else
{
if( ( ps_context->i_sequence_height >> 5 ) == ( ( ps_context->i_sequence_display_height + 31 ) >> 5 ) )
{
s_sequence_header.i_vertical_size = ps_context->i_sequence_display_height;
}
else
{
s_sequence_header.i_vertical_size = ps_context->i_sequence_height;
}
}
s_sequence_header.i_aspect_ratio_information = ps_context->i_sequence_aspect_ratio_information;
s_sequence_header.i_frame_rate_code = ps_context->i_sequence_pulldown_frame_rate_code;
s_sequence_header.b_marker_bit = 1;

View file

@ -471,7 +471,7 @@ int32_t y262_initialize( void *p_y262, y262_configuration_t *ps_config )
{
return Y262_INIT_ERROR_CODED_SIZE;
}
if( ( ps_config->i_coded_height & 0xf ) != 0 )
if( ( ( ps_config->i_coded_height & 0xf ) != 0 ) || ( ps_config->b_interlaced && ( ps_config->i_coded_height & 0x1f ) != 0 ) )
{
return Y262_INIT_ERROR_CODED_SIZE;
}
@ -601,7 +601,7 @@ int32_t y262_initialize( void *p_y262, y262_configuration_t *ps_config )
}
else
{
ps_y262->b_progressive_sequence = FALSE;
ps_y262->b_progressive_sequence = !ps_config->b_interlaced;
ps_y262->i_intra_dc_precision = 1;
}
ps_y262->b_frame_pred_frame_dct = !ps_config->b_interlaced; /* interlaced */

View file

@ -104,7 +104,7 @@ typedef struct {
int32_t i_display_width; /* display width, for example 1920 */
int32_t i_display_height; /* display height, for example 1080 */
int32_t i_coded_width; /* coded width, has to be multiple of 16, for example 1920 */
int32_t i_coded_height; /* coded height, has to be multiple of 16, for example 1088 */
int32_t i_coded_height; /* coded height, has to be multiple of 16, for example 1088, or multiple of 32 if b_interlaced is set */
#define Y262_CHROMA_FORMAT_420 1
#define Y262_CHROMA_FORMAT_422 2
#define Y262_CHROMA_FORMAT_444 3

View file

@ -719,7 +719,14 @@ int32_t main( int32_t i_argc, char *rgpi8_argv[] )
s_config.i_display_width = i_width;
s_config.i_display_height = i_height;
i_pad_x = ( ( ( i_width + 15 ) / 16 ) * 16 ) - i_width;
if( !s_config.b_interlaced )
{
i_pad_y = ( ( ( i_height + 15 ) / 16 ) * 16 ) - i_height;
}
else
{
i_pad_y = ( ( ( i_height + 31 ) / 32 ) * 32 ) - i_height;
}
s_config.i_coded_width = i_width + i_pad_x;
s_config.i_coded_height = i_height + i_pad_y;