- unsigned chroma_width_blocks = (dinfo.output_width + h_mcu_size - 1) / h_mcu_size;
- unsigned width_blocks = chroma_width_blocks * dinfo.max_h_samp_factor;
- unsigned chroma_height_blocks = (dinfo.output_height + v_mcu_size - 1) / v_mcu_size;
- unsigned height_blocks = chroma_height_blocks * dinfo.max_v_samp_factor;
+ unsigned mcu_width_blocks = (dinfo.output_width + h_mcu_size - 1) / h_mcu_size;
+ unsigned mcu_height_blocks = (dinfo.output_height + v_mcu_size - 1) / v_mcu_size;
+
+ unsigned luma_width_blocks = mcu_width_blocks * dinfo.comp_info[0].h_samp_factor;
+ unsigned chroma_width_blocks = mcu_width_blocks * dinfo.comp_info[1].h_samp_factor;
+ unsigned luma_height_blocks = mcu_height_blocks * dinfo.comp_info[0].v_samp_factor;
+ unsigned chroma_height_blocks = mcu_height_blocks * dinfo.comp_info[1].v_samp_factor;