Delete ProgressiveDecoder::VertTable
Since the code that reads out of this class has been deleted, the class
is no longer useful.
Change-Id: I973eb2ddf384933400d505361486625d829c1b8e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/122293
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@google.com>
diff --git a/core/fxcodec/progressive_decoder.cpp b/core/fxcodec/progressive_decoder.cpp
index a4815b9..c552f67 100644
--- a/core/fxcodec/progressive_decoder.cpp
+++ b/core/fxcodec/progressive_decoder.cpp
@@ -130,69 +130,6 @@
});
}
-ProgressiveDecoder::VertTable::VertTable() = default;
-
-ProgressiveDecoder::VertTable::~VertTable() = default;
-
-void ProgressiveDecoder::VertTable::CalculateWeights(int dest_len,
- int src_len) {
- CHECK_GE(dest_len, 0);
- m_ItemSize =
- pdfium::checked_cast<int>(PixelWeight::TotalBytesForWeightCount(2));
- FX_SAFE_SIZE_T safe_size = m_ItemSize;
- safe_size *= dest_len;
- m_pWeightTables.resize(safe_size.ValueOrDie(), 0);
- double scale = (double)dest_len / (double)src_len;
- UNSAFE_TODO({
- if (scale <= 1) {
- for (int dest_row = 0; dest_row < dest_len; dest_row++) {
- PixelWeight* pWeight = GetPixelWeight(dest_row);
- pWeight->m_SrcStart = dest_row;
- pWeight->m_SrcEnd = dest_row;
- pWeight->m_Weights[0] = CStretchEngine::kFixedPointOne;
- pWeight->m_Weights[1] = 0;
- }
- return;
- }
-
- double step = 0.0;
- int src_row = 0;
- while (step < (double)dest_len) {
- int start_step = (int)step;
- step = scale * (++src_row);
- int end_step = (int)step;
- if (end_step >= dest_len) {
- end_step = dest_len;
- for (int dest_row = start_step; dest_row < end_step; dest_row++) {
- PixelWeight* pWeight = GetPixelWeight(dest_row);
- pWeight->m_SrcStart = start_step;
- pWeight->m_SrcEnd = start_step;
- pWeight->m_Weights[0] = CStretchEngine::kFixedPointOne;
- pWeight->m_Weights[1] = 0;
- }
- return;
- }
- int length = end_step - start_step;
- {
- PixelWeight* pWeight = GetPixelWeight(start_step);
- pWeight->m_SrcStart = start_step;
- pWeight->m_SrcEnd = start_step;
- pWeight->m_Weights[0] = CStretchEngine::kFixedPointOne;
- pWeight->m_Weights[1] = 0;
- }
- for (int dest_row = start_step + 1; dest_row < end_step; dest_row++) {
- PixelWeight* pWeight = GetPixelWeight(dest_row);
- pWeight->m_SrcStart = start_step;
- pWeight->m_SrcEnd = end_step;
- pWeight->m_Weights[0] = CStretchEngine::FixedFromFloat(
- (float)(end_step - dest_row) / (float)length);
- pWeight->m_Weights[1] =
- CStretchEngine::kFixedPointOne - pWeight->m_Weights[0];
- }
- }
- });
-}
-
ProgressiveDecoder::ProgressiveDecoder() = default;
ProgressiveDecoder::~ProgressiveDecoder() = default;
@@ -546,7 +483,6 @@
options.bInterpolateBilinear = true;
m_WeightHorz.CalculateWeights(m_SrcWidth, 0, m_SrcWidth, m_SrcWidth, 0,
m_SrcWidth, options);
- m_WeightVert.CalculateWeights(m_SrcHeight, m_SrcHeight);
m_status = FXCODEC_STATUS::kDecodeToBeContinued;
return m_status;
}
@@ -615,7 +551,6 @@
options.bInterpolateBilinear = true;
m_WeightHorz.CalculateWeights(m_SrcWidth, 0, m_SrcWidth, m_SrcWidth, 0,
m_SrcWidth, options);
- m_WeightVert.CalculateWeights(m_SrcHeight, m_SrcHeight);
m_FrameCur = 0;
m_status = FXCODEC_STATUS::kDecodeToBeContinued;
return m_status;
@@ -721,7 +656,6 @@
options.bInterpolateBilinear = true;
m_WeightHorz.CalculateWeights(m_SrcWidth, 0, m_SrcWidth, m_SrcWidth, 0,
m_SrcWidth, options);
- m_WeightVert.CalculateWeights(m_SrcHeight, m_SrcHeight);
switch (m_SrcComponents) {
case 1:
m_SrcFormat = FXCodec_8bppGray;
@@ -899,7 +833,6 @@
int scanline_size = FxAlignToBoundary<4>(m_SrcWidth * m_SrcComponents);
m_DecodeBuf.resize(scanline_size);
m_WeightHorzOO.CalculateWeights(m_SrcWidth, m_SrcWidth);
- m_WeightVert.CalculateWeights(m_SrcHeight, m_SrcHeight);
m_status = FXCODEC_STATUS::kDecodeToBeContinued;
return m_status;
}
diff --git a/core/fxcodec/progressive_decoder.h b/core/fxcodec/progressive_decoder.h
index 57d1b78..3421add 100644
--- a/core/fxcodec/progressive_decoder.h
+++ b/core/fxcodec/progressive_decoder.h
@@ -135,23 +135,6 @@
DataVector<uint8_t> m_pWeightTables;
};
- class VertTable {
- public:
- VertTable();
- ~VertTable();
-
- void CalculateWeights(int dest_len, int src_len);
- PixelWeight* GetPixelWeight(int pixel) {
- return reinterpret_cast<PixelWeight*>(pdfium::make_span(m_pWeightTables)
- .subspan(pixel * m_ItemSize)
- .data());
- }
-
- private:
- int m_ItemSize = 0;
- DataVector<uint8_t> m_pWeightTables;
- };
-
#ifdef PDF_ENABLE_XFA_BMP
bool BmpReadMoreData(ProgressiveDecoderIface::Context* pBmpContext,
FXCODEC_STATUS* err_status);
@@ -227,7 +210,6 @@
uint32_t m_offSet = 0;
int m_ScanlineSize = 0;
WeightTable m_WeightHorz;
- VertTable m_WeightVert;
HorzTable m_WeightHorzOO;
int m_SrcWidth = 0;
int m_SrcHeight = 0;