Skip to content

Commit

Permalink
minivideo: minor cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
emericg committed Jun 27, 2024
1 parent fae901f commit 6a81875
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion minivideo/src/decoder/h264/h264.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ int h264_decode_nalu(DecodingContext_t *dc, const int64_t nalu_offset, const int
dc->profile_idc = sps->profile_idc;
dc->ChromaArrayType = sps->ChromaArrayType;

// Init some quantization tables
// Init quantization tables
computeLevelScale4x4(dc, sps);
computeLevelScale8x8(dc, sps);

Expand Down
2 changes: 1 addition & 1 deletion minivideo/src/decoder/h264/h264_intra_prediction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static int ipcm_construction_process(DecodingContext_t *dc, Macroblock_t *mb);
* process and, for Intra_NxN prediction modes (where NxN is equal to 4x4 or 8x8),
* the values of IntraNxNPredMode from neighbouring macroblocks.
*
* The transformations (idct and quantization) must be done block by block inside
* The transformations (IDCT and quantization) must be done block by block inside
* the intra prediction process, because the results (transformed blocks) are
* directly used by the intra prediction process.
*
Expand Down
16 changes: 7 additions & 9 deletions minivideo/src/decoder/h264/h264_parameterset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,8 @@ int decodeSPS(Bitstream_t *bitstr, h264_sps_t *sps)
}
}

if (sps->SubWidthC)
sps->MbWidthC = 16 / sps->SubWidthC;
if (sps->SubHeightC)
sps->MbHeightC = 16 / sps->SubHeightC;
if (sps->SubWidthC) sps->MbWidthC = 16 / sps->SubWidthC;
if (sps->SubHeightC) sps->MbHeightC = 16 / sps->SubHeightC;

sps->bit_depth_luma_minus8 = read_ue(bitstr);
sps->BitDepthY = 8 + sps->bit_depth_luma_minus8;
Expand All @@ -322,7 +320,7 @@ int decodeSPS(Bitstream_t *bitstr, h264_sps_t *sps)
sps->BitDepthC = 8 + sps->bit_depth_chroma_minus8;
sps->QpBdOffsetC = 6 * sps->bit_depth_chroma_minus8;

sps->RawMbBits = 256 * sps->BitDepthY + 2 * sps->MbWidthC * sps->MbHeightC * sps->BitDepthC;
sps->RawMbBits = (256 * sps->BitDepthY) + (2 * sps->MbWidthC * sps->MbHeightC * sps->BitDepthC);

sps->qpprime_y_zero_transform_bypass_flag = read_bit(bitstr);

Expand Down Expand Up @@ -728,10 +726,10 @@ void printSPS(h264_sps_t *sps)
TRACE_1(PARAM, " - seq_scaling_matrix_present_flag = %i", sps->seq_scaling_matrix_present_flag);
if (sps->seq_scaling_matrix_present_flag)
{
for (i = 0; i < ((sps->ChromaArrayType != 3) ? 8 : 12); i++)
{
TRACE_1(PARAM, " - seq_scaling_list_present_flag[%i]= %i", i, sps->seq_scaling_list_present_flag[i]);
}
for (i = 0; i < ((sps->ChromaArrayType != 3) ? 8 : 12); i++)
{
TRACE_1(PARAM, " - seq_scaling_list_present_flag[%i]= %i", i, sps->seq_scaling_list_present_flag[i]);
}
}

TRACE_1(PARAM, " - log2_max_frame_num_minus4 = %i", sps->log2_max_frame_num_minus4);
Expand Down
14 changes: 11 additions & 3 deletions minivideo/src/decoder/h264/h264_transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -680,8 +680,12 @@ void computeLevelScale4x4(DecodingContext_t *dc, h264_sps_t *sps)
{
TRACE_1(TRANS, "YCbCr: %i / Qp: %i", YCbCr, q);
for (i = 0; i < 4; i++)
{
for (j = 0; j < 4; j++)
{
TRACE_1(TRANS, "levelscale_4x4: %i", sps->LevelScale4x4[YCbCr][q][i][j]);
}
}
}
}
*/
Expand Down Expand Up @@ -732,8 +736,12 @@ void computeLevelScale8x8(DecodingContext_t *dc, h264_sps_t *sps)
{
TRACE_1(TRANS, "YCbCr: %i / Qp: %i", YCbCr, q);
for (i = 0; i < 8; i++)
{
for (j = 0; j < 8; j++)
{
TRACE_1(TRANS, " levelscale_8x8[%i][%i]: %i", i, j, sps->LevelScale8x8[YCbCr][q][i][j]);
}
}
}
}
*/
Expand All @@ -750,7 +758,7 @@ void computeLevelScale8x8(DecodingContext_t *dc, h264_sps_t *sps)
* From 'ITU-T H.264' recommendation:
* 8.5.10 Scaling and transformation process for DC transform coefficients for Intra_16x16 macroblock type.
*
* Note: For DC coefficients, the quantization is done after the idct.
* Note: For DC coefficients, the quantization is done after the IDCT.
*/
static int transform_16x16_lumadc(DecodingContext_t *dc, const int c[4][4], int dcY[4][4])
{
Expand Down Expand Up @@ -821,7 +829,7 @@ static int transform_16x16_lumadc(DecodingContext_t *dc, const int c[4][4], int
* From 'ITU-T H.264' recommendation:
* 8.5.11 Scaling and transformation process for chroma DC transform coefficients.
*
* Note: For DC coefficients, the quantization is done after the idct.
* Note: For DC coefficients, the quantization is done after the IDCT.
*/
static int transform_2x2_chromadc(DecodingContext_t *dc, const int YCbCr,
const int c[2][2], int dcC[2][2])
Expand Down Expand Up @@ -867,7 +875,7 @@ static int transform_2x2_chromadc(DecodingContext_t *dc, const int YCbCr,
* From 'ITU-T H.264' recommendation:
* 8.5.11 Scaling and transformation process for chroma DC transform coefficients.
*
* Note: For DC coefficients, the quantization is done after the idct.
* Note: For DC coefficients, the quantization is done after the IDCT.
*/
static int transform_4x4_chromadc(DecodingContext_t *dc, const int YCbCr,
const int c[4][4], int dcC[4][4])
Expand Down
2 changes: 2 additions & 0 deletions minivideo/src/depacketizer/depack.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include "depack_struct.h"
#include "../bitstream.h"

#include <vector>

/* ************************************************************************** */

minivideo_EXPORT unsigned depack_sample(MediaFile_t *media,
Expand Down

0 comments on commit 6a81875

Please sign in to comment.