return 0;
}
-static int read_frame_internal( cli_pic_t *pic, raw_hnd_t *h )
+static int read_frame_internal( cli_pic_t *pic, raw_hnd_t *h, int bit_depth_uc )
{
int error = 0;
int pixel_depth = x264_cli_csp_depth_factor( pic->img.csp );
for( int i = 0; i < pic->img.planes && !error; i++ )
{
error |= fread( pic->img.plane[i], pixel_depth, h->plane_size[i], h->fh ) != h->plane_size[i];
- if( h->bit_depth & 7 )
+ if( bit_depth_uc )
{
/* upconvert non 16bit high depth planes to 16bit using the same
* algorithm as used in the depth filter. */
else
while( i_frame > h->next_frame )
{
- if( read_frame_internal( pic, h ) )
+ if( read_frame_internal( pic, h, 0 ) )
return -1;
h->next_frame++;
}
}
- if( read_frame_internal( pic, h ) )
+ if( read_frame_internal( pic, h, h->bit_depth & 7 ) )
return -1;
h->next_frame = i_frame+1;
return 0;
}
-static int read_frame_internal( cli_pic_t *pic, y4m_hnd_t *h )
+static int read_frame_internal( cli_pic_t *pic, y4m_hnd_t *h, int bit_depth_uc )
{
size_t slen = strlen( Y4M_FRAME_MAGIC );
int pixel_depth = x264_cli_csp_depth_factor( pic->img.csp );
for( i = 0; i < pic->img.planes && !error; i++ )
{
error |= fread( pic->img.plane[i], pixel_depth, h->plane_size[i], h->fh ) != h->plane_size[i];
- if( h->bit_depth & 7 )
+ if( bit_depth_uc )
{
/* upconvert non 16bit high depth planes to 16bit using the same
* algorithm as used in the depth filter. */
else
while( i_frame > h->next_frame )
{
- if( read_frame_internal( pic, h ) )
+ if( read_frame_internal( pic, h, 0 ) )
return -1;
h->next_frame++;
}
}
- if( read_frame_internal( pic, h ) )
+ if( read_frame_internal( pic, h, h->bit_depth & 7 ) )
return -1;
h->next_frame = i_frame+1;