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;
